Feedback about libc++ packaging / co installable or not in distros?


Lately, Reshabh and myself have been working to integrate libc++ into the Debian & Ubuntu llvm-toolchains packages. A blog post is coming to explain in detail what it means.

First, we focussed on bringing libc++ into the packages. Now that we have, we are working to trying to make libc++ & libc++abi coinstalable.

However, starting the work, we are not sure it really makes sense.

Let’s take an example. For example, if I compile with the following command line:
clang++-8 -stdlib=libc++ -lc++abi foo.cpp -o o
it will use the headers in /usr/lib/llvm-8/include/ & the lib in /usr/lib/llvm-8/lib/

However, at run time, it will use the in the ld library path (probably in /lib/x86_64-linux-gnu/).

This also means that we can have a program built using libc++-7 but at runtime, it will use the libc++-8 as library. We are not sure it is such a great idea!

Otherwise, the other options is to be back marking the packages as conflicting with each others. This means that it won’t be possible on the same Debian & Ubuntu system to have libc++-7 and libc++abi-7 installed with libc++-8 and libc++abi-8.

Sylvestre & Reshabh

There's a similar issue in FreeBSD ports, but with the different versions of libstdc++ shipped with different versions of gcc. E.g. gcc 7's headers and libraries are installed into /usr/local/lib/gcc7, gcc 8's into /usr/local/lib/gcc8, and so on.

As far as I know, the only good way to make this work is by adding -rpath options to all link command lines, so the produced binaries use the correct library path. But this still won't allow mixing and matching different versions.

Theoretically, the latest .so should be backwards compatible with all the previous ones, so you could make libc++8 (at least the runtime) the preferred one, and have it conflict with all the previous ones. People could still install the -dev version of libc++6, libc++7, and so on, to explicitly link against those versions.