I'm trying to port a project that uses Clang's LibTooling library from Arch to Ubuntu/Debian.
I have installed the clang-10, llvm-10 and libclang-10-dev packages. The latter installs the necessary headers to /usr/lib/llvm-10/include/clang/ (i.e. usr/lib/llvm-10/include/clang/Tooling/Tooling.h). However, trying to link a program that uses these headers results in various linking errors such as:
undefined reference to `clang::ast_matchers::internal::DynTypedMatcher::matches(clang::ast_type_traits::DynTypedNode const&, clang::ast_matchers::internal::ASTMatchFinder*, clang::ast_matchers::internal::BoundNodesTreeBuilder*) const'Under Arch I can resolve this with -lclang-cpp but no such library exists under Ubuntu. Several posts on StackOverflow recommend linking to various other libraries, so I have als tried:
-lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend -lclangEdit -lclangAST -lclangLex -lclangBasicBut that does not work either. Are the libclang-*-dev packages incomplete/broken? Am I missing yet another package? Or am I just linking against the wrong libraries?