【问题标题】:How can I build LLVM and link it against libc++?如何构建 LLVM 并将其与 libc++ 链接?
【发布时间】:2013-03-16 00:27:41
【问题描述】:

我正在尝试构建 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)(基于 LLVM 3.1svn)

【问题讨论】:

    标签: macos linker llvm libc++


    【解决方案1】:

    相信我,我不是这方面的专家。但是试试这个:

    ../llvm/configure --enable-libcpp
    

    总的来说,我发现:

    ../llvm/configure --help
    

    很有帮助。

    【讨论】:

    • --enable-libcpp 成功了。你是这个星球上最棒的人。
    • 如果你不是这方面的专家,谁是??
    • @StevenLu:我建议与 cfe-dev@cs.uiuc.edu 上的人交谈。
    猜你喜欢
    • 2021-11-14
    • 1970-01-01
    • 2012-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-04
    • 1970-01-01
    • 2019-01-13
    相关资源
    最近更新 更多