How to set LIBCXX variables in a bootstrapping build of libc++?

(Sorry for the amount of topics lately. I figured it’s better than asking on Discord since posting here at least gives everyone a chance to benefit from the discussions.)

When setting LIBCXX variables in a default build of libc++ (-S runtimes), they are used by CMake. However, the same is not true for bootstrapping builds (-S llvm), unless I’m doing something wrong:

$ cmake -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_SHARED=OFF -DLLVM_ENABLE_RUNTIMES=libcxx -LAH -B build -S llvm | grep LIBCXX_ENABLE_SHARED
# nothing
$ cmake -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_SHARED=OFF -DLLVM_ENABLE_RUNTIMES=libcxx -LAH -B build -S runtimes | grep LIBCXX_ENABLE_SHARED
LIBCXX_ENABLE_SHARED:BOOL=OFF

This is reflected when actually building: The default build disables the shared library, while the bootstrapping one does not.

Sorry I don’t have the solution but is this these open issues?

1 Like

Yeah, that sounds like it. We’ll need to wait for the developers to see it then. Thanks!

cmake variables are not propagated as is into the runtimes build by design.

You are supposed to prefix them with RUNTIMES_<target-triple>_ if you want to forward them.

For example, -DRUNTIMES_<target-triple>_LIBCXX_ENABLE_SHARED=OFF should work.

3 Likes