building against gmp in a nonstandard location

Paul Jarc prj at
Sun Mar 16 00:05:03 EDT 2008

I'm having some trouble building ghc against gmp installed in an
unusual place.  (Actually, I install every package in its own
directory, but gmp seems to be the one causing trouble here.)  First
attempt: adding the necessary -I, -L, and -Xlinker -R options to
CPPFLAGS/LDFLAGS when invoking ./configure, and I also created
mk/ to add the -I flags to SRC_CC_OPTS and SRC_HSC2HS_OPTS,
and -optc-I, -optl-L, and -optl-Xlinker -optl-R flags to SRC_HC_OPTS.
This method worked for ghc 6.6.1, but 6.8.2 gives me:

/command/ghc -H16m -O -O2 -optc-I/nil -optc-I/package/host/ -optc-I/package/host/ -optc-I/package/host/ -optc-I/package/host/ -optc-pipe -optl-pipe -optc-Os -optl-Os '-optc-march=pentium3' '-optl-march=pentium3' '-optc-mfpmath=sse' '-optl-mfpmath=sse' -optc-msse -optl-msse -optc-mmmx -optl-mmmx -optl-L/nil -optl-L/package/host/ -optl-L/package/host/ -optl-L/package/host/ -optl-L/package/host/ -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/ -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/ -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/ -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/  -istage1/utils  -istage1/basicTypes  -istage1/types  -istage1/hsSyn  -istage1/prelude  -istage1/rename  -istage1/typecheck  -istage1/deSugar  -istage1/coreSyn  -istage1/vectorise  -istage1/specialise  -istage1/simplCore  -istage1/stranal  -istage1/stgSyn  -istage1/simplStg  -istage1/codeGen  -istage1/main  -istage1/profiling  -istage1/parser  -istage1/cprAnalysis  -istage1/ndpFlatten  -istage1/iface  -istage1/cmm  -istage1/nativeGen -Wall -fno-warn-name-shadowing -fno-warn-orphans -Istage1 -cpp -fglasgow-exts -fno-generics -Rghc-timing -I. -Iparser -package unix -ignore-package lang -recomp -Rghc-timing  -H16M '-#include "cutils.h"' -DUSING_COMPAT -i../compat -ignore-package Cabal -package directory -package pretty -package containers    -c stranal/StrictAnal.lhs -o stage1/stranal/StrictAnal.o  -ohi stage1/stranal/StrictAnal.hi
<<ghc: 34287668 bytes, 7 GCs, 122880/180224 avg/max bytes residency (2 samples), 19M in use, 0.02 INIT (0.00 elapsed), 0.20 MUT (0.33 elapsed), 0.10 GC (0.10 elapsed) :ghc>>
make[1]: *** No rule to make target `stage1//package/host/', needed by `stage1/parser/cutils.o'.  Stop.

Second attempt: CPPFLAGS, LDFLAGS and mk/ as above, and I also
gave --with-gmp-{includes,libraries} to ./configure.  This ends with
the same error.

Third attempt: all of the above, plus I modified mkdependC.prl to omit
dependencies on absolute paths.  (I suspect this is wrong, since I
assume other people have successfully used gmp in a nonstandard path
without having to patch anything, but anyway...)  New failure:

../../compiler/stage1/ghc-inplace -Iinclude -package rts-1.0 -optc-O2 -odir dist/build -c cbits/longlong.c -o dist/build/cbits/longlong.o
In file included from /fs/pkgs/mount/package/host/,
                 from /fs/pkgs/mount/package/host/,
                 from cbits/longlong.c:29:0: 
     error: gmp.h: No such file or directory

I would have thought the SRC_HC_OPTS options I put in mk/
would be used for this compilation, but apparently not.  Does anyone
see where the problem might be?


More information about the Glasgow-haskell-users mailing list