Getting lld to compile on Mac OS X Lion


What are the steps I have to follow to compile lld on a mac?

I've compiled and installed llvm+clang+libc++, but clang won't use the updated version that I installed in /usr/local/
If I just hack it and put the updated headers in lld's directory, it will compile it, so I suppose it's the libc++ that's bundled with Mac OS X that is too old.

The steps I took were:
compile and install llvm+clang+libcxx (using ToT for all of them, compiled and installed using cake).
I had to add -std=c++0x to the compilation flags and -lc++abi to the linker flags, for the libcxx dir.

Put lld in llvm/projects/lld
[dev/llvm-build]% cmake -DLLVM_TARGETS_TO_BUILD="ARM;PowerPC;CellSPU;X86" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ../llvm

[dev/llvm-build]% make

The error I get when I'm trying to compile is
If I symlink the updated libcxx headers into lld/tools/lld-core, the file compiles cleanly (but fails linking becausee I'm not tweaking the linker flags).

How can I make clang use the libcxx library at /usr/local/lib? I would prefer if I didn't have to replace the system library with my (possibly buggy) version…



When I run cmake, I pass -DCMAKE_C_COMPILER= (and -DCMAKE_CXX_COMPILER=) with the *full* path to my local clang (clang++).

The clang tools I have installed contain their own copy of the libc++ headers which are found relative to the compiler.