Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
rwbarton opened this issue Oct 1, 2013 · 5 comments · Fixed by #1543
Closed

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

rwbarton opened this issue Oct 1, 2013 · 5 comments · Fixed by #1543

Comments

@rwbarton
Copy link
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.

@tibbe
Copy link
Member

tibbe commented Oct 1, 2013

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

@rwbarton
Copy link
Contributor Author

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 added a commit to 23Skidoo/cabal that referenced this issue Oct 13, 2013
@23Skidoo
Copy link
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.

@rwbarton
Copy link
Contributor Author

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
Copy link
Member

@rwbarton Nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants