Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


use ld specified by "ghc --info" by default #1528

rwbarton opened this Issue · 5 comments

3 participants


The ghc testsuite tests "cabal0{1,3,4}" fail in my cross-compilation setup (i686 cross-compiler built on amd64) because Cabal tries to link with the system linker with no special options.

The ghc testsuite could pass the appropriate --with-ld option to cabal, but wouldn't it make sense for Cabal to use the ld binary and ld flags specified by ghc --info, using the version of ghc specified by the --with-compiler option?

Specifically, the testsuite does this:

'/home/rwbarton/dist/ghc-i686/inplace/bin/ghc-stage2' --make -o setup Setup.lhs -v0
'/home/rwbarton/dist/ghc-i686/inplace/bin/ghc-pkg' init local.db
./setup configure -v0 --prefix=/home/rwbarton/dist/ghc-i686/testsuite/tests/cabal/cabal01/install --with-compiler='/home/rwbarton/dist/ghc-i686/inplace/bin/ghc-stage2' --ghc-options='-fforce-recomp -dcore-lint -dcmm-lint -dno-debug-output -no-user-package-db' --with-hc-pkg='/home/rwbarton/dist/ghc-i686/inplace/bin/ghc-pkg' --package-db=local.db --enable-library-vanilla --disable-library-profiling --enable-shared

and the linker complains because it is expecting an x86_64 elf object file (I think). The output of /home/rwbarton/dist/ghc-i686/inplace/bin/ghc-stage2 --info is:

 ,("ld command","/home/rwbarton/bin/i686/ld")
 ,("ld flags","")
 ,("ld supports compact unwind","YES")
 ,("ld supports build-id","YES")
 ,("ld supports filelist","NO")
 ,("ld is GNU ld","YES")

and when I manually add --with-ld=/home/rwbarton/bin/i686/ld to the setup command, it completes successfully.


This is outside my area of expertise, but using the info from --info sounds reasonable.


I should add that I vaguely recall while investigating #1493 coming across some code in Cabal that is supposed to use the output of ghc --info, so I'm not entirely sure whether this is a bug report or a feature request. (Could it be invoking the wrong ghc, for example?)



I've implemented this on the ld-ghc-info branch in my repo. Can you test my fix?


Would be nice to get your input.


Yes, I pulled this branch into my ghc-i686 tree, (un-bumped the version number into the range ghc expected) and now the full testsuite output looks very much like the native compiler output, perfect!


@rwbarton Nice.

@23Skidoo 23Skidoo closed this in #1543
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.