linker error against libclangParse

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

linker error against libclangParse

christopher taylor
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
 `clang::ASTContext::PrintStats() const'
 ParseAST.cpp:(.text+0x15b): undefined reference to
`clang::Decl::PrintStats()'
 ParseAST.cpp:(.text+0x160): undefined reference to
`clang::Stmt::PrintStats()'
 ParseAST.cpp:(.text+0x189): undefined reference to
 `clang::RecordType::classof(clang::TagType const*)'
 ParseAST.cpp:(.text+0x1a3): undefined reference to
 `clang::TagType::getDecl() const'
 ParseAST.cpp:(.text+0x1df): undefined reference to
 `clang::DeclContext::isDependentContext() const'
 ParseAST.cpp:(.text+0x216): undefined reference to
 `clang::NamedDecl::getQualifiedNameAsString() const'
 ParseAST.cpp:(.text+0x25b): undefined reference to
 `clang::ASTContext::DumpRecordLayout(clang::RecordDecl const*,
 llvm::raw_ostream&)'
 ParseAST.cpp:(.text+0x29b): undefined reference to
 `clang::Decl::CollectingStats(bool)'
 ParseAST.cpp:(.text+0x2a5): undefined reference to
 `clang::Stmt::CollectingStats(bool)'

 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!


--
ct
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linker error against libclangParse

Óscar Fuentes
christopher taylor
<[hidden email]>
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.

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev