[cfe-dev] undefined symbol: llvm::Triple::getDarwinNumber when linking with libLLVMSystem.a

Craig Mortensen mortay at apple.com
Mon Sep 28 15:10:59 PDT 2009


Hello,

I'm running into some linking problems I can't seem to solve with  
libLLVMSystem.a (and other libraries)

The linker can find the symbol for: getOSAndEnvironmentName(), but not  
for: getDarwinNumber()

Here's a crude code snipit for example:

llvm::Triple triple;
unsigned a,b,c;
triple.getDarwinNumber(a, b, c);
triple.getOSAndEnvironmentName();

...and the link error is below at the end of this email.  I also get  
similar link errors for symbols like:


"llvm::StringMapImpl::FindKey(llvm::StringRef const&) const",  
referenced from:
	llvm::StringMap<bool, llvm::MallocAllocator>::find(llvm::StringRef  
const&) constin libclangBasic.a(Targets.o)

"llvm::raw_ostream::write(char const*, unsigned long)", referenced from:
	 llvm::raw_ostream::operator<<(llvm::StringRef const&)in  
libclangBasic.a(SourceManager.o)

"llvm::BumpPtrAllocator::DefaultSlabAllocator", referenced from:
       __ZN4llvm16BumpPtrAllocator20DefaultSlabAllocatorE$non_lazy_ptr  
in libclangBasic.a(SourceManager.o)

Any help would be appreciated.

Craig



Ld build/Debug/testDocumentXML normal i386
cd /Users/craig/Desktop/testUsingClang
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Developer/usr/bin/llvm-g++-4.2 -arch i386 -isysroot /Developer/SDKs/ 
MacOSX10.6.sdk -L/Users/craig/Desktop/testUsingClang/build/Debug -L/ 
Volumes/Untitled/Projects/llvm-trunk/Release/lib -L/Volumes/Untitled/ 
Projects/llvm-clang/llvm/Debug/lib -F/Users/craig/Desktop/ 
testUsingClang/build/Debug -filelist /Users/craig/Desktop/ 
testUsingClang/build/testDocumentXML.build/Debug/testDocumentXML.build/ 
Objects-normal/i386/testDocumentXML.LinkFileList -mmacosx-version- 
min=10.6 -framework Foundation /Volumes/Untitled/Projects/llvm-clang/ 
llvm/Debug/lib/profile_rt.dylib /Volumes/Untitled/Projects/llvm-clang/ 
llvm/Debug/lib/LLVMHello.dylib -lplugin_llvmc_Clang - 
lplugin_llvmc_Base -lLTO -lLTO -lLLVMXCoreInfo -lLLVMXCoreCodeGen - 
lLLVMXCoreAsmPrinter -lLLVMX86Info -lLLVMX86CodeGen - 
lLLVMX86AsmPrinter -lLLVMX86AsmParser -lLLVMTransformUtils - 
lLLVMTarget -lLLVMSystemZInfo -lLLVMSystemZCodeGen - 
lLLVMSystemZAsmPrinter -lLLVMSystem -lLLVMSupport -lLLVMSparcInfo - 
lLLVMSparcCodeGen -lLLVMSparcAsmPrinter -lLLVMSelectionDAG - 
lLLVMScalarOpts -lLLVMPowerPCInfo -lLLVMPIC16Info -lLLVMPowerPCCodeGen  
-lLLVMPowerPCAsmPrinter -lLLVMPIC16CodeGen -lLLVMPIC16AsmPrinter - 
lLLVMMSP430Info -lLLVMMSP430CodeGen -lLLVMMSP430AsmPrinter - 
lLLVMMSILInfo -lLLVMMSIL -lLLVMMipsInfo -lLLVMMipsCodeGen - 
lLLVMMipsAsmPrinter -lLLVMMC -lLLVMLinker -lLLVMJIT -lLLVMipo - 
lLLVMipa -lLLVMInterpreter -lLLVMInstrumentation -lLLVMExecutionEngine  
-lLLVMDebugger -lLLVMCppBackendInfo -lLLVMCppBackend -lLLVMCore - 
lLLVMCodeGen -lLLVMCellSPUInfo -lLLVMCellSPUCodeGen - 
lLLVMCellSPUAsmPrinter -lLLVMCBackendInfo -lLLVMCBackend - 
lLLVMBlackfinInfo -lLLVMBlackfinCodeGen -lLLVMBlackfinAsmPrinter - 
lLLVMBitWriter -lLLVMBitReader -lLLVMAsmParser -lLLVMAsmPrinter - 
lLLVMARMInfo -lLLVMARMCodeGen -lLLVMARMAsmPrinter -lLLVMArchive - 
lLLVMAnalysis -lLLVMAlphaInfo -lLLVMAlphaCodeGen -lLLVMAlphaAsmPrinter  
-lGoogleTest -lCompilerDriver -lclangSema -lclangRewrite -lclangParse - 
lclangLex -lclangIndex -lclangFrontend -lclangDriver -lclangCodeGen - 
lclangBasic -lclangAST -lclangAnalysis -lCIndex -lCIndex -o /Users/ 
craig/Desktop/testUsingClang/build/Debug/testDocumentXML

ld: warning: llvm::cl::parser<std::basic_string<char,  
std::char_traits<char>, std::allocator<char> > >::~parser()has  
different visibility (default) in /Volumes/Untitled/Projects/llvm- 
trunk/Release/lib/libLLVMSupport.a(CommandLine.o) and (hidden) in / 
Users/craig/Desktop/testUsingClang/build/testDocumentXML.build/Debug/ 
testDocumentXML.build/Objects-normal/i386/Test.o
ld: warning: llvm::cl::opt<std::basic_string<char,  
std::char_traits<char>, std::allocator<char> >, false,  
llvm::cl::parser<std::basic_string<char, std::char_traits<char>,  
std::allocator<char> > > >::~opt()has different visibility (default)  
in /Volumes/Untitled/Projects/llvm-trunk/Release/lib/libLLVMSupport.a 
(CommandLine.o) and (hidden) in /Users/craig/Desktop/testUsingClang/ 
build/testDocumentXML.build/Debug/testDocumentXML.build/Objects-normal/ 
i386/Test.o
Undefined symbols:
   "llvm::Triple::getDarwinNumber(unsigned int&, unsigned int&,  
unsigned int&) const", referenced from:
       MyObj::foo()     in Test.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20090928/732402e8/attachment.html>


More information about the cfe-dev mailing list