[cfe-dev] libclangAST.so: undefined reference

Ryuta Suzuki ryuuta at gmail.com
Fri Jul 22 17:18:42 PDT 2011


I fix it by this patch:

Index: lib/AST/CMakeLists.txt
===================================================================
--- lib/AST/CMakeLists.txt (revision 135826)
+++ lib/AST/CMakeLists.txt (working copy)
@@ -1,6 +1,6 @@
 set(LLVM_LINK_COMPONENTS support)

-set(LLVM_USED_LIBS clangBasic)
+set(LLVM_USED_LIBS clangBasic clangLex)

 add_clang_library(clangAST
   APValue.cpp


On Fri, Jul 22, 2011 at 7:13 AM, Ryuta Suzuki <ryuuta at gmail.com> wrote:

> Hi,
>
> I've seen the the following undefined reference error for a while:
>
> [ 94%] Built target gtest_main
> Linking CXX executable AST/ASTTests
> ../../../lib/libclangAST.so: undefined reference to
> `clang::Lexer::AdvanceToTokenCharacter(clang::SourceLocation, unsigned int,
> clang::SourceManager const&, clang::LangOptions const&)'
> ../../../lib/libclangAST.so: undefined reference to
> `clang::Lexer::LexTokenInternal(clang::Token&)'
> ../../../lib/libclangAST.so: undefined reference to
> `clang::StringLiteralParser::init(clang::Token const*, unsigned int)'
> ../../../lib/libclangAST.so: undefined reference to
> `clang::Lexer::getSourceLocation(char const*, unsigned int) const'
> ../../../lib/libclangAST.so: undefined reference to
> `clang::Lexer::Lexer(clang::SourceLocation, clang::LangOptions const&, char
> const*, char const*, char const*)'
> ../../../lib/libclangAST.so: undefined reference to
> `clang::StringLiteralParser::getOffsetOfStringByte(clang::Token const&,
> unsigned int) const'
> collect2: ld returned 1 exit status
> make[2]: *** [tools/clang/unittests/AST/ASTTests] Error 1
> make[1]: *** [tools/clang/unittests/CMakeFiles/ASTTests.dir/all] Error 2
>
> LLVM_USED_LIBS in clang/lib/AST/CMakeLists.txt may need to be updated?
>
> Thanks,
>
> Ryuta
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110723/a68dc49e/attachment.html>


More information about the cfe-dev mailing list