Example tutorial giving undefine reference error while building with BUILD_SHARED_LIBS=ON.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
I build the project on my system x64 with shared libraries enable. It is working correctly. It is also NFC.
Hi @xgupta , thank you for working on this!
It's quite easy to miss dependencies when building with BUILD_SHARED_LIBS=Off (i.e. with the default setting - static libs). IIUC, that's what happened here. This example clearly requires the following:
- ASTConsumer implemented in clangAST
- FullSourceLoc implemented in clangBasic
- ASTFrontendAction implemented in clangFrontend
- PCHContainerOperations (required for the invocation of runToolOnCode) implemented in clangSerialization
All the above were missing and your patch fixes that, thank you a ton! I think that this is also missing (implements llvm::outs()):
set(LLVM_LINK_COMPONENTS Support )
I tested on Darwin with BUILD_SHARED_LIBS=On and I'm getting build errors without it:
Undefined symbols for architecture x86_64: "llvm::outs()", referenced from: FindNamedClassVisitor::VisitCXXRecordDecl(clang::CXXRecordDecl*) in FindClassDecls.cpp.o
PS Apologies for taking so much time to review this!
Thank @awarzynski for reviewing and explaining the details. I somehow missed it. Should be fixed by https://github.com/llvm/llvm-project/commit/d1ef9a63a68850bbe8cd8877f69c41833804c8dc