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

3

14

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?

Diaphragm answered 13/11, 2014 at 1:43 Comment(5)
Use this ghcformacosx.github.ioHolcman
@Holcman Do you mean that you used this for that tool? If so, that's great, glad I could help. If you're promoting it, that's cool too. Though I didn't specifically mention it, if I recall correctly (and how I prefer to install software on macs) I had installed ghc with brew.Diaphragm
I mean, when I used the homebrew version of ghc, it got this error. But things get right when I switch to the possible official one in that link.Holcman
Cool. It doesn't feel official to me, although its site is really well done. If I get confirmation of officialness, I'll add that to my answer below. As is, I stand by my point that I don't like to install random programs via their own distribution systems and would prefer to use packages from homebrew.Diaphragm
Yeah, you decide what is right. Do you remember when ghc7.8.4 released, there was no ghc7.8.4 but only ghc7.8.3 on that site? It took long before the confirmation of that update. So I guess it is possible official. You can ask ghc-devs mailing list. Whatever, you decide. I just solved this issue with that ghc.Holcman
D
33

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.

Diaphragm answered 13/11, 2014 at 1:43 Comment(1)
Fixes perfectly (after upgrading to El Captain). Thanks again!Victor
A
3

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

Ardatharde answered 20/11, 2014 at 6:42 Comment(0)
P
1

This worked for me on OSX (10.15) Catalina:

brew install pkg-config hidapi libev gmp
Premeditate answered 19/7, 2021 at 20:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.