Libc++ and libc++abi on ubuntu/debian/linux

I have hacked together a quick guide to getting clang libc++ and libc++abi working on Ubuntu, should be very similar for other Linux distros and made much easier now the .deb etc. files are being made available. In any case I hope this helps some people as I see this cropping up too many times on the list and web.

Best Regards
David Irvine

Have you run the tests after doing this?

I can give it a go later, but with libsupc++ and Clang-3.3 I had a lot
of failures.


Yes, well there are a few of us using it in the office.

The trick seems to be get libc++ installed before libc++abi and then
re-install libc++ with libc++abi, which is strange. The online examples I
think assume libc++ header are available for building libc++abi which is OK
if you have previously been playing or use a mac. The whole think should
take 5-10 mins though, so it's easy to test. I suggest using the libc++abi
mode as there are some issues with using libcsupc++ (at least in our
project there are some spurious failures with future and exceptions related
issues, but lbc++abi seems to sort this). I have not suggested fully
hosting clang here as the repo is updated frequently and every few days you
would need to update. Of course removing the repo and self hosting would
not be difficult at all.

Best Regards
David Irvine

These are the results of the nightly tests run against clang-3.3:
export CXXFLAGS=-stdlib=libc++ && sandbox/bin/lnt runtest --submit
perfdb nt --sandbox sandbox --cc /usr/bin/clang-3.3 --test-suite
llvm-test-suite -j6

New Failures - Compile Time

Did you try these with libc++abi ? at all, sorry for the laziness here I am
in meetings just now

Best Regards
David Irvine

I am not sure what you are testing here, I cannot replicate your lnt
command. The wiki shows that you will be using clang3.4 and then build
against libc++ and libc++abi. I just rebuilt clang etc. to try this out (a
chore now as clang builds on linux seem to fail with cmake due to gtest
issues with MAX_PATH etc.). I have seen this bug in our production code as
well, so a quick hack fixes it (but more issues in release mode requiring
some c header changes, which is a shame). I will report these if they
continue, but it may be a blip.

I think to test proper you will need to pass -lc++abi as your linker
command if you are compiling.

Does anyone know the best way to test a built clang/libc++abi/libc++
combination without building the whole of llvm/clang again, as the tests
seem to wish to pick up the newly built clang and not allow passing abi
easily (it will be my lack of understanding of the docs).


Best Regards
David Irvine

ben@yyls03:~$ ldd /usr/lib/ => (0x00007fff39bb2000) => /usr/lib/ (0x00007f378202f000) => /lib/x86_64-linux-gnu/
(0x00007f3781e12000) => /lib/x86_64-linux-gnu/ (0x00007f3781a49000) => /lib/x86_64-linux-gnu/ (0x00007f3781744000) => /lib/x86_64-linux-gnu/ (0x00007f378153c000) => /lib/x86_64-linux-gnu/ (0x00007f3781325000)
  /lib64/ (0x00007f3782169000)

I've just tested with:
export CXXFLAGS=-stdlib=libc++ && export LDFLAGS=-lc++abi &&
sandbox/bin/lnt runtest --submit perfdb nt --sandbox sandbox --cc
/usr/bin/clang-3.3 --test-suite llvm-test-suite -j6

And I get the same results.

I don't know what the tests are testing, or what the failure means.

I've used the nightly test suite to test clang-3.3 built using the
release test script (I helped with testing for the release).


Looks like the final flags ended up as "-lc++abi -lc++", so I reran
build with:

export CXXFLAGS=-stdlib=libc++ && export LDFLAGS="-lc++ -lc++abi" &&
sandbox/bin/lnt runtest --submit perfdb nt --sandbox sandbox --cc
/usr/bin/clang-3.3 --test-suite llvm-test-suite -j6

And got:

New Failures - Compile Time ▾