Abstract
The most extreme case in RUNTIMES
is libcxx
. It affects almost all artifacts under compilation. Assume RUNTIMES
as libcxx
hereafter.
(I know libcxx
requires libcxxabi
)
tools
means LLVM tools, like llvm, clang, etc., including their development libraries.
- Don’t build
libcxx
inLLVM_ENABLE_RUNTIMES
for the host. - Configure and build
libcxx
in-tree. - Configure tools assuming in-tree
libcxx
- Build tools with
-nostdinc++
and-isystem libcxx
- Link tools to in-tree
libcxx
This RFC will make things easier;
- Building and packaging
- Optimizations and instrumentations
- Make *san easy
- Make “LTO with libc++” easy
- The daily life
Why avoiding LLVM_ENABLE_RUNTIMES
This builds runtimes with just-built clang. I suppose it as “early next stage”.
Consider the case below.
- The host provides old
clang++
and oldlibc++
.clang++
is configured asCLANG_DEFAULT_CXX_STDLIB=libc++
. - Build
LLVM_ENABLE_PROJECTS=clang
with the host tools andLLVM_ENABLE_RUNTIMES=libcxx
. - Install artifacts to somewhere.
I guess installed artifacts as below.
-
clang
and other tools depend on host’s oldlibc++
. -
new
libc++
may be found in the library path ofclang
.-
Old
libc++
would disappear if newlibc++
replaces old one.
-
Old
clang
and libc++
might be incompatible. It’s odd. Others, dev libs will be incompatible to libc++
.
That said, LLVM_ENABLE_RUNTIMES
may be available to other non-host targets for multiarch.
Prerequisite(s)
- The host CXX (maybe
clang++
) should be;- Capable of building
libc++
- Available for the host arch (corresponds to autoconf’s
--host
)
- Capable of building
Suggested configurations
-
LLVM_ENABLE_PROJECTS
may acceptlibcxx
and other runtimes. Such runtimes should be treated specially against other external projects. -
LLVM_ENABLE_RUNTIMES
should exclude the host arch if specified. This is not required unless multiarch runtimes would be built.
Planned implementations
I have the PoC tree to do them below.
- Configure
libcxx
in advance of other libs and tools with the host CXX.- Modify (drop) a few flags specified in the upper scope.
libcxx
should be more generic and C++20-ready.
- Modify (drop) a few flags specified in the upper scope.
- Modify flags for tools
-
CXXFLAGS
should have-nostdinc++
- Add in-tree
libcxx
toinclude_directories()
, especially__config_site
. -
LDFLAGS
should be modified to find just-builtlibcxx
in advance of otherlibc++
. - Unittests’ RPATH should point to just-built
libc++.so
ifcxx_shared
is used.
-
Future plans
I haven’t proved them for now.
- The host CXX may be freestanding unless using NATIVE tools. The configuration will be satisfied just to test capability of building in-tree
libcxx
.- The configurator of
libcxx
may be invoked in advance of LLVM’sconfig-ix
.libcxx
’s configurator should be responsible to check the host CXX works fine. - LLVM’s
config-ix
should skip some tests, assuminglibcxx
’s configurator works fine.
- The configurator of
- Build non-host other runtimes in-tree (w/o
LLVM_BUILD_RUNTIMES
)- I don’t expect it would be easy. CMake is not designed for cross build.
Self explanation
I was thinking just-built clang would be the best in the past, autoconf age. I have been supposing just-built clang is not suitable to CMake configurations.
Thank you.