Cross-compiling GHC: ghc-cabal: /tmp/30869.o: does not exist

Nikita Karetnikov nikita at karetnikov.org
Sat Jun 15 00:54:25 CEST 2013


I'm trying to cross-compile GHC 7.6.3; 'make' fails with the mentioned
error.  How can I debug this issue?

I used Guix [1] to build a cross-compiler and related packages:

# ./pre-inst-env guix build -K gcc-cross-mips64el-linux-gnu

After that I downloaded GHC 7.6.3:

# wget http://www.haskell.org/ghc/dist/7.6.3/ghc-7.6.3-src.tar.bz2

Unpacked it:

# tar xf ghc-7.6.3-src.tar.bz2

# cd ghc-7.6.3/mk
# cp build.mk.sample build.mk

Uncommented 'BuildFlavour = unreg' and added 'INTEGER_LIBRARY = integer-simple'.

# cd ..
# export CROSS_LIBRARY_PATH=/nix/store/qkzhg178l4b3fpnj7ival0h6c1mfgi0l-glibc-cross-mips64el-linux-gnu-2.17/lib
# export CROSS_CPATH=/nix/store/qkzhg178l4b3fpnj7ival0h6c1mfgi0l-glibc-cross-mips64el-linux-gnu-2.17/include:/nix/store/g4ky5zb70y946pfjiq45sa5pv7qdqgha-linux-libre-headers-cross-mips64el-linux-gnu-3.3.8/include
# ./configure \
  --target=mips64el-linux-gnu \
  --with-gcc=/nix/store/lv3vxm43mmk7f5gc1myzs0aj8pi4a4g7-gcc-cross-mips64el-linux-gnu-4.7.3/bin/mips64el-linux-gnu-gcc \
  --with-ld=/nix/store/jys3nw5rg2a4lrihs7qhflxad4bwyry6-binutils-cross-mips64el-linux-gnu-2.23.2/bin/mips64el-linux-gnu-ld \
  --with-nm=/nix/store/jys3nw5rg2a4lrihs7qhflxad4bwyry6-binutils-cross-mips64el-linux-gnu-2.23.2/bin/mips64el-linux-gnu-nm

# make

[...]

CROSS_COMPILE="mips64el-unknown-linux-gnu-" "inplace/bin/ghc-cabal" configure --with-ghc="/home/GHC/ghc-7.6.3/inplace/bin/ghc-stage1" --with-ghc-pkg="/home/GHC/ghc-7.6.3/inplace/bin/ghc-pkg" --flag=include-ghc-prim --disable-library-for-ghci --configure-option=CFLAGS=" -fno-stack-protector   " --configure-option=LDFLAGS=" -Wl,--hash-size=31 -Wl,--reduce-memory-overheads  " --configure-option=CPPFLAGS="   " --with-gcc="/nix/store/lv3vxm43mmk7f5gc1myzs0aj8pi4a4g7-gcc-cross-mips64el-linux-gnu-4.7.3/bin/mips64el-linux-gnu-gcc" --configure-option=--with-cc="/nix/store/lv3vxm43mmk7f5gc1myzs0aj8pi4a4g7-gcc-cross-mips64el-linux-gnu-4.7.3/bin/mips64el-linux-gnu-gcc" --with-ar="/usr/bin/ar" --with-ranlib="true" --with-alex="/usr/bin/alex" --with-happy="/usr/bin/happy" -- dist-install libraries/ghc-prim
Configuring ghc-prim-0.3.0.0...
ghc-cabal: /tmp/30869.o: does not exist
make[1]: *** [libraries/ghc-prim/dist-install/package-data.mk] Error 1
make: *** [all] Error 2

Then I found this bug report [2] and decided to apply the mentioned
patch:

# cd ..
# git clone https://github.com/ghc/ghc.git ghc-github
# cd ghc-github
# git show f77291d60f33fe601dbe0ff94b0192c5cd4ad6b5 > ld.patch
# cd ../ghc-7.6.3
# patch -p1 < ../ghc-github/ld.patch
patching file rules/build-package-data.mk
Hunk #1 succeeded at 64 (offset -11 lines).

# make distclean
# ./configure [...]
# make

Then another error appeared:

CROSS_COMPILE="" "inplace/bin/ghc-cabal" configure --with-ghc="/usr/local/bin/ghc" --with-ghc-pkg="/usr/local/bin/ghc-pkg"  --package-db=/home/GHC/ghc-7.6.3/libraries/bootstrapping.conf --disable-library-for-ghci --configure-option=CFLAGS=" -fno-stack-protector   " --configure-option=LDFLAGS=" -Wl,--hash-size=31 -Wl,--reduce-memory-overheads  " --configure-option=CPPFLAGS="   "   --constraint "Cabal == 1.16.0"   --constraint "hpc == 0.6.0.0"   --constraint "binary == 0.5.1.1"   --constraint "bin-package-db == 0.0.0.0"   --constraint "hoopl == 3.9.0.0" --with-gcc="/usr/bin/gcc" --with-ld="/nix/store/jys3nw5rg2a4lrihs7qhflxad4bwyry6-binutils-cross-mips64el-linux-gnu-2.23.2/bin/mips64el-linux-gnu-ld" --configure-option=--with-cc="/usr/bin/gcc" --with-ar="/usr/bin/ar" --with-ranlib="true" --with-alex="/usr/bin/alex" --with-happy="/usr/bin/happy" -- dist-boot libraries/Cabal/Cabal
Configuring Cabal-1.16.0...
ghc-cabal: /tmp/27862.o: does not exist
make[1]: *** [libraries/Cabal/Cabal/dist-boot/package-data.mk] Error 1
make: *** [all] Error 2

I can't find any similar reports.  Am I on the right track?

[1] https://gnu.org/software/guix/
[2] http://hackage.haskell.org/trac/ghc/ticket/6086
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20130615/8e03f87a/attachment.pgp>


More information about the Glasgow-haskell-users mailing list