
I ran into some problems due to having gmp installed in an unusual place. I passed --with-gmp-{includes,libraries} to ./configure, set $CPPFLAGS and $LDFLAGS for ./configure, and set the corresponding -optl, etc., flags in SRC_HC_OPTS and GHC_CC_OPTS in mk/build.mk. With all that, the first problem I hit was with utils/pwd/pwd. ./configure builds it by calling ghc without any special flags, so the binary can't find libgmp.so at runtime. I got past this by editing ./configure to add the necessary flags to the build command, but I wonder if turning pwd into a C program would be less troublesome. The next problem was with cabal-bin. The command to build it didn't use SRC_HC_OPTS, so the binary couldn't find libgmp.so. I used this patch: --- libraries/Makefile~ 2008-09-21 13:06:31.000000000 -0400 +++ libraries/Makefile 2008-09-23 01:58:29.000000000 -0400 @@ -131,7 +131,7 @@ cabal-bin: cabal-bin.hs -mkdir bootstrapping - $(GHC) $(BOOTSTRAPPING_FLAGS) --make cabal-bin -o cabal-bin + $(GHC) $(BOOTSTRAPPING_FLAGS) $(SRC_HC_OPTS) --make cabal-bin -o cabal-bin bootstrapping.conf: cabal-bin echo "[]" > $@.tmp @@ -154,9 +154,9 @@ mkdir ifBuildable $(CP) ifBuildable.hs ifBuildable/ ifeq "$(stage)" "2" - cd ifBuildable && ../$(HC) -Wall --make ifBuildable -o ifBuildable + cd ifBuildable && ../$(HC) -Wall $(SRC_HC_OPTS) --make ifBuildable -o ifBuildable else - cd ifBuildable && $(GHC) -Wall --make ifBuildable -o ifBuildable + cd ifBuildable && $(GHC) -Wall $(SRC_HC_OPTS) --make ifBuildable -o ifBuildable endif .PHONY: all build configure That gets me to this point: Preprocessing library hpc-0.5.0.2... dist-bootstrapping/build/Trace/Hpc/Reflect_hsc_make: error while loading shared libraries: libgmp.so.3: cannot open shared object file: No such file or directory running dist-bootstrapping/build/Trace/Hpc/Reflect_hsc_make failed command was: dist-bootstrapping/build/Trace/Hpc/Reflect_hsc_make >dist-bootstrapping/build/Trace/Hpc/Reflect.hs make[1]: *** [bootstrapping.conf] Error 1 make[1]: Leaving directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.10.0.20080921+spf+0/compile/src/ghc-6.10.0.20080921/libraries' make: *** [stage1] Error 2 I'm not sure how to fix this. I assume there's some way to pass SRC_HC_OPTS via cabal-bin, but I don't know how. paul