[cfe-dev] Announcing include-what-you-use 0.1

Bruce Stephens bruce.r.stephens at gmail.com
Tue Feb 8 07:13:56 PST 2011

Jason Haslam <jason.haslam-Re5JQEeQqe8AvxtiuMwx3w at public.gmane.org>


> add_subdirectory(include-what-you-use)
> at the end of tools/clang/CMakeLists.txt. Works for me :)

Fails in the link for me:

Linking CXX executable ../../../../bin/include-what-you-use
../../../../lib/libclangAST.a(InheritViz.cpp.o): In function `clang::InheritanceHierarchyWriter::WriteNode(clang::QualType, bool)':
/local/brs/work/llvm-source/tools/clang/lib/AST/InheritViz.cpp:80: undefined reference to `llvm::DOT::EscapeString(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
../../../../lib/libclangAST.a(InheritViz.cpp.o): In function `clang::CXXRecordDecl::viewInheritance(clang::ASTContext&) const':
/local/brs/work/llvm-source/tools/clang/lib/AST/InheritViz.cpp:160: undefined reference to `llvm::DisplayGraph(llvm::sys::Path const&, bool, llvm::GraphProgram::Name)'

I'm using GNU ld on GNU/Linux.  Presumably the linker behaviour is
what's different.  Building with VERBOSE=1 shows that libLLVMSupport.a
(which defines llvm::DOT::EscapeString()) and so on are being included
in the link line.  By adding copies of such libraries to the link line
(linking on the command-line rather than through make) I can link it.

Presumably some change to CMakeLists.txt would fix it, but I'm not sure
what.  Maybe the list of clang dependencies is in the wrong order or

More information about the cfe-dev mailing list