#363 attempted to fix #356
posix_spawn_file_actions_addchdir was introduced in macOS 26.
When MACOSX_DEPLOYMENT_TARGET=11.0 (as it is on GHC CI) is set, clang will emit a weak reference to this symbol. However, weak references on MachO objects don't behave like weak references on ELF (see iains/gcc-darwin-arm64#133). A final link with undefined weak references still fails.
We see this on GHC CI, where a process library built against macOS 26 is attempted to be linked against a homebrew/clang toolchain not exposing posix_spawn_file_actions_addchdir, resulting in a link failure:
https://gitlab.haskell.org/ghc/ghcup-ci/-/jobs/2539703
Undefined symbols for architecture arm64:
"_posix_spawn_file_actions_addchdir", referenced from:
_do_spawn_posix in libHSprocess-1.6.29.0-d296.a[4](posix_spawn.o)
_do_spawn_posix in libHSprocess-1.6.29.0-d296.a[4](posix_spawn.o)
I think that the correct fix is to pass -Wl,-U,_posix_spawn_file_actions_addchdir in ld-options: in the cabal file, which will allow the link to succeed when this symbol is missing (setting it to null), which will then allow the fix in #363 to take effect.
#363 attempted to fix #356
posix_spawn_file_actions_addchdirwas introduced in macOS 26.When
MACOSX_DEPLOYMENT_TARGET=11.0(as it is on GHC CI) is set, clang will emit a weak reference to this symbol. However, weak references on MachO objects don't behave like weak references on ELF (see iains/gcc-darwin-arm64#133). A final link with undefined weak references still fails.We see this on GHC CI, where a process library built against macOS 26 is attempted to be linked against a homebrew/clang toolchain not exposing
posix_spawn_file_actions_addchdir, resulting in a link failure:https://gitlab.haskell.org/ghc/ghcup-ci/-/jobs/2539703
I think that the correct fix is to pass
-Wl,-U,_posix_spawn_file_actions_addchdirinld-options:in the cabal file, which will allow the link to succeed when this symbol is missing (setting it to null), which will then allow the fix in #363 to take effect.