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 19 #369

Closed
alang9 opened this issue Apr 4, 2017 · 11 comments
Closed

unhandled ELF relocation(RelA) type 19 #369

alang9 opened this issue Apr 4, 2017 · 11 comments

Comments

@alang9
Copy link
Contributor

alang9 commented Apr 4, 2017

I get the following errors when trying to build accelerate-llvm-1.0.0.0:

Stderr:
ghc: /usr/lib/llvm-4.0/lib/libLLVMAnalysis.a: unhandled ELF relocation(RelA) type 19

ghc: Could not on-demand load symbol '_ZN4llvm30initializeAAEvalLegacyPassPassERNS_12PassRegistryE'

ghc: /usr/lib/llvm-4.0/lib/libLLVMAnalysis.a: unknown symbol `_ZN4llvm30initializeAAEvalLegacyPassPassERNS_12PassRegistryE'
ghc: Could not on-demand load symbol 'LLVMVerifyModule'

ghc: /home/alang/src/tsuru/trader/_mk/8.0.2/extsrc/install/lib/x86_64-linux-ghc-8.0.2/llvm-hs-4.0.1.0-ENiuGLzCFNYJ02bgm8NYWg/HSllvm-hs-4.0.1.0-ENiuGLzCFNYJ02bgm8NYWg.o: unknown symbol `LLVMVerifyModule'
ghc: unable to load package `llvm-hs-4.0.1.0'

llvm-hs-4.0.1.0 is build with -fshared-llvm

some more debugging output:

$ llvm-config-4.0 --libs --link-shared
-lLLVM-4.0
-lLLVMLTO -lLLVMPasses -lLLVMObjCARCOpts -lLLVMMIRParser -lLLVMSymbolize -lLLVMDebugInfoPDB -lLLVMDebugInfoDWARF -lLLVMCoverage -lLLVMTableGen -lLLVMOrcJIT -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMRISCVDesc -lLLVMRISCVCodeGen -lLLVMRISCVInfo -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMLanaiDisassembler -lLLVMLanaiCodeGen -lLLVMLanaiAsmParser -lLLVMLanaiDesc -lLLVMLanaiInstPrinter -lLLVMLanaiInfo -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonAsmParser -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMBPFDisassembler -lLLVMBPFCodeGen -lLLVMBPFDesc -lLLVMBPFInfo -lLLVMBPFAsmPrinter -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAMDGPUDisassembler -lLLVMAMDGPUCodeGen -lLLVMAMDGPUAsmParser -lLLVMAMDGPUDesc -lLLVMAMDGPUInfo -lLLVMAMDGPUAsmPrinter -lLLVMAMDGPUUtils -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMObjectYAML -lLLVMLibDriver -lLLVMOption -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMTarget -lLLVMCoroutines -lLLVMipo -lLLVMInstrumentation -lLLVMVectorize -lLLVMScalarOpts -lLLVMLinker -lLLVMIRReader -lLLVMAsmParser -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMProfileData -lLLVMCore -lLLVMSupport -lLLVMDemangle
@tmcdonell
Copy link
Member

ugh, that linker error doesn't look good. I wonder if it is a problem with GHC's linker, ala GHC#12147.

What version of ghc / gcc / ld / OS / etc. are you using?

@tmcdonell
Copy link
Member

Make sure you have the latest version of stack as well?

This ticket mentions that adding something like the following to your stack.yaml and rebuilding might help:

ghc-options:
  llvm-hs: -opta-Wa,-mrelax-relocations=no

@alang9
Copy link
Contributor Author

alang9 commented Apr 4, 2017

I'm using a custom build system (made with Shake), but adding that ghc-options didn't help.

I'm currently using ubuntu 14.04. ghc 8.0.2, gcc 4.8.4, ld 2.24

@fumieval
Copy link

fumieval commented Apr 4, 2017

I'm using GHC 8.0.2 (DYNAMIC_GHC_PROGRAMS = NO), Ubuntu 16.04.2 LTS (GNU/Linux 4.4.0-51-generic x86_64), gcc version 5.4.0 20160609, ld 2.26.1 and I got exactly the same error. It looks more like a GHC problem

@tmcdonell
Copy link
Member

Okay, if you can open a new ghc issue and link to it here that would be good. The GHC devs might also have some more advice or workarounds you could try.

@fumieval
Copy link

fumieval commented Apr 4, 2017

OK, I've made ticket https://ghc.haskell.org/trac/ghc/ticket/13522

@tmcdonell
Copy link
Member

This comment might be relevant, and probably worth checking for your build system.

@rwbarton
Copy link

rwbarton commented Apr 4, 2017

llvm-hs-4.0.1.0 is build with -fshared-llvm

That's interesting because the error output clearly shows that the runtime linker was trying to load the static library /usr/lib/llvm-4.0/lib/libLLVMAnalysis.a.

@alang9 What is the last code block (starting -lLLVMLTO) the output of and how does it relate to the part above? On my Debian system llvm-config-4.0 --libs --link-shared only prints -lLLVM-4.0, while llvm-config-4.0 --libs --link-static outputs a long list that appears to be the same as your last code block.

Can you provide the output of ghc-pkg describe llvm-hs-4.0.1.0, in particular the extra-libraries section? It looks like it possibly wasn't really built with -fshared-llvm.

@alang9
Copy link
Contributor Author

alang9 commented Apr 4, 2017

@alang9 What is the last code block (starting -lLLVMLTO) the output of and how does it relate to the part above? On my Debian system llvm-config-4.0 --libs --link-shared only prints -lLLVM-4.0, while llvm-config-4.0 --libs --link-static outputs a long list that appears to be the same as your last code block.

Sorry, yes that's indeed the output of llvm-config-4.0 --libs --link-static. I somehow forgot to include that

Can you provide the output of ghc-pkg describe llvm-hs-4.0.1.0, in particular the extra-libraries section? It looks like it possibly wasn't really built with -fshared-llvm.

Here's the extra-libraries section:

extra-libraries:
    stdc++ LLVMLTO LLVMPasses LLVMObjCARCOpts LLVMMIRParser
    LLVMSymbolize LLVMDebugInfoPDB LLVMDebugInfoDWARF LLVMCoverage
    LLVMTableGen LLVMOrcJIT LLVMXCoreDisassembler LLVMXCoreCodeGen
    LLVMXCoreDesc LLVMXCoreInfo LLVMXCoreAsmPrinter
    LLVMSystemZDisassembler LLVMSystemZCodeGen LLVMSystemZAsmParser
    LLVMSystemZDesc LLVMSystemZInfo LLVMSystemZAsmPrinter
    LLVMSparcDisassembler LLVMSparcCodeGen LLVMSparcAsmParser
    LLVMSparcDesc LLVMSparcInfo LLVMSparcAsmPrinter LLVMRISCVDesc
    LLVMRISCVCodeGen LLVMRISCVInfo LLVMPowerPCDisassembler
    LLVMPowerPCCodeGen LLVMPowerPCAsmParser LLVMPowerPCDesc
    LLVMPowerPCInfo LLVMPowerPCAsmPrinter LLVMNVPTXCodeGen
    LLVMNVPTXDesc LLVMNVPTXInfo LLVMNVPTXAsmPrinter LLVMMSP430CodeGen
    LLVMMSP430Desc LLVMMSP430Info LLVMMSP430AsmPrinter
    LLVMMipsDisassembler LLVMMipsCodeGen LLVMMipsAsmParser LLVMMipsDesc
    LLVMMipsInfo LLVMMipsAsmPrinter LLVMLanaiDisassembler
    LLVMLanaiCodeGen LLVMLanaiAsmParser LLVMLanaiDesc
    LLVMLanaiInstPrinter LLVMLanaiInfo LLVMHexagonDisassembler
    LLVMHexagonCodeGen LLVMHexagonAsmParser LLVMHexagonDesc
    LLVMHexagonInfo LLVMBPFDisassembler LLVMBPFCodeGen LLVMBPFDesc
    LLVMBPFInfo LLVMBPFAsmPrinter LLVMARMDisassembler LLVMARMCodeGen
    LLVMARMAsmParser LLVMARMDesc LLVMARMInfo LLVMARMAsmPrinter
    LLVMAMDGPUDisassembler LLVMAMDGPUCodeGen LLVMAMDGPUAsmParser
    LLVMAMDGPUDesc LLVMAMDGPUInfo LLVMAMDGPUAsmPrinter LLVMAMDGPUUtils
    LLVMAArch64Disassembler LLVMAArch64CodeGen LLVMAArch64AsmParser
    LLVMAArch64Desc LLVMAArch64Info LLVMAArch64AsmPrinter
    LLVMAArch64Utils LLVMObjectYAML LLVMLibDriver LLVMOption
    LLVMX86Disassembler LLVMX86AsmParser LLVMX86CodeGen LLVMGlobalISel
    LLVMSelectionDAG LLVMAsmPrinter LLVMDebugInfoCodeView
    LLVMDebugInfoMSF LLVMX86Desc LLVMMCDisassembler LLVMX86Info
    LLVMX86AsmPrinter LLVMX86Utils LLVMMCJIT LLVMLineEditor
    LLVMInterpreter LLVMExecutionEngine LLVMRuntimeDyld LLVMCodeGen
    LLVMTarget LLVMCoroutines LLVMipo LLVMInstrumentation LLVMVectorize
    LLVMScalarOpts LLVMLinker LLVMIRReader LLVMAsmParser
    LLVMInstCombine LLVMTransformUtils LLVMBitWriter LLVMAnalysis
    LLVMObject LLVMMCParser LLVMMC LLVMBitReader LLVMProfileData
    LLVMCore LLVMSupport LLVMDemangle rt dl tinfo pthread z m

@alang9
Copy link
Contributor Author

alang9 commented Apr 4, 2017

So it looks like the default shared-llvm value in the cabal file is not read because we are using runhaskell Setup rather than cabal. Using cabal instead appears to fix this.

Thanks for the help!

@tmcdonell
Copy link
Member

I've submitted a patch to llvm-hs so the runhaskell Setup.hs method should work in future. Sorry for the hassle there.

I guess this is safe to close now. Feel free to reopen / create a new ticket if you have any other issues. Good luck!

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

No branches or pull requests

4 participants