ar -L can't be used on Darwin
Apple's ar
and ld
currently do not support the transparent use of archives (e.g. allowing a static archive to be named with .o
). However, the user may nevertheless install a toolchain (e.g. an LLVM distribution from Homebrew) which does support this. If GHC is configured with such a toolchain we will attempt to use the ar -L
path instead of object merging, which will break during linking
This was originally reported as following error from an HLS build:
ld: in /Users/worker/actions-runner/_work/haskell-language-server/haskell-language-server/store/aarch64-apple-darwin/ghc-9.6.1/crypthsh-md5-0.11.101.0-60f14376/lib/libHScrypthsh-md5-0.11.101.0-60f14376.a(FFI.o), archive member 'FFI.o' with length 19728 is not mach-o or llvm bitcode file '/Users/worker/actions-runner/_work/haskell-language-server/haskell-language-server/store/aarch64-apple-darwin/ghc-9.6.1/crypthsh-md5-0.11.101.0-60f14376/lib/libHScrypthsh-md5-0.11.101.0-60f14376.a' for architecture arm64
See also Note [Object merging]
.