Skip to content

GHC 8.6 for macOS depends on homebrew

I guess the ghc-8.6.1-x86_64-apple-darwin.tar.xz is build with homebrew. So, it depends on homebrew's "libgmp".

Since I'm using MacPorts, the following error occurs on installation:

% sudo make install

"utils/ghc-cabal/dist-install/build/tmp/ghc-cabal-bindist" copy libraries/ghc-prim dist-install "strip" '' '/usr/local/ghc-8.6.1' '/usr/local/ghc-8.6.1/lib/ghc-8.6.1' '/usr/local/ghc-8.6.1/share/doc/ghc-8.6.1/html/libraries' 'v p dyn'  
dyld: Library not loaded: /usr/local/opt/gmp/lib/libgmp.10.dylib
  Referenced from: /Users/kazu/Downloads/ghc-8.6.1/libraries/base/dist-install/build/libHSbase-4.12.0.0-ghc8.6.1.dylib
  Reason: image not found
make[1]: *** [install_packages] Abort trap: 6
make: *** [install] Error 2

After make a link from "/usr/local/opt/gmp/lib/libgmp.10.dylib" to "/opt/local/lib/libgmp.10.dylib" installed by MacPorts, the installation succeeds.

But when using GHC 8.6.1, the following error occurs:

[15 of 15] Compiling Network.DNS      ( Network/DNS.hs, dist/build/Network/DNS.o )
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)
`gcc' failed in phase `Linker'. (Exit code: 1)
cab: callCommand: cabal build (exit 1): failed

To fix this, the following is necessary:

% export LIBRARY_PATH=/usr/lib:/opt/local/lib
  • "/usr/lib" is for "libiconv" and should come first to hide "/opt/local/lib/libiconv"
  • "/opt/local/lib" is for "libgmp"
Trac metadata
Trac field Value
Version 8.6.1
Type Bug
TypeOfFailure OtherFailure
Priority highest
Resolution Unresolved
Component Compiler
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