2016-07-14 45 views
0

我使用cmake $LLVM_SRC之後正在用polly構建llvm。 然後當我使用make -j4時,我得到了下面的錯誤。 我已經在谷歌搜索,似乎是與鏈接的問題。但我不知道如何解決它。任何人都可以幫我嗎?構建LLVM時出現鏈接器錯誤

Built target LLVMBitWriter 
[ 1%] Built target LLVMLinker 
[ 5%] Built target LLVMSupport 
[ 5%] Built target LLVMLTO 
[ 5%] Built target LLVMMCParser 
[ 5%] Built target LLVMMCDisassembler 
[ 5%] Built target LLVMOption 
[ 6%] Built target LLVMObject 
[ 6%] Built target LLVMDebugInfo 
[ 8%] Built target LLVMMC 
[ 8%] Built target LLVMExecutionEngine 
[ 9%] Built target LLVMMCJIT 
[ 9%] Built target LLVMRuntimeDyld 
[ 9%] Built target LLVMAsmParser 
[ 9%] Built target LLVMLineEditor 
[ 9%] Built target LLVMTarget 
[ 9%] Built target LLVMProfileData 
[ 9%] Linking CXX executable ../../bin/FileCheck 
Built target llvm-PerfectShuffle 
Scanning dependencies of target yaml-bench 
[ 9%] Built target count 
Linking CXX executable ../../bin/not 
[ 9%] Scanning dependencies of target gtest 
Building CXX object utils/yaml-bench/CMakeFiles/yaml-bench.dir/YAMLBench.cpp.o 
[ 9%] Building CXX object utils/unittest/CMakeFiles/gtest.dir/googletest/src/gtest-all.cc.o 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `MakeErrMsg(std::string*, std::string const&, int)': 
Program.cpp:(.text._ZL10MakeErrMsgPSsRKSsi+0x85): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `llvm::sys::FindProgramByName(std::string const&)': 
Program.cpp:(.text._ZN4llvm3sys17FindProgramByNameERKSs+0xc5): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `llvm::RedirectIO(llvm::StringRef const*, int, std::string*)': 
Program.cpp:(.text._ZN4llvmL10RedirectIOEPKNS_9StringRefEiPSs+0x7e): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `Execute(llvm::sys::ProcessInfo&, llvm::StringRef, char const**, char const**, llvm::StringRef const**, unsigned int, std::string*)': 
Program.cpp:(.text._ZL7ExecuteRN4llvm3sys11ProcessInfoENS_9StringRefEPPKcS6_PPKS3_jPSs+0x142): undefined reference to `std::string::operator=(std::string&&)' 
Program.cpp:(.text._ZL7ExecuteRN4llvm3sys11ProcessInfoENS_9StringRefEPPKcS6_PPKS3_jPSs+0x29e): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `llvm::sys::Wait(llvm::sys::ProcessInfo const&, unsigned int, bool, std::string*)': 
Program.cpp:(.text._ZN4llvm3sys4WaitERKNS0_11ProcessInfoEjbPSs+0x394): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)': 
Program.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0x9b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
Program.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0xca): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(Program.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, char const*)': 
Program.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(Debug.cpp.o): In function `llvm::cl::parser<std::string>::parse(llvm::cl::Option&, llvm::StringRef, llvm::StringRef, std::string&)': 
Debug.cpp:(.text._ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs[_ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs]+0x3f): undefined reference to `std::string::operator=(std::string&&)' 
collect2: error: ld returned 1 exit status 
make[2]: *** [bin/not] Error 1 
make[1]: *** [utils/not/CMakeFiles/not.dir/all] Error 2 
make[1]: *** Waiting for unfinished jobs.... 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `llvm::cl::parser<std::string>::parse(llvm::cl::Option&, llvm::StringRef, llvm::StringRef, std::string&)': 
FileCheck.cpp:(.text._ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs[_ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs]+0x3f): undefined reference to `std::string::operator=(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `Pattern::EvaluateExpression(llvm::StringRef, std::string&) const': 
FileCheck.cpp:(.text._ZNK7Pattern18EvaluateExpressionEN4llvm9StringRefERSs+0x15f): undefined reference to `std::string::operator=(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)': 
FileCheck.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0x9b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
FileCheck.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0xca): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, char const*)': 
FileCheck.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': 
FileCheck.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_RKS6_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_RKS6_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o: In function `Pattern::Pattern(Pattern&&)': 
FileCheck.cpp:(.text._ZN7PatternC2EOS_[_ZN7PatternC5EOS_]+0x5b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
CMakeFiles/FileCheck.dir/FileCheck.cpp.o:FileCheck.cpp:(.text._ZN9__gnu_cxx13new_allocatorISsE9constructISsISsEEEvPT_DpOT0_[_ZN9__gnu_cxx13new_allocatorISsE9constructISsISsEEEvPT_DpOT0_]+0x41): more undefined references to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' follow 
../../lib/libLLVMSupport.a(CommandLine.cpp.o): In function `LookupNearestOption(llvm::StringRef, llvm::StringMap<llvm::cl::Option*, llvm::MallocAllocator> const&, std::string&)': 
CommandLine.cpp:(.text._ZL19LookupNearestOptionN4llvm9StringRefERKNS_9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEEERSs+0x317): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SourceMgr::GetMessage(llvm::SMLoc, llvm::SourceMgr::DiagKind, llvm::Twine const&, llvm::ArrayRef<llvm::SMRange>, llvm::ArrayRef<llvm::SMFixIt>) const': 
SourceMgr.cpp:(.text._ZNK4llvm9SourceMgr10GetMessageENS_5SMLocENS0_8DiagKindERKNS_5TwineENS_8ArrayRefINS_7SMRangeEEENS6_INS_7SMFixItEEE+0x1d6): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SMFixIt::SMFixIt(llvm::SMFixIt&&)': 
SourceMgr.cpp:(.text._ZN4llvm7SMFixItC2EOS0_[_ZN4llvm7SMFixItC5EOS0_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SMFixIt::operator=(llvm::SMFixIt&&)': 
SourceMgr.cpp:(.text._ZN4llvm7SMFixItaSEOS0_[_ZN4llvm7SMFixItaSEOS0_]+0x3d): undefined reference to `std::string::operator=(std::string&&)' 
collect2: error: ld returned 1 exit status 
make[2]: *** [bin/FileCheck] Error 1 
make[1]: *** [utils/FileCheck/CMakeFiles/FileCheck.dir/all] Error 2 
Linking CXX executable ../../bin/yaml-bench 
CMakeFiles/yaml-bench.dir/YAMLBench.cpp.o: In function `prettyTag(llvm::yaml::Node*)': 
YAMLBench.cpp:(.text._ZL9prettyTagPN4llvm4yaml4NodeE+0x10a): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
YAMLBench.cpp:(.text._ZL9prettyTagPN4llvm4yaml4NodeE+0x186): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(CommandLine.cpp.o): In function `llvm::cl::parser<std::string>::parse(llvm::cl::Option&, llvm::StringRef, llvm::StringRef, std::string&)': 
CommandLine.cpp:(.text._ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs[_ZN4llvm2cl6parserISsE5parseERNS0_6OptionENS_9StringRefES5_RSs]+0x3f): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(CommandLine.cpp.o): In function `LookupNearestOption(llvm::StringRef, llvm::StringMap<llvm::cl::Option*, llvm::MallocAllocator> const&, std::string&)': 
CommandLine.cpp:(.text._ZL19LookupNearestOptionN4llvm9StringRefERKNS_9StringMapIPNS_2cl6OptionENS_15MallocAllocatorEEERSs+0x317): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(CommandLine.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)': 
CommandLine.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0x9b): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
CommandLine.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_S7_]+0xca): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(CommandLine.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, char const*)': 
CommandLine.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_PKS3_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SourceMgr::GetMessage(llvm::SMLoc, llvm::SourceMgr::DiagKind, llvm::Twine const&, llvm::ArrayRef<llvm::SMRange>, llvm::ArrayRef<llvm::SMFixIt>) const': 
SourceMgr.cpp:(.text._ZNK4llvm9SourceMgr10GetMessageENS_5SMLocENS0_8DiagKindERKNS_5TwineENS_8ArrayRefINS_7SMRangeEEENS6_INS_7SMFixItEEE+0x1d6): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': 
SourceMgr.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_RKS6_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EOS6_RKS6_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SMFixIt::SMFixIt(llvm::SMFixIt&&)': 
SourceMgr.cpp:(.text._ZN4llvm7SMFixItC2EOS0_[_ZN4llvm7SMFixItC5EOS0_]+0x3d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(SourceMgr.cpp.o): In function `llvm::SMFixIt::operator=(llvm::SMFixIt&&)': 
SourceMgr.cpp:(.text._ZN4llvm7SMFixItaSEOS0_[_ZN4llvm7SMFixItaSEOS0_]+0x3d): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(Timer.cpp.o): In function `std::pair<llvm::TimeRecord, std::string>::pair(std::pair<llvm::TimeRecord, std::string>&&)': 
Timer.cpp:(.text._ZNSt4pairIN4llvm10TimeRecordESsEC1EOS2_[_ZNSt4pairIN4llvm10TimeRecordESsEC1EOS2_]+0x4d): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(Timer.cpp.o): In function `std::pair<llvm::TimeRecord, std::string>::operator=(std::pair<llvm::TimeRecord, std::string>&&)': 
Timer.cpp:(.text._ZNSt4pairIN4llvm10TimeRecordESsEaSEOS2_[_ZNSt4pairIN4llvm10TimeRecordESsEaSEOS2_]+0x5d): undefined reference to `std::string::operator=(std::string&&)' 
../../lib/libLLVMSupport.a(YAMLParser.cpp.o): In function `llvm::yaml::Node::getVerbatimTag() const': 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x16a): undefined reference to `std::string::operator=(std::string&&)' 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x1d0): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x29b): undefined reference to `std::string::operator=(std::string&&)' 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x301): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x3fa): undefined reference to `std::string::operator=(std::string&&)' 
YAMLParser.cpp:(.text._ZNK4llvm4yaml4Node14getVerbatimTagEv+0x511): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
../../lib/libLLVMSupport.a(YAMLParser.cpp.o): In function `std::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(char const*, std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&)': 
YAMLParser.cpp:(.text._ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_OS6_[_ZStplIcSt11char_traitsIcESaIcEESbIT_T0_T1_EPKS3_OS6_]+0x3f): undefined reference to `std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string&&)' 
collect2: error: ld returned 1 exit status 
make[2]: *** [bin/yaml-bench] Error 1 
make[1]: *** [utils/yaml-bench/CMakeFiles/yaml-bench.dir/all] Error 2 
Linking CXX static library ../../lib/libgtest.a 
[ 9%] Built target gtest 
make: *** [all] Error 2 

回答

0

我看過這種類型的錯誤,當用於編譯的C++庫與它所鏈接的庫之間不匹配時。

無論如何,問題肯定不是LLVM特有的。