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

Jason Haslam jason.haslam at gmail.com
Tue Feb 8 09:12:07 PST 2011


On Feb 8, 2011, at 8:13 AM, Bruce Stephens wrote:

>> 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
> something?

Ugh, I probably screwed it up by sorting the libraries. Here's a patch that restores the original order from the Makefile. I didn't test it with a linker that cares about order, but it probably works.

Jason

-------------- next part --------------
A non-text attachment was scrubbed...
Name: iwyu_cmake_lib_order.patch
Type: application/octet-stream
Size: 488 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110208/f0cdb748/attachment.obj>
-------------- next part --------------




More information about the cfe-dev mailing list