I forgot to mention that you will need libc++abi as well.., building it on linux does not work "out-of-the-box" but requires a small tweak:
First, checkout libcxxabi:
svn co http://llvm.org/svn/llvm-project/libcxxabi/trunk libcxxabi
Next:
Now you need to add some include paths... otherwise it will not compile:
run:
g++ -v -x c++ /dev/null -fsyntax-only
Locate the output line which is similar to this:
/usr/lib/gcc/x86_64-linux-gnu/4.7/include
Adjust CXX environment variable so it will be something similar to this:
export CXX='clang++ -I/usr/local/include/c++/v1 -I/usr/lib/gcc/x86_64-linux-gnu/4.7/include'
and compile libcxxabi by simply typing:
once the compilation is done, you should have a new lib: libc++abi.so.1.0
I could not find a simple way of installing so I copied it manually to
/usr/local/lib and created 2 symlinks:
ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so
ln -sf /usr/local/lib/libc++abi.so.1.0 /usr/local/lib/libc++abi.so.1
Now compiling with clang++/libc++ should be like this:
clang++ -stdlib=libc++ -c test.cpp -I/usr/local/include/c++/v1
clang++ -stdlib=libc++ test.o -o TestMe -lc++ -lc++abi -I/usr/local/include/c++/v1/
Eran