Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GHC anything results in "ld: library not found for -lgmp"

I'm trying to compile haskell programs on my mac running OS X 10.10 Yosemite, but ghc fails every time with ld: library not found for -lgmp:

$ ghc foo.hs
[1 of 1] Compiling Main             ( foo.hs, foo.o )
Linking foo ...
ld: library not found for -lgmp
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Help?

like image 339
bschlueter Avatar asked Nov 13 '14 01:11

bschlueter


3 Answers

The missing thing on my system was up to date command line tools from xcode. Installing the most recent version with xcode-select --install fixed the problem.

like image 140
bschlueter Avatar answered Oct 14 '22 22:10

bschlueter


I did brew uninstall ghc && brew install ghc and it fixed it (on Yosemite).

like image 38
charlax Avatar answered Oct 14 '22 23:10

charlax


This worked for me on OSX (10.15) Catalina:

brew install pkg-config hidapi libev gmp
like image 1
Excel Avatar answered Oct 14 '22 23:10

Excel