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

unhandled ELF relocation(RelA) type 42 #371

Closed
alang9 opened this issue Apr 10, 2017 · 8 comments
Closed

unhandled ELF relocation(RelA) type 42 #371

alang9 opened this issue Apr 10, 2017 · 8 comments
Labels
llvm backend accelerate-llvm

Comments

@alang9
Copy link
Contributor

alang9 commented Apr 10, 2017

On a machine running ubuntu 16.04 and ghc 8.0.2.

When running cabal install --only-dep -fllvm-ptx in the accelerate-examples repo, it tries to install accelerate-llvm, but fails with this error:

ghc: accelerate-examples/.cabal-sandbox/lib/x86_64-linux-ghc-8.0.2/llvm-hs-4.0.1.0-2aLaGcp4OtZ2HmPfg2V9k8/HSllvm-hs-4.0.1.0-2aLaGcp4OtZ2HmPfg2V9k8.o: unhandled ELF relocation(RelA) type 42

ghc: unable to load package `llvm-hs-4.0.1.0'
cabal: Leaving directory '/tmp/cabal-tmp-25178/accelerate-llvm-1.0.0.0'

In contrast, running stack build seems to work fine

@tmcdonell
Copy link
Member

I guess this is related to #369? Probably cabal isn't applying the -fshared-llvm flag again, whereas it is (presumably) explicit in your stack.yaml file?

@tmcdonell
Copy link
Member

Otherwise this is presumably GHC#12147 which should be in GHC-8.0.2 (?).

@alang9
Copy link
Contributor Author

alang9 commented Apr 11, 2017

I confirmed that it's applying the -fshared-llvm flag.

From ghc-pkg --package-db=.cabal-sandbox/x86_64-linux-ghc-8.0.2-packages.conf.d describe llvm-hs:

hs-libraries: HSllvm-hs-4.0.1.0-2aLaGcp4OtZ2HmPfg2V9k8
extra-libraries:
    stdc++ LLVM-4.0

@tmcdonell
Copy link
Member

Hm, I'm not sure what cabal might be doing differently to stack; maybe this is a cabal bug?

It could be worth trying cabal [new-]build --with-gcc $GCC --ghc-options "-pgmc=${GCC}", where $GCC points to a recent version (>=5 ?).

-v2 might also have useful information.

@tmcdonell tmcdonell added the llvm backend accelerate-llvm label Apr 14, 2017
@alang9
Copy link
Contributor Author

alang9 commented Apr 20, 2017

so far I've been able to reproduce the error on 2 machines running ubuntu 16.04, but I failed to reproduce it on 3 machines running 14.04.

Also, if I use cabal install -j 1, the error doesn't occur either.

When running with --verbose=3, the output around the error looks like this:

*** gcc:
/usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE -B[...]/accelerate-examples/.cabal-sandbox/lib/x86_64-linux-ghc-8.0.2/llvm-hs-4.0.1.0-2
aLaGcp4OtZ2HmPfg2V9k8 -B/usr/lib/llvm-4.0/lib --print-file-name 'libstdc++.so'
*** gcc:
/usr/bin/gcc -fno-stack-protector -DTABLES_NEXT_TO_CODE -B[...]/accelerate-examples/.cabal-sandbox/lib/x86_64-linux-ghc-8.0.2/llvm-hs-4.0.1.0-2
aLaGcp4OtZ2HmPfg2V9k8 -B/usr/lib/llvm-4.0/lib --print-file-name 'liblibstdc++.so'
Loading package llvm-hs-4.0.1.0 ... linking ... ghc: [...]/accelerate-examples/.cabal-sandbox/lib/x86_64-linux-ghc-8.0.2/llvm-hs-4.0.1.0-2aLaGcp4OtZ2HmPfg2V9k8/HSllvm-hs-4.0.1.0-2aLaGcp4OtZ2HmPfg2V9k8.o: unhandled ELF relocation(RelA) type 42

@tmcdonell
Copy link
Member

paging @cocreature, who may be interested as this seems to involve llvm-hs (though I have no idea what the root cause is)

@cocreature
Copy link

I don’t know what’s could be causing the error (apart from the things fixed in 8.0.2) but here are a few things that might be interesting:

  1. Try cloning the llvm-hs repository and build everything in there including the tests (that’s basically equivalent to building executables that link against llvm-hs so linker errors should appear there as well).
  2. What’s the output of gcc --version, cabal --version, llvm-config --version and ghc --version?
  3. Can you reproduce the error using cabal new-build?
  4. Can you provide instructions on how to reproduce this (ideally for a clean docker image of 16.04). In particular, how did you install LLVM, ghc and cabal?

@tmcdonell
Copy link
Member

guessing this is fixed now or no longer relevant with llvm-5? please reopen if you have further problems.

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

No branches or pull requests

3 participants