[llvm-dev] Statically linking against libc++

Carsten Mattner via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 10 06:49:09 PDT 2017


On Mon, Apr 10, 2017 at 8:42 AM, C Bergström <cbergstrom at pathscale.com> wrote:
> -DBUILD_SHARED_LIBS=OFF should be exactly that, but as I think
> someone else indicated there's a bit of work for it to actually be
> what it advertises to be.

Mehdi wrote it's correct for all of the listed dynlibs to be
installed.

> This could get gray when you consider that you really need to decide
> - did you mean compiler internal libs or runtime stuff. libomp.so vs
> libLLVM.so is two entirely different use cases.

Yep, I'm talking about zero LLVM libs needed at runtime after linking,
unlike say libstdc++ and libgcc needed in your typical Linux
executable.

> Did you want to disable ever being able to use a shared lib or just
> build a static version of the compiler so that it's portable.

Building a static compiler wasn't on my agenda, but since it takes a
long time to build it all, I would love such a target for sharing it
between all Linux distros.

> Shameless self promotion, but this does the latter while preserving
> the former.. Nice clean wrapper around everything that makes a
> compiler that is portable and has all the pieces you need bundled
> together.. https://github.com/pathscale/clang-suite

Do you mind going into the differences of me running
cmake _many_opts_ && ninja install?


More information about the llvm-dev mailing list