Closed issue by ejolson2005 on void-packages repository https://github.com/void-linux/void-packages/issues/16777 Description: ### System xuname: Void 5.3.11_1 x86_64-musl AuthenticAMD notuptodate rF package: slurm-wlm ### Expected behavior Build package using musl. ### Actual behavior Doesn't build. ### Steps to reproduce the behavior Try to build package. ### Fix I downloaded the current release of slurm-19.05.4 and tried to compile it. I ran into three problems and will now describe three workarounds to make things work: 1. inet_nsap_addr is missing from musl. This is easily corrected by extracting the corresponding code from glibc which is ``` static char xtob(int c) { return (c - (((c >= '0') && (c <= '9')) ? '0' : '7')); } static unsigned int inet_nsap_addr(const char *ascii, unsigned char *binary, int maxlen) { unsigned char c, nib; unsigned int len = 0; while ((c = *ascii++) != '\0' && len < (unsigned int)maxlen) { if (c == '.' || c == '+' || c == '/') continue; if (!isascii(c)) return (0); c = toupper(c); if (isxdigit(c)) { nib = xtob(c); c = *ascii++; if (c != '\0') { c = toupper(c); if (isxdigit(c)) { *binary++ = (nib << 4) | xtob(c); len++; } else return (0); } else return (0); } else return (0); } return (len); } ``` and plopping it into the file src/common/callerid.c just before the _find_match_in_tcp_file routine. 2. The next problem was getgrent_r seemed to be missing. Upon reading the code in src/slurmctld/groups.c and upon reading the comment ``` /* Note that in environments where user/group enumeration has * been disabled (typically necessary for large user/group * databases), the rest of this function essentially does * nothing. */ ``` Decided to simply comment out the offending code by inserting #ifdef OMMITED just before line 158 and then ending that with #endif just before xfree(grp_buffer); around line 228. 3. The final problem was that cpu_set_t wasn't defined before src/slurmd/slurmd/req.c needed to use this. This is a struct consisting of an array which is usually defined in but only when _GNU_SOURCE is defined. Somewhere, that was not happening before sched.h was first included and the include guard prevented subsequent includes of the same file after _GNU_SOURCE had been defined from having any effect. Rather than track down how to fix this correctly, I simply copied the needed line from into req.c right after #include around line 55 which read ``` typedef struct cpu_set_t { unsigned long __bits[128/sizeof(long)]; } cpu_set_t; ``` After the above three changes slurm installed and seems to function correctly. I'm not suggesting that the changes I made above be included in VOID, but have only listed them to indicate the present difficulties with slurm-wlm not building with musl are relatively superficial and can be easily worked around, if necessary.