doctaweeks / include-what-you-use

Automatically exported from code.google.com/p/include-what-you-use
Other
0 stars 0 forks source link

Link fails in cmake build #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?  Give the *exact* arguments passed
to include-what-you-use, and attach the input source file that gives the
problem (minimal test-cases are much appreciated!)
1. Build llvm+clang+iwyu using cmake

What is the expected output? What do you see instead?

I'd hope for a successful build, but the link fails with some undefined symbols:

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)'
../../../../lib/libclangAST.a(InheritViz.cpp.o): In function 
`clang::InheritanceHierarchyWriter::WriteGraph(clang::QualType)':
/local/brs/work/llvm-source/tools/clang/lib/AST/InheritViz.cpp:46: undefined 
reference to `llvm::DOT::EscapeString(std::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&)'
../../../../lib/libclangBasic.a(Targets.cpp.o): In function `(anonymous 
namespace)::DarwinTargetInfo<(anonymous 
namespace)::ARMTargetInfo>::isValidSectionSpecifier(llvm::StringRef) const':
/local/brs/work/llvm-source/tools/clang/lib/Basic/Targets.cpp:162: undefined 
reference to `llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef, 
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
../../../../lib/libclangBasic.a(Targets.cpp.o): In function `(anonymous 
namespace)::DarwinTargetInfo<(anonymous 
namespace)::X86_64TargetInfo>::isValidSectionSpecifier(llvm::StringRef) const':
/local/brs/work/llvm-source/tools/clang/lib/Basic/Targets.cpp:162: undefined 
reference to `llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef, 
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
../../../../lib/libclangBasic.a(Targets.cpp.o): In function `(anonymous 
namespace)::DarwinTargetInfo<(anonymous 
namespace)::X86_32TargetInfo>::isValidSectionSpecifier(llvm::StringRef) const':
/local/brs/work/llvm-source/tools/clang/lib/Basic/Targets.cpp:162: undefined 
reference to `llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef, 
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
../../../../lib/libclangBasic.a(Targets.cpp.o): In function `(anonymous 
namespace)::DarwinTargetInfo<(anonymous 
namespace)::PPC64TargetInfo>::isValidSectionSpecifier(llvm::StringRef) const':
/local/brs/work/llvm-source/tools/clang/lib/Basic/Targets.cpp:162: undefined 
reference to `llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef, 
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
../../../../lib/libclangBasic.a(Targets.cpp.o): In function `(anonymous 
namespace)::DarwinTargetInfo<(anonymous 
namespace)::PPC32TargetInfo>::isValidSectionSpecifier(llvm::StringRef) const':
/local/brs/work/llvm-source/tools/clang/lib/Basic/Targets.cpp:162: undefined 
reference to `llvm::MCSectionMachO::ParseSectionSpecifier(llvm::StringRef, 
llvm::StringRef&, llvm::StringRef&, unsigned int&, unsigned int&)'
collect2: ld returned 1 exit status

What version of the product are you using? On what operating system?

trunk, on GNU/Linux (32 bit).

Please provide any additional information below.

This patch from the cfe-dev mailing list fixes it:

--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,15 +5,15 @@ if( MSVC )
 endif()

 set(LLVM_USED_LIBS
+  clangFrontend
+  clangSerialization
+  clangDriver
+  clangSema
   clangAnalysis
   clangAST
-  clangBasic
-  clangDriver
-  clangFrontend
-  clangLex
   clangParse
-  clangSema
-  clangSerialization
+  clangLex
+  clangBasic
 )

Original issue reported on code.google.com by bruce.r....@gmail.com on 8 Feb 2011 at 5:52

GoogleCodeExporter commented 9 years ago
Issue 10 has been merged into this issue.

Original comment by csilv...@gmail.com on 8 Feb 2011 at 7:44

GoogleCodeExporter commented 9 years ago
Fixed in r21.

Original comment by csilv...@gmail.com on 8 Feb 2011 at 7:46