trouble compiling 6.8.3 using 6.8.3
Hi Guys, I'm trying to rebuild ghc 6.8.3 (the previous version was built without readline linked in), and I'm running into a compilation issue. build error: /lusr/bin/ghc -#include cutils.h -DSTAGE=1 -package-name ghc-6.10.1 -hide-all-packages -no-user-package-conf -package-conf /v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/bootstrapping.conf -i -idist-stage1/build -inativeGen -ibasicTypes -icmm -icodeGen -icoreSyn -icprAnalysis -ideSugar -ighci -ihsSyn -iiface -imain -iparser -iprelude -iprofiling -irename -isimplCore -isimplStg -ispecialise -istgSyn -istranal -itypecheck -itypes -iutils -ivectorise -idist-stage1/build/autogen -Idist-stage1/build/autogen -Idist-stage1/build -Istage1 -I../libraries/base/cbits -I../libraries/base/include -I. -Iparser -Iutils -optP-include -optPdist-stage1/build/autogen/cabal_macros.h -odir dist-stage1/build -hidir dist-stage1/build -stubdir dist-stage1/build -package Cabal-1.6.0.1 -package array-0.1.0.0 -package base-3.0.2.0 -package bytestring-0.9.0.1.1 -package containers-0.1.0.2 -package directory-1.0.0.1 -package extensible-exceptions-0.1.0.0 -package filepath-1.1.0.1 -package haskell98-1.0.1.0 -package hpc-0.5.0.2 -package old-time-1.0.0.0 -package process-1.0.0.1 -package unix-2.3.0.1 -O -Wall -fno-warn-name-shadowing -fno-warn-orphans -XPatternSignatures -XCPP -XMagicHash -XUnboxedTuples -XPatternGuards -XForeignFunctionInterface -XEmptyDataDecls -XTypeSynonymInstances -XMultiParamTypeClasses -XFlexibleInstances -XRank2Types -XScopedTypeVariables -XDeriveDataTypeable -idist-stage1/build -H32m -O -Rghc-timing -c types/Unify.lhs -o dist-stage1/build/Unify.o -ohi dist-stage1/build/Unify.hi parser/Lexer.x:1652:17: Not in scope: data constructor `SLIT' parser/Lexer.x:1653:23: Not in scope: data constructor `SLIT' <<ghc: 351226848 bytes, 20 GCs, 3982677/8409088 avg/max bytes residency (3 samples), 36M in use, 0.00 INIT (0.00 elapsed), 0.32 MUT (0.37 elapsed), 0.12 GC (0.13 elapsed) :ghc>> make[2]: *** [dist-stage1/build/Lexer.o] Error 1 make[2]: *** Waiting for unfinished jobs.... <<ghc: 236588812 bytes, 17 GCs, 4490581/8404992 avg/max bytes residency (3 samples), 36M in use, 0.00 INIT (0.00 elapsed), 0.49 MUT (0.57 elapsed), 0.15 GC (0.15 elapsed) :ghc>> make[1]: *** [build.stage.1] Error 2 make: *** [stage1] Error 1 I've hit up google and the only results which stood out were other "data constructor not in scope" messages which were due to people trying to run old haskell code using newer versions of the compiler, but I doubt that's the case here as I am using the same version of the compiler as both host and target. Any ideas? -jason
Jason Pepas wrote:
Jason Pepas wrote:
/lusr/bin/ghc -#include cutils.h -DSTAGE=1 -package-name ghc-6.10.1
Um, scratch that. I've apparently become confused as to which release I was actually building.
-jason
So I've run into a (legitimate) issue with building 6.8.3. Initiall I was getting things like this: build error: ../compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-I../includes -optc-I. -optc-Iparallel -optc-Ism -optc-DCOMPILING_RTS -optc-g -optc-O0 -optc-I../gmp/gmpbuild -optc-fno-strict-aliasing -H16m -O -package-name rts -static -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint -hisuf debug_hi -hcsuf debug_hc -osuf debug_o -optc-DDEBUG -c ProfHeap.c -o ProfHeap.debug_o Printer.c:962:17: error: bfd.h: No such file or directory this was being caused by not being able to find binutils-related headers. similar errors occured after not being able to find readline headers. (these were in a non-standard location). I got around this by exporting some env vars: export CPPFLAGS="-I/lusr/gnu/include -I/lusr/include" export LDFLAGS="-L/lusr/lib -L/lusr/gnu/lib" however, that still didn't solve the problem, and eventually I resorted to "grafting" (copying via symlinks) the include files into the build-dir/includes directory. that worked until I ran into this: checking for readline in -lreadline... yes checking for rl_readline_version... yes checking for rl_begin_undo_group... yes checking for rl_erase_empty_line... yes checking for rl_free_undo_list... yes checking for rl_completion_word_break_hook in -lreadline... yes configure: creating ./config.status config.status: creating readline.buildinfo config.status: creating include/HsReadlineConfig.h 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 --jobserver-fds=3,4 -j && \ setup/Setup register --inplace; \ fi mv: cannot stat `GNUmakefile': No such file or directory Preprocessing library readline-1.0.1.0... /lusr/gnu/bin/ld: cannot find -lreadline collect2: ld returned 1 exit status linking dist/build/System/Console/Readline_hsc_make.o failed command was: gcc -lreadline -lncurses dist/build/System/Console/Readline_hsc_make.o -o dist/build/System/Console/Readline_hsc_make make[2]: Entering directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[2]: *** No targets specified and no makefile found. Stop. make[2]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[1]: *** [make.library.readline] Error 2 make[1]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries' make: *** [stage1] Error 2 specifically, what is failing is the "setup/Setup makefile -f GNUmakefile" command. bash-3.2$ setup/Setup makefile -f GNUmakefile Preprocessing library readline-1.0.1.0... /lusr/gnu/bin/ld: cannot find -lreadline collect2: ld returned 1 exit status linking dist/build/System/Console/Readline_hsc_make.o failed command was: gcc -lreadline -lncurses dist/build/System/Console/Readline_hsc_make.o -o dist/build/System/Console/Readline_hsc_make however, if you cd into build-dir/libraries/readline and run this manually: ./configure --with-readline-includes=/lusr/gnu/include --with-readline-libraries=/lusr/gnu/lib you can then run the "setup/Setup makefile -f GNUmakefile" and it works. so I thought I'd try simply modifying the libraries/Makefile: bash-3.2$ diff -urN libraries/Makefile.orig libraries/Makefile --- libraries/Makefile.orig 2009-04-06 14:36:44.000000000 -0500 +++ libraries/Makefile 2009-04-06 15:29:14.000000000 -0500 @@ -277,9 +277,11 @@ if ifBuildable/ifBuildable $*; then \ cd $* && \ cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \ - mv GNUmakefile GNUmakefile.tmp; \ + if [ -e GNUmakefile ] ; then mv GNUmakefile GNUmakefile.tmp ; fi ;\ + if [ "$*" = "readline" ] ; then ./configure --with-readline-includes=/lusr/gnu/include --with-readline-libraries=/lusr/gnu/lib ; fi ; \ setup/Setup makefile -f GNUmakefile; \ cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \ + echo $(MAKE) $(MFLAGS) && \ $(MAKE) $(MFLAGS) && \ setup/Setup register --inplace; \ fi but that doesn't work: Preprocessing library readline-1.0.1.0... Generating Makefile readline-1.0.1.0... make -wr make[2]: Entering directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' Registering readline-1.0.1.0... Reading package info from "dist/inplace-pkg-config" ... done. Unable to rename "/lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf" to "/lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf.old" Saving old package config file... ghc-pkg.bin: /lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf: renameFile: permission denied (Permission denied) make[1]: *** [make.library.readline] Error 1 make[1]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries' make: *** [stage1] Error 2 At this point I think this has gotten a little too hack-ish, so I thought I'd ask the mailing list what for proper way of telling ghc where your readline installation lives? thanks, jason
Jason Pepas wrote:
Jason Pepas wrote:
Jason Pepas wrote:
/lusr/bin/ghc -#include cutils.h -DSTAGE=1 -package-name ghc-6.10.1
Um, scratch that. I've apparently become confused as to which release I was actually building.
-jason
So I've run into a (legitimate) issue with building 6.8.3.
Initiall I was getting things like this:
build error: ../compiler/ghc-inplace -optc-O -optc-Wall -optc-W -optc-Wstrict-prototypes -optc-Wmissing-prototypes -optc-Wmissing-declarations -optc-Winline -optc-Waggregate-return -optc-I../includes -optc-I. -optc-Iparallel -optc-Ism -optc-DCOMPILING_RTS -optc-g -optc-O0 -optc-I../gmp/gmpbuild -optc-fno-strict-aliasing -H16m -O -package-name rts -static -I../gmp/gmpbuild -I. -#include HCIncludes.h -dcmm-lint -hisuf debug_hi -hcsuf debug_hc -osuf debug_o -optc-DDEBUG -c ProfHeap.c -o ProfHeap.debug_o
Printer.c:962:17: error: bfd.h: No such file or directory
this was being caused by not being able to find binutils-related headers. similar errors occured after not being able to find readline headers. (these were in a non-standard location).
I got around this by exporting some env vars:
export CPPFLAGS="-I/lusr/gnu/include -I/lusr/include" export LDFLAGS="-L/lusr/lib -L/lusr/gnu/lib"
however, that still didn't solve the problem, and eventually I resorted to "grafting" (copying via symlinks) the include files into the build-dir/includes directory.
that worked until I ran into this:
checking for readline in -lreadline... yes checking for rl_readline_version... yes checking for rl_begin_undo_group... yes checking for rl_erase_empty_line... yes checking for rl_free_undo_list... yes checking for rl_completion_word_break_hook in -lreadline... yes configure: creating ./config.status config.status: creating readline.buildinfo config.status: creating include/HsReadlineConfig.h 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 --jobserver-fds=3,4 -j && \ setup/Setup register --inplace; \ fi mv: cannot stat `GNUmakefile': No such file or directory Preprocessing library readline-1.0.1.0... /lusr/gnu/bin/ld: cannot find -lreadline collect2: ld returned 1 exit status linking dist/build/System/Console/Readline_hsc_make.o failed command was: gcc -lreadline -lncurses dist/build/System/Console/Readline_hsc_make.o -o dist/build/System/Console/Readline_hsc_make make[2]: Entering directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[2]: *** No targets specified and no makefile found. Stop. make[2]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[1]: *** [make.library.readline] Error 2 make[1]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries' make: *** [stage1] Error 2
specifically, what is failing is the "setup/Setup makefile -f GNUmakefile" command.
bash-3.2$ setup/Setup makefile -f GNUmakefile Preprocessing library readline-1.0.1.0... /lusr/gnu/bin/ld: cannot find -lreadline collect2: ld returned 1 exit status linking dist/build/System/Console/Readline_hsc_make.o failed command was: gcc -lreadline -lncurses dist/build/System/Console/Readline_hsc_make.o -o dist/build/System/Console/Readline_hsc_make
however, if you cd into build-dir/libraries/readline and run this manually:
./configure --with-readline-includes=/lusr/gnu/include --with-readline-libraries=/lusr/gnu/lib
you can then run the "setup/Setup makefile -f GNUmakefile" and it works.
so I thought I'd try simply modifying the libraries/Makefile:
bash-3.2$ diff -urN libraries/Makefile.orig libraries/Makefile --- libraries/Makefile.orig 2009-04-06 14:36:44.000000000 -0500 +++ libraries/Makefile 2009-04-06 15:29:14.000000000 -0500 @@ -277,9 +277,11 @@ if ifBuildable/ifBuildable $*; then \ cd $* && \ cmp -s ../Makefile.local Makefile.local || cp ../Makefile.local .; \ - mv GNUmakefile GNUmakefile.tmp; \ + if [ -e GNUmakefile ] ; then mv GNUmakefile GNUmakefile.tmp ; fi ;\ + if [ "$*" = "readline" ] ; then ./configure --with-readline-includes=/lusr/gnu/include --with-readline-libraries=/lusr/gnu/lib ; fi ; \ setup/Setup makefile -f GNUmakefile; \ cmp -s GNUmakefile GNUmakefile.tmp && mv GNUmakefile.tmp GNUmakefile; \ + echo $(MAKE) $(MFLAGS) && \ $(MAKE) $(MFLAGS) && \ setup/Setup register --inplace; \ fi
but that doesn't work:
Preprocessing library readline-1.0.1.0... Generating Makefile readline-1.0.1.0... make -wr make[2]: Entering directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' make[2]: Nothing to be done for `all'. make[2]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries/readline' Registering readline-1.0.1.0... Reading package info from "dist/inplace-pkg-config" ... done. Unable to rename "/lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf" to "/lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf.old" Saving old package config file... ghc-pkg.bin: /lusr/opt/ghc-6.8.3/lib/ghc-6.8.3/package.conf: renameFile: permission denied (Permission denied) make[1]: *** [make.library.readline] Error 1 make[1]: Leaving directory `/v/filer4b/cvsbuild/CVSBUILD/ghc-6.8.3-linux-i686/ghc/libraries' make: *** [stage1] Error 2
At this point I think this has gotten a little too hack-ish, so I thought I'd ask the mailing list what for proper way of telling ghc where your readline installation lives?
I think the problem you're describing never got fixed: see http://hackage.haskell.org/trac/ghc/ticket/2970 and then we decided to replace readline with editline (bad mistake) and later decided to adopt haskeline instead. I believe some OSs (e.g. FreeBSD) that put readline outside the standard locations have their own hacks to get around this. Cheers, Simon
Simon Marlow wrote:
I think the problem you're describing never got fixed: see
http://hackage.haskell.org/trac/ghc/ticket/2970
and then we decided to replace readline with editline (bad mistake) and later decided to adopt haskeline instead. I believe some OSs (e.g. FreeBSD) that put readline outside the standard locations have their own hacks to get around this.
Cheers, Simon
thanks, I'll try either updating to the latest version or cribbing from FreeBSD. -jason
participants (2)
-
Jason Pepas -
Simon Marlow