我该如何构建LLVM并将其链接到libc++?

4

我试图构建LLVM并将其与libc++链接,但我无法使其工作。我下载了最新版本(LLVM 3.2)。

$ CXXFLAGS=-stdlib=libc++ LDFLAGS=-stdlib=libc++ ../llvm-3.2.src/configure
$ make
llvm[0]: Constructing LLVMBuild project information.
llvm[1]: Compiling APFloat.cpp for Release+Asserts build
llvm[1]: Compiling APInt.cpp for Release+Asserts build
(etcetera)
llvm[1]: Building Release+Asserts Archive Library libLLVMTableGen.a
llvm[2]: Compiling FileCheck.cpp for Release+Asserts build
llvm[2]: Linking Release+Asserts executable FileCheck (without symbols)
Undefined symbols for architecture x86_64:
  "std::string::find_last_not_of(char, unsigned long) const", referenced from:
      llvm::SMDiagnostic::print(char const*, llvm::raw_ostream&, bool) const in libLLVMSupport.a(SourceMgr.o)
  "std::string::copy(char*, unsigned long, unsigned long) const", referenced from:
      llvm::sys::Path::makeUnique(bool, std::string*) in libLLVMSupport.a(Path.o)
  "std::string::find(char const*, unsigned long, unsigned long) const", referenced from:
      llvm::sys::getDefaultTargetTriple() in libLLVMSupport.a(Host.o)
  "std::string::find(char, unsigned long) const", referenced from:
      llvm::sys::Program::FindProgramByName(std::string const&) in libLLVMSupport.a(Program.o)
(followed by a bunch of other related linker errors)

完整输出请查看Gist

LLVM可以与libstdc++编译和链接,但无法与libc++链接。我不知道为什么它无法与libc++链接;其他程序链接都很好。我正在运行OS X Mountain Lion,libc++位于/usr/lib/libc++.1.dylib。使用的编译器是Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn)

1个回答

7

相信我,我并不是这个领域的专家。但请尝试这个:

../llvm/configure --enable-libcpp

总的来说,我发现:

../llvm/configure --help

非常有帮助。


--enable-libcpp 做到了。你是地球上最棒的人。 - user142019
如果你不是这个领域的专家,那谁才是呢? - Steven Lu
@StevenLu:我建议与cfe-dev@cs.uiuc.edu的人交流。 - Howard Hinnant

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接