Bug 85380

Summary: FTBFS in Clover: /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitialize*Target'
Product: Mesa Reporter: Kai <kai>
Component: OtherAssignee: mesa-dev
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: medium CC: niels_ole, tstellar
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: build log of mesa 9ebfb3014e showing the FTBFS on amd64
llvm_link_fix.diff
LLVM build log

Description Kai 2014-10-23 18:33:07 UTC
Created attachment 108314 [details]
build log of mesa 9ebfb3014e showing the FTBFS on amd64

With current Git HEAD (9ebfb3014e) and LLVM version 3.6 (SVN r220471, built from the Debian source package from <http://llvm-jenkins.debian.net/job/llvm-toolchain-binaries/architecture=amd64,distribution=unstable/968/>, which is maintained by Debian's LLVM maintainer) I'm seeing the following build error, which is similar to bug 45420, which I didn't want to reopen, since it was about totally different versions and is ancient:
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): In function `LLVMInitializeAllTargets':
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSystemZTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeHexagonTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeNVPTXTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeCppBackendTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMSP430Target'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeXCoreTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMipsTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeAArch64Target'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeARMTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializePowerPCTarget'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSparcTarget'
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): In function `LLVMInitializeAllTargetInfos':
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSystemZTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeHexagonTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeNVPTXTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeCppBackendTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMSP430TargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeXCoreTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMipsTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeAArch64TargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeARMTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializePowerPCTargetInfo'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSparcTargetInfo'
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): In function `LLVMInitializeAllTargetMCs':
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSystemZTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeHexagonTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeNVPTXTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeCppBackendTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMSP430TargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeXCoreTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeMipsTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeAArch64TargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeARMTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializePowerPCTargetMC'
> /usr/lib/llvm-3.6/include/llvm/Config/Targets.def:26: undefined reference to `LLVMInitializeSparcTargetMC'
> ../../../../src/gallium/state_trackers/clover/.libs/libclover.a(libclllvm_la-invocation.o): In function `LLVMInitializeAllAsmPrinters':
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeSystemZAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeHexagonAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeNVPTXAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeMSP430AsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeXCoreAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeMipsAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeAArch64AsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeARMAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializePowerPCAsmPrinter'
> /usr/lib/llvm-3.6/include/llvm/Config/AsmPrinters.def:27: undefined reference to `LLVMInitializeSparcAsmPrinter'

The last build I've done was 2883aff3be (Mesa) and LLVM r219920. I've attached the full build log to this report. Let me know if you need something else.
Comment 1 Jan Vesely 2014-10-23 19:00:01 UTC
Created attachment 108315 [details] [review]
llvm_link_fix.diff

I assume you are using cmake build of llvm with split shared libraries.

the failure was introduced in 8e7df519bd8556591794b2de08a833a67e34d526
by calling LLVMInitializeAllTarget*


you can use the attached patch as workaround
Comment 2 Kai 2014-10-23 19:06:30 UTC
Created attachment 108316 [details]
LLVM build log

(In reply to Jan Vesely from comment #1)
> I assume you are using cmake build of llvm with split shared libraries.

Actually no, the LLVM build of the Debian packages uses configure and make, see the attached LLVM build log.

> the failure was introduced in 8e7df519bd8556591794b2de08a833a67e34d526
> by calling LLVMInitializeAllTarget*
> 
> 
> you can use the attached patch as workaround

Ok, I'll try that and report back as soon as the build finishes or fails.
Comment 3 Kai 2014-10-23 19:39:44 UTC
Ok, with a slightly adapted – I still need to add --system-libs, see bug 70410 – version of attachment 108315 [details] [review] Mesa builds again! CCing Tom since he commited 8e7df519bd8556591794b2de08a833a67e34d526.

And with regard to:
>> I assume you are using cmake build of llvm with split shared libraries.
>
> Actually no, the LLVM build of the Debian packages uses configure and make,
> see the attached LLVM build log.

I forgot to mention: I'm linking LLVM statically into Mesa. Just because this tends to work a bit better with games obtained through Steam.
Comment 4 Jan Vesely 2015-01-26 15:47:47 UTC
Fixed in 4b94c3fc3136f8e5225956864dd13828c9b81d5f

configure: Link against all LLVM targets when building clover
    
    Since 8e7df519bd8556591794b2de08a833a67e34d526, we initialise all targets in
    clover. This fixes bug 85380.
    
    v2: Mention correct bug in commit message
Comment 5 Kai 2015-01-26 16:17:10 UTC
I can confirm the patch is working with LLVM SVN revision 227082.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.