<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello Craig,<div><br><div><div>On Sep 28, 2009, at 3:10 PM, Craig Mortensen wrote:</div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Menlo; ">I'm running into some linking problems I can't seem to solve with libLLVMSystem.a (and other libraries)</div></div></blockquote><div><br></div>This looks like a command-line ordering issue (see below):<br><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 14px/normal Menlo; color: rgb(71, 0, 131); "><br></div><div><font class="Apple-style-span" color="#008B00" face="Menlo" size="4"><span class="Apple-style-span" style="font-size: 14px;"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 12px; text-indent: -12px; font: normal normal normal 14px/normal Menlo; ">/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</div></span></font></div></div></blockquote></div><br></div><div>The Clang libraries should come before the LLVM libraries, so that Clang picks up all of the symbols it needs from the LLVM libraries. Also, you should order the "clang" libraries themselves, e.g., </div><div><br></div><div>  -lclangFrontend -lclangCodeGen -lclangAnalysis -lclangRewrite -lclangSema -lclangAST -lclangParse -lclangLex -lclangBasic</div><div><br></div><div>I doubt you need to link against CodeGen or CIndex. CodeGen is only for LLVM IR generation, while CIndex is typically used by itself (without the rest of the Clang libraries).</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">    </span>- Doug</div></body></html>