Hi,
I’ve spent the last several days trying to build a fast, full-featured relocatable distribution of LLVM/Clang 9.0.1 on Linux RHEL7, which has an older native GCC (4.8.5)—I can’t require the RH toolset. I have access to a modern version of GCC in order to make the stage-1 build, but I need the final product not only to be relocatable, but also to be free of any dependence on that GCC or its libraries. In other words, I want to be able to distribute an LLVM/CLang which defaults to compiling using libc++, libcxxabi, compiler-rt, libunwind, and ldd, and which itself depends neither on libstdc++ or libgcc_s. I’d also like to be able to to provide LTO, but whether the compiler is itself the beneficiary of LTO is optional. As a final wish, I’d like the distribution as installed to serve as an SDK against which to build other components such as separately packaged lldb and f18. Oh, and I want a pony.
Here’s what I have so far (CMake cache files attached for stages 1 and 2). Invoked in a separate build directory with:
env CC=gcc-9 CXX=g++-9 \
'CXXFLAGS=-Wno-cast-function-type -Wno-deprecated-copy -Wno-init-list-lifetime -Wno-pessimizing-move -Wno-redundant-move -Wno-uninitialized -Wno-unused-function -Wno-unused-variable' \
cmake -GNinja -C FNAL.cmake -DCMAKE_INSTALL_PREFIX=<install-path> \
-DBOOTSTRAP_LLVM_CXX_STD=c++17 <src-path>
ninja
ninja install
(The CXXFLAGS
are just to keep the noise down during the stage-1 build).
I appear (finally) to have a mostly functioning build in situ, but the installed compiler depends upon libstdc++ to be able to run, and I should have put --rtlib=compiler-rt
in LINKER_FLAGS
rather than CXX_FLAGS
. Additionally, I haven’t been able to come up with a good set of targets for LLVM_DISTRIBUTION_COMPONENTS
, but when I do I think I need to exclude static libraries if I’m doing LTO, no?
I suspect I need a three stage build—well, two stage 2s, at least—but any advice would be appreciated as I’m wandering around in the dark at this point.
Many thanks for any help,
Chris.
FNAL-stage2.cmake (2.03 KB)
FNAL.cmake (2.43 KB)