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

Closed
rwbarton opened this Issue Oct 1, 2013 · 5 comments

Projects

None yet

3 participants

Contributor
rwbarton commented Oct 1, 2013

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.

Owner
tibbe commented Oct 1, 2013

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

Contributor
rwbarton commented Oct 1, 2013

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 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 13, 2013
@23Skidoo 23Skidoo Look up location of 'ld' etc. in the 'gcc --info' output.
See #1528.
03d14dc
Member

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

Contributor

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 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 15, 2013
@23Skidoo 23Skidoo Look up location of 'ld' etc. in the 'gcc --info' output.
See #1528.
972443c
Member

@rwbarton Nice.

@23Skidoo 23Skidoo added a commit to 23Skidoo/cabal that referenced this issue Oct 15, 2013
@23Skidoo 23Skidoo Look up location of 'ld' etc. in the 'gcc --info' output.
See #1528.
86c0c82
@23Skidoo 23Skidoo closed this in #1543 Oct 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment