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
libcxxinLLVM_ENABLE_RUNTIMESfor the host. - Configure and build
libcxxin-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=clangwith the host tools andLLVM_ENABLE_RUNTIMES=libcxx. - Install artifacts to somewhere.
I guess installed artifacts as below.
clangand 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_PROJECTSmay acceptlibcxxand other runtimes. Such runtimes should be treated specially against other external projects.LLVM_ENABLE_RUNTIMESshould 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
libcxxin advance of other libs and tools with the host CXX.- Modify (drop) a few flags specified in the upper scope.
libcxxshould be more generic and C++20-ready.
- Modify (drop) a few flags specified in the upper scope.
- Modify flags for tools
CXXFLAGSshould have-nostdinc++- Add in-tree
libcxxtoinclude_directories(), especially__config_site. LDFLAGSshould be modified to find just-builtlibcxxin advance of otherlibc++.- Unittests’ RPATH should point to just-built
libc++.soifcxx_sharedis 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
libcxxmay be invoked in advance of LLVM’sconfig-ix.libcxx’s configurator should be responsible to check the host CXX works fine. - LLVM’s
config-ixshould 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.