undefined reference


I’ve seen the the following undefined reference error for a while:

[ 94%] Built target gtest_main
Linking CXX executable AST/ASTTests
…/…/…/lib/ undefined reference to clang::Lexer::AdvanceToTokenCharacter(clang::SourceLocation, unsigned int, clang::SourceManager const&, clang::LangOptions const&)' ../../../lib/ undefined reference to clang::Lexer::LexTokenInternal(clang::Token&)’
…/…/…/lib/ undefined reference to clang::StringLiteralParser::init(clang::Token const*, unsigned int)' ../../../lib/ undefined reference to clang::Lexer::getSourceLocation(char const*, unsigned int) const’
…/…/…/lib/ undefined reference to clang::Lexer::Lexer(clang::SourceLocation, clang::LangOptions const&, char const*, char const*, char const*)' ../../../lib/ 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?



I fix it by this patch:

Index: lib/AST/CMakeLists.txt

Suzuki san, applied in r135864, though I have not tested with shared libs.

+set(LLVM_USED_LIBS clangBasic clangLex)

Thank you.