I have an odd linker error compiling with Clang.
I'm actually trying to build a clang tool and I am linking against a freshly built set of clang libraries which I can verify do indeed have the virtual ~FrontendActionFactory definition in the source.
Code:
undefined reference to 'typeinfo for clang::tooling::FrontendActionFactory'
Building via cmake with the line:
Code:
clang++ CMakeFiles/cxxcheck.dir/cxxcheck.cpp.o -o cxxcheck -rdynamic -L/home/mm/local/lib -lclangTooling -lclang -lclangAnalysis -lclangARCMigrate -lclangAST -lclangBasic -lclangCodeGen -lclangDriver -lclangEdit -lclangFrontend -lclangFrontendTool -lclangLex -lclangParse -lclangRewrite -lclangSema -lclangSerialization -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangStaticAnalyzerFrontend -lLLVMCore -lLLVMSupport
And my source, which is really nothing thus far:
Code:
#include <clang/Frontend/FrontendActions.h>
#include <clang/Tooling/Tooling.h>
namespace tool = clang::tooling;
struct FrontendActionFactory : tool::FrontendActionFactory {
clang::FrontendAction* create() {
return new clang::SyntaxOnlyAction;
}
};
int main(int argc, const char** argv) {
auto cdb = tool::FixedCompilationDatabase::loadFromCommandLine(argc, argv);
std::vector<std::string> srcs;
for(int i = 1; i < argc; ++i) {
srcs.push_back(argv[i]);
}
return tool::ClangTool(*cdb, srcs).run(new FrontendActionFactory);
}
I'm thinking perhaps at a stretch this may be some RTTI issue?