Bug 49717

Summary: SCons build error with clang
Product: Mesa Reporter: Vinson Lee <vlee>
Component: OtherAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: medium CC: jfonseca
Version: git   
Hardware: x86-64 (AMD64)   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2012-05-09 23:49:13 UTC
mesa: 788fd04dacb9eb1e32010050c57cd2f49779311b (master)

The SCons build fails with clang.

$ clang -v
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

$ scons
[...]
clang -o build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_arit build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_arit.o build/linux-x86_64-debug/gallium/drivers/llvmpipe/lp_test_main.o -L/usr/lib/llvm-3.0/lib build/linux-x86_64-debug/gallium/drivers/llvmpipe/libllvmpipe.a build/linux-x86_64-debug/gallium/auxiliary/libgallium.a -lLLVMBitWriter -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMX86Desc -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMX86Info -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lpthread -lffi -ldl -lm
/usr/lib/llvm-3.0/lib/libLLVMX86CodeGen.a(X86TargetMachine.o): In function `llvm::X86TargetMachine::X86TargetMachine(llvm::Target const&, llvm::StringRef, llvm::StringRef, llvm::StringRef, llvm::Reloc::Model, llvm::CodeModel::Model, bool)':
(.text+0x2cd): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, unsigned long, std::allocator<char> const&)'
[...]
Comment 1 Olivier Galibert 2012-05-10 00:21:47 UTC
The error points to llvm, specifically /usr/lib/llvm-3.0/lib/libLLVMX86CodeGen.a, not being compiled with clang.  Can you check that?

  OG.
Comment 2 Vinson Lee 2012-05-10 14:41:08 UTC
The Make build using clang successfully builds the llvmpipe unit tests so the problem appears to be with SCons only. Perhaps linking should be done with clang++ instead of with clang?
Comment 3 Michel Dänzer 2012-05-11 00:51:23 UTC
(In reply to comment #2)
> Perhaps linking should be done with clang++ instead of with clang?

I suspect so. Is $CXX set to clang++?
Comment 4 Vinson Lee 2012-05-12 22:38:20 UTC
(In reply to comment #3)
> I suspect so. Is $CXX set to clang++?

Yes, $CXX is set to clang++.

SCons build with clang also fails at the same place on Mac OS X.
Comment 5 Vinson Lee 2012-08-13 00:18:16 UTC
commit 4f109ca4e8ca2c1f0a60b52fa79dd907777e8bee
Author: Vinson Lee <vlee@freedesktop.org>
Date:   Tue Jul 24 23:02:18 2012 -0700

    scons: Fix build with clang.
    
    Signed-off-by: Vinson Lee <vlee@freedesktop.org>
    Reviewed-by: Brian Paul <brianp@vmware.com>

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.