Skip to content

Dynamically built GHC crashes on MacOS

Since 79d5427e (which add support for dynamically linking GHC), the default ./hadrian/build.sh is broken for MacOS. In particular, the ghc built always crashes with a "Symbol not found" error. Example:

$ ./hadrian/build.sh -j -c 
# << fails shortly after building first ghc >>
$ _build/stage1/bin/ghc
dyld: Symbol not found: _ffi_type_double
  Referenced from: _build/stage1/lib/../lib/x86_64-osx-ghc-8.7.20181202/libHSghci-8.7-ghc8.7.20181202.dylib
  Expected in: flat namespace
 in _build/stage1/lib/../lib/x86_64-osx-ghc-8.7.20181202/libHSghci-8.7-ghc8.7.20181202.dylib
[1]    52701 abort      _build/stage1/bin/ghc

See https://phabricator.haskell.org/rGHC79d5427e1f9de02c0b171bf5db46b6b49c6f85e3 for more discussion. The core of the issue seems to be that -Wl,-dead_strip_dylibs accidentally strips some essential libraries (libffi is one of these).

Trac metadata
Trac field Value
Version 8.7
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Build System (Hadrian)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information