building against gmp in a nonstandard location
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/build.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/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/include -optc-I/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/ncurses/include -optc-I/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/readline/include -optc-I/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/binutils/include -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/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/library -optl-L/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/ncurses/library -optl-L/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/readline/library -optl-L/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/binutils/library -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/library -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/ncurses/library -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/readline/library -optl-Xlinker -optl-R -optl-Xlinker -optl/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/binutils/library -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
<
Hi Paul, On Sun, Mar 16, 2008 at 12:05:03AM -0400, Paul Jarc wrote:
make[1]: *** No rule to make target `stage1//package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/include/gmp.h', needed by `stage1/parser/cutils.o'. Stop.
Where is gmp.h actually installed? Do you know where this dependency is coming from? Is it compiler/.depend-1? If so, try looking at the mkdependC commandline and see if that provides any clues.
Second attempt: CPPFLAGS, LDFLAGS and mk/build.mk as above, and I also gave --with-gmp-{includes,libraries} to ./configure. This ends with the same error.
What happens if you only use the flags?
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/code.dogmap.org/foreign/ghc-6.8.2+spf+0/compile/src/ghc-6.8.2/includes/Stg.h:150, from /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/compile/src/ghc-6.8.2/includes/Rts.h:19, from cbits/longlong.c:29:0: /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/compile/src/ghc-6.8.2/includes/Regs.h:28:17: error: gmp.h: No such file or directory
I would have thought the SRC_HC_OPTS options I put in mk/build.mk would be used for this compilation, but apparently not. Does anyone see where the problem might be?
This is compiling a C file, so it uses SRC_CC_OPTS instead. Thanks Ian
Ian Lynagh
On Sun, Mar 16, 2008 at 12:05:03AM -0400, Paul Jarc wrote:
make[1]: *** No rule to make target `stage1//package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/include/gmp.h', needed by `stage1/parser/cutils.o'. Stop.
Where is gmp.h actually installed?
/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+0/conf/gmp/include/gmp.h
Do you know where this dependency is coming from? Is it compiler/.depend-1?
Yes, and .depend-BASE before that. The only difference in .depend-1 is that "stage1/" is prepended. compiler/parser/cutils.c includes includes/Rts.h, which includes gmp.h. So mkdependC puts that information in .depend-BASE. I'm sure it doesn't belong there, since gmp.h isn't part of the GHC source tree, and I guess if it works for other people, then it must not be there for them (can anyone confirm that?), but I don't see how it gets filtered out for them.
Second attempt: CPPFLAGS, LDFLAGS and mk/build.mk as above, and I also gave --with-gmp-{includes,libraries} to ./configure. This ends with the same error.
What happens if you only use the flags?
Do you mean CPPFLAGS and LDFLAGS, without putting anything in mk/build.mk or specifying --with-gmp-*? That fails here: Creating ghcplatform.h... Done. ../utils/mkdependC/mkdependC -f .depend -- -O -DTABLES_NEXT_TO_CODE -I. -I../rts -- mkDerivedConstants.c gcc -O -DTABLES_NEXT_TO_CODE -I. -I../rts -c mkDerivedConstants.c -o mkDerivedConstants.o In file included from Stg.h:150, from Rts.h:19, from mkDerivedConstants.c:23: Regs.h:28:17: error: gmp.h: No such file or directory In file included from Stg.h:150, from Rts.h:19, from mkDerivedConstants.c:23: Regs.h:121: error: expected specifier-qualifier-list before 'MP_INT' In file included from mkDerivedConstants.c:23: Rts.h:203: error: expected ')' before '*' token Rts.h:204: error: expected ')' before '*' token mkDerivedConstants.c: In function 'main': mkDerivedConstants.c:218: error: 'StgRegTable' has no member named 'rRet' mkDerivedConstants.c:218: error: 'StgRegTable' has no member named 'rRet' mkDerivedConstants.c:222: error: 'StgRegTable' has no member named 'rmp_tmp1' mkDerivedConstants.c:223: error: 'StgRegTable' has no member named 'rmp_tmp2' mkDerivedConstants.c:224: error: 'StgRegTable' has no member named 'rmp_result1' mkDerivedConstants.c:225: error: 'StgRegTable' has no member named 'rmp_result2' mkDerivedConstants.c:417: error: 'MP_INT' undeclared (first use in this function) mkDerivedConstants.c:417: error: (Each undeclared identifier is reported only once mkDerivedConstants.c:417: error: for each function it appears in.) mkDerivedConstants.c:418: error: expected expression before ')' token mkDerivedConstants.c:418: error: expected expression before ')' token mkDerivedConstants.c:419: error: expected expression before ')' token mkDerivedConstants.c:419: error: expected expression before ')' token mkDerivedConstants.c:420: error: expected expression before ')' token mkDerivedConstants.c:420: error: expected expression before ')' token mkDerivedConstants.c:422: error: 'mp_limb_t' undeclared (first use in this function) make[1]: *** [mkDerivedConstants.o] Error 1 make: *** [stage1] Error 1
This is compiling a C file, so it uses SRC_CC_OPTS instead.
Actually, it would be GHC_CC_OPTS, since it's ghc compiling a C file, right? I tried adding the -optc-I flags, etc., to GHC_CC_OPTS in mk/build.mk, and it gets farther now, but still fails: Configuring hpc-0.5.0.0... rm -f hpc/GNUmakefile cp Makefile.local hpc if ifBuildable/ifBuildable hpc; then \ cd hpc && setup/Setup makefile -f GNUmakefile; \ fi In file included from /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Stg.h:150, from /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Rts.h:19, from Reflect.hsc:18: /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Regs.h:28:17: error: gmp.h: No such file or directory This seems to be coming from an invocation of hsc2hs for dependency generation. I don't know how to add extra options to that invocation, since it isn't directly in any of the Makefiles. But if it works for everyone else, I shouldn't need to, either... paul
On Thu, Mar 20, 2008 at 01:29:26PM -0400, Paul Jarc wrote:
Ian Lynagh
wrote: On Sun, Mar 16, 2008 at 12:05:03AM -0400, Paul Jarc wrote:
Second attempt: CPPFLAGS, LDFLAGS and mk/build.mk as above, and I also gave --with-gmp-{includes,libraries} to ./configure. This ends with the same error.
What happens if you only use the flags?
Do you mean CPPFLAGS and LDFLAGS, without putting anything in mk/build.mk or specifying --with-gmp-*? That fails here:
Sorry, I meant --with-gmp-{includes,libraries}.
if ifBuildable/ifBuildable hpc; then \ cd hpc && setup/Setup makefile -f GNUmakefile; \ fi In file included from /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Stg.h:150, from /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Rts.h:19, from Reflect.hsc:18: /fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2+spf+3/compile/src/ghc-6.8.2/includes/Regs.h:28:17: error: gmp.h: No such file or directory
This seems to be coming from an invocation of hsc2hs
I think this is something we fixed in the 6.8 darcs branch since releasing 6.8.2. Try building a recent 6.8 branch snapshot instead: http://www.haskell.org/ghc/dist/stable/dist/ Thanks Ian
Ian Lynagh
Sorry, I meant --with-gmp-{includes,libraries}.
Ah, ok. --with-gmp-* alone, without setting environment variables, creating mk/build.mk, or anything else, gives the same error as --with-gmp-* plus environment variables ("No rule to make target `stage1//.../gmp.h', needed by `stage1/parser/cutils.o'.") Trying 6.8.2.20080317, using --with-ghc-*, setting environment variables, creating mk/build.mk, and hacking mkdependC.prl to omit dependencies on absolute paths, I get past the gmp problems, only to run into a similar problem with readline. I've put the appropriate flags for readline in $CPPFLAGS/$LDFLAGS and mk/build.mk, and the build ends with: Configuring readline-1.0.1.0... if ifBuildable/ifBuildable readline; then \ cd readline && \ cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \ mv GNUmakefile GNUmakefile.tmp; \ setup/Setup makefile -f GNUmakefile; \ cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \ make -wr && \ setup/Setup register --inplace; \ fi mv: cannot stat `GNUmakefile': No such file or directory In file included from Readline.hsc:36: include/HsReadline.h:10:31: error: readline/readline.h: No such file or directory include/HsReadline.h:11:30: error: readline/history.h: No such file or directory Readline.hsc: In function 'main': Readline.hsc:614: error: 'ISFUNC' undeclared (first use in this function) Readline.hsc:614: error: (Each undeclared identifier is reported only once Readline.hsc:614: error: for each function it appears in.) Readline.hsc:616: error: 'ISMACR' undeclared (first use in this function) Readline.hsc:618: error: 'ISKMAP' undeclared (first use in this function) Readline.hsc:723: error: 'UNDO_DELETE' undeclared (first use in this function) Readline.hsc:724: error: 'UNDO_INSERT' undeclared (first use in this function) Readline.hsc:725: error: 'UNDO_BEGIN' undeclared (first use in this function) Readline.hsc:726: error: 'UNDO_END' undeclared (first use in this function) Readline.hsc:1089: error: 'MULT_MATCH' undeclared (first use in this function) Readline.hsc:1112: error: 'SINGLE_MATCH' undeclared (first use in this function) compiling dist/build/System/Console/Readline_hsc_make.c failed command was: gcc -c -D__GLASGOW_HASKELL__=608 -I/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/includes -I/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/gmp/gmpbuild -I/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/conf/gmp/include -D__GLASGOW_HASKELL__=608 -Iinclude dist/build/System/Console/Readline_hsc_make.c -o dist/build/System/Console/Readline_hsc_make.o Preprocessing library readline-1.0.1.0... make[2]: Entering directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries/readline' make[2]: *** No targets specified and no makefile found. Stop. make[2]: Leaving directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries/readline' make[1]: *** [make.library.readline] Error 2 make[1]: Leaving directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries' make: *** [stage1] Error 2 So next, I tried also passing --with-readline-{includes,libraries} to the toplevel ./configure. As I hoped, those arguments were relayed to the configure script for readline, but that still isn't enough: Configuring readline-1.0.1.0... if ifBuildable/ifBuildable readline; then \ cd readline && \ cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \ mv GNUmakefile GNUmakefile.tmp; \ setup/Setup makefile -f GNUmakefile; \ cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \ make -wr && \ setup/Setup register --inplace; \ fi mv: cannot stat `GNUmakefile': No such file or directory /package/host/code.dogmap.org/foreign/gcc-4.2.3+spf+0/conf/binutils/command/ld: cannot find -lncurses collect2: ld returned 1 exit status linking dist/build/System/Console/Readline_hsc_make.o failed command was: gcc -lreadline -lncurses -L/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/conf/readline/library dist/build/System/Console/Readline_hsc_make.o -o dist/build/System/Console/Readline_hsc_make Preprocessing library readline-1.0.1.0... make[2]: Entering directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries/readline' make[2]: *** No targets specified and no makefile found. Stop. make[2]: Leaving directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries/readline' make[1]: *** [make.library.readline] Error 2 make[1]: Leaving directory `/fs/pkgs/mount/package/host/code.dogmap.org/foreign/ghc-6.8.2.20080317+spf+0/compile/src/ghc-6.8.2.20080317/libraries' make: *** [stage1] Error 2 There are no --with-* flags for ncurses, so the only ways I can see to say where ncurses is are the ones I'm already using, and which are apparently insufficient - $CPPFLAGS/$LDFLAGS in the environment, and SRC_HC_OPTS/SRC_HSC2HC_OPTS/SRC_CC_OPTS/GHC_CC_OPTS in mk/build.mk. paul
On Fri, Mar 21, 2008 at 01:44:37AM -0400, Paul Jarc wrote:
There are no --with-* flags for ncurses, so the only ways I can see to say where ncurses is are the ones I'm already using, and which are apparently insufficient - $CPPFLAGS/$LDFLAGS in the environment, and SRC_HC_OPTS/SRC_HSC2HC_OPTS/SRC_CC_OPTS/GHC_CC_OPTS in mk/build.mk.
I think the right thing to do is to add --with-* flags for (n)curses/termcap; the alternative would be to put the whole of $LDFLAGS into the Cabal buildinfo, but that feels wrong to me. We should probably also be undefining variables like LDFLAGS in configure, as the autoconf macros will be using them to check if libraries exist, but we don't use them when compiling. Thanks Ian
On Sun, Mar 30, 2008 at 03:37:35PM -0400, Paul Jarc wrote:
Ian Lynagh
wrote: the alternative would be to put the whole of $LDFLAGS into the Cabal buildinfo, but that feels wrong to me.
Why so? By setting LDFLAGS, isn't the user asking for exactly that - that those flags be used when linking?
Perhaps, but readline is only 1 component of what is being built. I guess it would be unlikely to do any harm to use linker flags intended for another component, though. If we want to go this route then I think Cabal should pick up $LDFLAGS automatically when building packages, though. Thanks Ian
participants (2)
-
Ian Lynagh -
prj@po.cwru.edu