[cfe-dev] Linking to libclangStaticAnalyzer out-of-tree

Bhargava Shastry via cfe-dev cfe-dev at lists.llvm.org
Wed Sep 9 07:55:34 PDT 2015


Hi,

I plan to implement a stand-alone tool based off of libTooling
infrastructure that includes both AST and Analyzer Frontend actions.
Think of it as a clone of clang-check.

I intend to build this tool outside of the LLVM/Clang source tree.
Naturally, I have added libclangStaticAnalyzer* libraries to the link
section of my tool's cmake file.

Problem is, a handful of clang SA symbols are unresolved at link time.
Most of them have to do with const strings in the
clang::ento::categories namespace. Any ideas why this is happening and
how it can be fixed? FWIW, I tried to build against LLVM source tree
*and* an ubuntu installation of libclang-dev libraries. Both lead to the
following set of (sample) link-time errors.

```
llvm/tools/clang/lib/StaticAnalyzer/Checkers/DirectIvarAssignment.cpp:200:
error: undefined reference to
'clang::ento::categories::CoreFoundationObjectiveC'
lvm/tools/clang/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h:70:
error: undefined reference to 'clang::ento::categories::LogicError'
llvm/tools/clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp:239:
error: undefined reference to 'clang::ento::categories::UnixAPI'
```

Thanks,
Bhargava



More information about the cfe-dev mailing list