Question

I am trying to build LLVM and link it against libc++, but I can't get it to work. I downloaded the latest version (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)

Complete output on Gist.

LLVM compiles and links fine with libstdc++, but not with libc++. I have no idea why it won't link with libc++; other programs just link fine. I am running OS X Mountain Lion and libc++ is in /usr/lib/libc++.1.dylib. The compiler used is Apple clang version 4.0 (tags/Apple/clang-421.0.60) (based on LLVM 3.1svn).

Was it helpful?

Solution

Trust me, I'm not expert in this area. But try this:

../llvm/configure --enable-libcpp

And in general I've found:

../llvm/configure --help

quite helpful.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top