[llvm-dev] Clarifying the supported ways to build libc++, libc++abi and libunwind

Tobias Hieta via llvm-dev llvm-dev at lists.llvm.org
Wed Apr 8 11:51:58 PDT 2020

Hello Louis,

I earlier this week converted our toolchain scripts from a monorepo
build for libc++ to a "standalone build" where I build libunwind,
libc++abi and libc++ in succession instead of one single build. The
only reason I converted to this is because it's the only sane way to
build libc++ for a system without a existing C++ runtime. The problem
is actually not that libc++ depends on a existing C++ runtime - but
rather that CMake testing does.

When running a monorepo build on a system without a C++ runtime it
will fail a lot of tests from HandleLLVMOptions, while the standalone
builds for unwind, libc++abi and libc++ is much simpler and have less
tests I need to force a value for. This way I don't need first add a
c++ runtime.

My scripts are an adoption of mstorsjo's llvm-mingw (his script to
build libc++ for mingw can be seen here:

I am all for simplifying this build on the other hand - building
libc++ and knowing which of the three should be static or dynamic and
when to use the USE_STATIC_UNWINDER etc is very complex and required a
lot of iterations to get it to work and I am still not sure if I did
the best thing (I ended up with static libc++abi but shared unwinder).


On Wed, Apr 8, 2020 at 5:46 PM Louis Dionne via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> [Cross-post to llvm-dev to make sure everybody relevant sees this]
> Hi,
> I'm currently trying to simplify the libc++/libc++abi/libunwind build systems and testing setup. In doing so, I am encountering issues related to "unusual" ways of building them. By unusual, I just mean "not the usual monorepo build with LLVM_ENABLE_PROJECTS". I would like to pin down what the set of supported use cases for building the runtime libraries are. In particular, the world I would like to live in is one where the only way to build libc++/libc++abi/libunwind is:
>     $ mkdir build
>     $ cd build
>     $ cmake <monorepo-root>/llvm -DLLVM_ENABLE_PROJECTS=libcxx;libcxxabi;libunwind <options>
>     $ ninja -C build install-{cxx,cxxabi,unwind}
> The "runtimes" build would be built on top of this -- it would be just a driver for building these libraries using documented options against the just-built Clang. I think it already does so in essence, however if I'm not mistaken it uses the "Standalone build" and it definitely sets some magic and undocumented CMake variables (like HAVE_LIBCXXABI) that we have to be really careful not to break.
> So, to better understand what people use today, I have some questions. I know the answer to some of those, but I want to see what others have to say:
> 1. What is a "Standalone build"? What does it enable that a normal monorepo build can't?
> 2. What is the "Runtimes" build? How does it work, what is it used for, and what does it expect from libc++/libc++abi/libunwind?
> 3. Are there other "hidden" ways to build the runtime libraries?
> Cheers,
> Louis
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev

More information about the llvm-dev mailing list