Skip to content

No way to use -lgmp from a non-standard location

When building ghc-6.6 from source on FreeBSD 6, I get this error:

== gmake all - --no-print-directory -r;
 in /usr/home/tim/local/src/ghc-6.6/libraries/Cabal/cabal-setup
------------------------------------------------------------------------
../../../compiler/ghc-inplace -o cabal-setup -H16m -O -package Cabal       CabalSetup.o
/usr/bin/ld: cannot find -lgmp
gmake[3]: *** [cabal-setup] Error 1
gmake[2]: *** [all] Error 1
gmake[1]: *** [all] Error 1
gmake[1]: Leaving directory `/usr/home/tim/local/src/ghc-6.6/libraries'
gmake: *** [stage1] Error 2
1:12 ~/local/src/ghc-6.6$ cd libraries/Cabal/cabal-setup
2:01 ~/local/src/ghc-6.6/libraries/Cabal/cabal-setup$ ../../../compiler/ghc-inplace -o cabal-setup -H16m -O -package Cabal CabalSetup.o -L/usr/local/lib
2:02 ~/local/src/ghc-6.6/libraries/Cabal/cabal-setup$ cd -
~/local/src/ghc-6.6
2:02 ~/local/src/ghc-6.6$ gmake
gmake -C utils/mkdependC boot
gmake[1]: Entering directory `/usr/home/tim/local/src/ghc-6.6/utils/mkdependC'
gmake[1]: Leaving directory `/usr/home/tim/local/src/ghc-6.6/utils/mkdependC'

I configured with:

export CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
./configure --prefix=$HOME/local

My system has /usr/local/lib/libgmp.so; /usr/local/lib is, on FreeBSD, traditionally not in the default search path. It must be specified explicitly to the linker.

Once I compiled cabal-setup by hand, adding -L/usr/local/lib (as shown above), the rest of the build completed normally.

I'm reporting this against ghc 6.6, but I noticed it on 6.4.2 as well.

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