[cfe-dev] linker error against libclangParse

Óscar Fuentes ofv at wanadoo.es
Fri Jan 14 07:16:38 PST 2011


christopher taylor
<christopher.paul.taylor at gmail.com>
writes:

> I'm attempting to write an open source tool using the clang parser.
>
>  Unfortunately, I'm getting a boat load of linker errors. (Note, I'm
>  compiling with gcc...)
>
>  /opt/lib/libclangParse.a(ParseAST.o): In function
>  `clang::ParseAST(clang::Sema&, bool)':
>  ParseAST.cpp:(.text+0x4f): undefined reference to `clang::Sema::Initialize()'
>  ParseAST.cpp:(.text+0x156): undefined reference to
[snip]
>  Here is the linking portion of my compile command:
>
>  -fno-rtti -Wall -I/opt/include -lclangFrontend -lclangDriver
>  -lclangCodeGen -lclangSema -lclangChecker -lclangAnalysis
>  -lclangRewrite -lclangAST -lclangParse -lclangLex -lclangBasic
>  -lLLVMSupport -lLLVMSystem `llvm-config --cxxflags --ldflags --libs
>  all`
>
>  Any assistance would be greatly appreciated, thanks!

Try with this list of clang libraries:

  -lclangFrontendTool
  -lclangFrontend
  -lclangDriver
  -lclangSerialization
  -lclangCodeGen
  -lclangParse
  -lclangSema
  -lclangStaticAnalyzerCheckers
  -lclangStaticAnalyzerCore
  -lclangAnalysis
  -lclangIndex
  -lclangRewrite
  -lclangAST
  -lclangLex
  -lclangBasic

Also you don't need -lLLVMSupport -lLLVMSystem because

`llvm-config ... --libs all'

already lists them.




More information about the cfe-dev mailing list