trouble compiling 6.8.3 using 6.8.3

Jason Pepas cell at cs.utexas.edu
Mon Apr 6 16:52:18 EDT 2009


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


More information about the Glasgow-haskell-users mailing list