[commit: ghc] master: Tidy up cross-compiling (109a1e5)

Stephen Paul Weber singpolyma at singpolyma.net
Sat Jan 19 01:44:28 CET 2013

Somebody claiming to be Simon Marlow wrote:
>On 17/01/13 14:08, Simon Marlow wrote:
>Ok, new wiki page is here:

This is my report on using these instructions to build for 

TL;DR: Needs one GHC patch and one base patch, has to use integer-simple, 
and make install still does not work.  Otherwise works fine.

Needs the patch to add QNX as a supported OS (first patch from 
<http://www.haskell.org/pipermail/cvs-ghc/2012-December/079078.html>) to 
even try to configure, which is expected.  After applying that patch:

./configure --target=i486-pc-nto-qnx8.0.0 --prefix="${QNX_HOST}/usr"

succeeds.  Copied build.mk.sample to build.mk and added:

Stage1Only = YES

as instructed.  Uncommented the "quick" build type.  Type "make" and get:

$ make
+ test -f mk/config.mk.old
+ cp -p mk/config.mk mk/config.mk.old
touch -r mk/config.mk.old mk/config.mk
+ test -f mk/project.mk.old
+ cp -p mk/project.mk mk/project.mk.old
touch -r mk/project.mk.old mk/project.mk
+ test -f compiler/ghc.cabal.old
+ cp -p compiler/ghc.cabal compiler/ghc.cabal.old
touch -r compiler/ghc.cabal.old compiler/ghc.cabal
===--- building phase 0
make -r --no-print-directory -f ghc.mk phase=0 phase_0_builds
libraries/hpc/ghc.mk:3: libraries/hpc/dist-boot/package-data.mk: No such file or directory
libraries/Cabal/Cabal/ghc.mk:3: libraries/Cabal/Cabal/dist-boot/package-data.mk: No such file or directory
libraries/binary/ghc.mk:3: libraries/binary/dist-boot/package-data.mk: No such file or directory
libraries/bin-package-db/ghc.mk:3: libraries/bin-package-db/dist-boot/package-data.mk: No such file or directory
libraries/hoopl/ghc.mk:3: libraries/hoopl/dist-boot/package-data.mk: No such file or directory
libraries/transformers/ghc.mk:3: libraries/transformers/dist-boot/package-data.mk: No such file or directory
compiler/ghc.mk:439: compiler/stage1/package-data.mk: No such file or directory
utils/hsc2hs/ghc.mk:15: utils/hsc2hs/dist/package-data.mk: No such file or directory
ghc/ghc.mk:109: ghc/stage1/package-data.mk: No such file or directory
libraries/dph/ghc.mk:123: *** dph_th_deps(v): libraries/dph/dph-base_dist-install_GHCI_LIB not defined!.  Stop.
make: *** [all] Error 2

So, I have commented out the dph libraries from ./packages
I think this is still expected behaviour.  Should something about this 
possibility be added to the wiki page?

The next thing to happen is I run into 
<http://hackage.haskell.org/trac/ghc/ticket/7519>, so I apply the patch from 
there and continue.

building integer-gmp fails with:

cd libraries/integer-gmp/gmp; (set -o igncr 2>/dev/null) && set -o igncr; 
export SHELLOPTS; \
	    PATH=`pwd`:$PATH; \
	    export PATH; \
	    cd gmpbuild && \
AR=/usr/bin/ar /bin/sh configure \
		  --enable-shared=no \
		  --host=i386-unknown-linux --build=i386-unknown-linux
checking build system type... i386-unknown-linux-gnu
checking host system type... i386-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking ABI=32
checking whether 
is gcc... yes
checking compiler 
-m32 -O2 -pedantic -fomit-frame-pointer ... no, program does not run
checking compiler 
-O2 -pedantic -fomit-frame-pointer ... no, program does not run
configure: error: could not find a working compiler, see config.log for 
make[1]: *** [libraries/integer-gmp/gmp/gmp.h] Error 1
make: *** [all] Error 2

I'm not sure why it does not get the target right, but I can work around 
this by adding the following to build.mk:


So I do this and continue, which leads me to:

make[1]: *** No rule to make target `libraries/integer-gmp/dist-install/build/GHC/Integer.hi', needed by `libraries/base/dist-install/build/GHC/Base.o'.  Stop.
make: *** [all] Error 2

Oh, it didn't switch.  Hmm.

cd libraries/base && make clean && cd -

Then I get:

     Bad interface file: /home/singpolyma/src/ghc-qnx-nto-i486/libraries/integer-simple/dist-install/build/GHC/Integer.hi
         Something is amiss; requested module  integer-simple- differs from name found in the interface file integer-simple:GHC.Integer
make[1]: *** [libraries/base/dist-install/build/GHC/Base.o] Error 1
make: *** [all] Error 2

Okay, fine:

make clean

I didn't want to do that, because of how long this all takes, but I have 
done it.  So I continue... and get the same thing again.

cd libraries/integer-simple && make clean && cd -

Same thing.  What?  I delete my entire GHC source repo and copy from a 
pristine copy.  Apply the two patches and two additions to mk/build.mk from 
above.  Comment out dph stuff from ./packages.  Ok, trying again.  Ah!  
Good!  Now I get <http://hackage.haskell.org/trac/ghc/ticket/7490>, which is 
expected.  So I just type make again to continue.

Success!  I type `make install` which results in:

Installing library in
"/home/singpolyma/bbndk/host_10_0_9_404/linux/x86/usr/lib/ghc-7.7.20130118/bin/ghc-pkg" --force --global-package-db "/home/singpolyma/bbndk/host_10_0_9_404/linux/x86/usr/lib/ghc-7.7.20130118/package.conf.d" update rts/package.conf.install
/bin/sh: 1: /home/singpolyma/bbndk/host_10_0_9_404/linux/x86/usr/lib/ghc-7.7.20130118/bin/ghc-pkg: not found
make[1]: *** [install_packages] Error 127
make: *** [install] Error 2

Which I have reported before.

So, there it is.  I will try with arm-unknown-nto-qnx8.0.0 (uses LLVM) next.

Stephen Paul Weber, @singpolyma
See <http://singpolyma.net> for how I prefer to be contacted
edition right joseph

More information about the ghc-devs mailing list