ci(macos): drop -undefined dynamic_lookup from macOS linker flags#293
Merged
Conversation
The macOS "Configure Rust linker" step wrote
`-undefined dynamic_lookup` (plus `-dead_strip`) into the cargo
rustflags. `-undefined dynamic_lookup` is a loadable-bundle linker
mode and is invalid for executables/test binaries. On Apple Silicon
it produces Mach-O binaries dyld cannot map against the shared cache,
surfacing at runtime as:
dyld cache '(null)' not loaded: syscall to map cache into shared region failed
Library not loaded: .../SystemConfiguration.framework (no dyld cache)
process ... (signal: 6, SIGABRT)
SystemConfiguration.framework only lives inside the dyld shared cache
on modern macOS, so once the cache fails to map, any binary that
references it (helios-rest, via reqwest) aborts. Linux and Windows
link fine without this flag; it was never needed.
Replace the flags in all six jobs with just the 8 MB main-thread
stack bump that mirrors the Linux config, and add a comment so the
bad flag does not come back.
Claude-Session: https://claude.ai/code/session_01Vnu2A87mWaKnbeFuWZSwkd
smunini
added a commit
that referenced
this pull request
Jul 17, 2026
Follow-up to #293. Replacing `-undefined dynamic_lookup` with `-Wl,-stack_size,0x800000` fixed the dyld crash but introduced a new build failure: ld64 rejects `-stack_size` on any link that is not a main executable — ld: -stack_size option can only be used when linking a main executable cargo applies rustflags to every link invocation, including proc-macro/cdylib crates (e.g. serde_derive, linked `-dynamiclib`), so the flag fails the build before any test runs. On Linux the equivalent `-zstack-size` is silently accepted for shared objects, which is why it was never caught there. macOS already defaults the main-thread stack to 8 MB — the same value the Linux side sets explicitly — so no override is needed. Drop the custom rustflags on macOS entirely. Claude-Session: https://claude.ai/code/session_01Vnu2A87mWaKnbeFuWZSwkd
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.
Problem
The macOS
test-rustjob (and other self-hosted-runner jobs) intermittently abort at runtime — not at compile time — with:Observed on PR #244: https://github.com/HeliosSoftware/hfs/actions/runs/29596368102/job/87937639611
Root cause
The "Configure Rust linker (macOS)" step wrote these rustflags into
~/.cargo/config.toml:-undefined dynamic_lookupis a loadable-bundle linker mode — it is not valid for executables or test binaries. On Apple Silicon it yields Mach-O binaries dyld cannot map against the shared cache, which surfaces assyscall to map cache into shared region failed. That then cascades into "SystemConfiguration.framework not loaded", because that framework only exists inside the dyld shared cache on modern macOS — once the cache fails to map, any binary referencing it (herehelios-rest, viareqwest) aborts with SIGABRT.Introduced in
52ec228e6("Removed lld for macOS"). Linux and Windows link fine with no equivalent flag, confirming it was never needed.Fix
Replace the flags in all 6 jobs with just the 8 MB main-thread stack bump that mirrors the Linux config, and add a comment so the bad flag does not return:
Note
This crash class can also appear intermittently on self-hosted Apple Silicon runners due to shared-region map exhaustion across many uniquely-signed binaries in a single boot. Removing the bad flag is the correct, highest-leverage fix; if sporadic "map cache into shared region failed" persists afterward, that points to runner-host state (cleared by a reboot), independent of this workflow bug.
https://claude.ai/code/session_01Vnu2A87mWaKnbeFuWZSwkd