macOS build compatibility for client tools#196
Open
wkoszek wants to merge 1 commit into
Open
Conversation
518c037 to
979c7c7
Compare
Enable building Slurm client tools (squeue, sbatch, srun, sinfo,
salloc, sacct, scancel, scontrol) on macOS/Darwin without munge.
Changes:
- xsched.h: add cpu_set_t typedef and CPU_SET* macros for macOS
- xsched.c: stub sched_setaffinity/getaffinity and CPU_COUNT_S for macOS
- macros.h: add macOS shims for pipe2, accept4, fexecve, setresuid/gid,
SOCK_CLOEXEC, POSIX real-time timers (timer_create/settime/delete),
and struct itimerspec
- net.c: define SOL_TCP as IPPROTO_TCP; guard cr_pid (FreeBSD-only
field in struct xucred) for macOS
- slurm_resolv.c: include arpa/nameser_compat.h for C_IN/T_SRV on macOS
- data_parser/*/parsers.c: define SIGRTMAX fallback (no RT signals on macOS)
- auxdir/slurm.m4: fix -Wl,-rpath= to -Wl,-rpath, for Apple ld64
- configure.ac: add DARWIN automake conditional
- configure: regenerated
- make_ref.include: use clang .incbin asm for binary embedding on macOS
instead of GNU ld --format=binary
- slurmd/Makefile.am: guard -Wl,--no-as-needed (GNU ld only)
- salloc/signals.c, srun/signals.c: replace eventfd() with pipe pair on macOS
- srun/srun_job.c, cgroup files: guard sys/eventfd.h include on macOS
Build with:
mkdir b && cd b
CPPFLAGS="-I/opt/homebrew/include" LDFLAGS="-L/opt/homebrew/lib" \
../configure --with-munge=no
make
Signed-off-by: Adam Koszek <adam@koszek.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
979c7c7 to
7f6146b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I'm making an exploratory change here -- with the changes in the PR, I can successfully build slurm binaries. The idea here is that my main Macbook would be a submitter of jobs to the cluster. The changes are mostly around non-standard functions that only exist in Linux. I wonder if there'd be interest in moving to more standard APIs or actually accepting some of this compatibility code? If so, I'd be happy to look into changes one by one (so far: pipe2/accept4 seem like they could just work, also SOL_TCP -> IPPROTO_TCP would be no-op change with more compatibility too).
Description
Enable building Slurm client tools (
squeue,sbatch,srun,sinfo,salloc,sacct,scancel,scontrol) on macOS/Darwin without munge.Tested on macOS 15 (Sequoia) / Apple Silicon (aarch64) with:
Changes
src/common/xsched.h: addcpu_set_ttypedef andCPU_SET*macros for macOSsrc/common/xsched.c: stubsched_setaffinity/getaffinityandCPU_COUNT_Sfor macOSsrc/common/macros.h: add macOS shims forpipe2,accept4,fexecve,setresuid/setresgid,SOCK_CLOEXEC, POSIX real-time timers (timer_create/timer_settime/timer_delete), andstruct itimerspecsrc/common/net.c: defineSOL_TCPasIPPROTO_TCP; guardcr_pid(FreeBSD-only field instruct xucred) for macOSsrc/common/slurm_resolv.c: includearpa/nameser_compat.hforC_IN/T_SRVon macOSsrc/plugins/data_parser/v0.0.{42-45}/parsers.c: defineSIGRTMAXfallback (no RT signals on macOS)auxdir/slurm.m4: fix-Wl,-rpath=to-Wl,-rpath,for Apple ld64configure.ac: addDARWINautomake conditionalmake_ref.include: use clang.incbinassembler for binary embedding on macOS instead of GNU ld--format=binarysrc/slurmd/slurmd/Makefile.am: guard-Wl,--no-as-needed(GNU ld only)src/salloc/signals.c,src/srun/signals.c: replaceeventfd()with pipe pair on macOSsrc/srun/srun_job.c, cgroup plugin headers: guard<sys/eventfd.h>include on macOSTest plan
--with-munge=nosqueue --version, etc.)🤖 Generated with Claude Code