Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
rwbarton opened this Issue · 5 comments

3 participants

@rwbarton

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.

@tibbe
Owner

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

@rwbarton

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?)

@23Skidoo
Collaborator

@rwbarton

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

@dcoutts

Would be nice to get your input.

@rwbarton

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!

@23Skidoo
Collaborator

@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.