From d2b6b7e1d4683b78e2335567696431273fe29f5f Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Sat, 3 Oct 2026 06:31:59 +0000 Subject: [PATCH 1/2] [ci] Add special build with Clang and libc++ on Linux Add a Fedora 44 based special build that compiles ROOT with Clang using libc++ instead of GNU libstdc++ (`libcxx=ON`), as suggested in https://github.com/root-project/root/issues/19940. Since the distribution-provided C++ libraries (boost, GSL, XRootD, TBB, ...) are built with libstdc++ and would be ABI-incompatible, the configuration enables all builtin fallbacks, following the precedent of the alma10 clang build. --- .../buildconfig/fedora44-clang_libcxx.txt | 38 +++++++++++++++++++ .github/workflows/root-ci.yml | 5 +++ 2 files changed, 43 insertions(+) create mode 100644 .github/workflows/root-ci-config/buildconfig/fedora44-clang_libcxx.txt diff --git a/.github/workflows/root-ci-config/buildconfig/fedora44-clang_libcxx.txt b/.github/workflows/root-ci-config/buildconfig/fedora44-clang_libcxx.txt new file mode 100644 index 0000000000000..439578254e761 --- /dev/null +++ b/.github/workflows/root-ci-config/buildconfig/fedora44-clang_libcxx.txt @@ -0,0 +1,38 @@ +# Build ROOT with Clang and libc++ instead of GNU libstdc++ on Linux. +# The Fedora 44 image provides clang and libcxx/libcxxabi-devel packages. +CMAKE_C_COMPILER=clang +CMAKE_CXX_COMPILER=clang++ +CMAKE_GENERATOR=Ninja +CMAKE_CXX_STANDARD=20 +soversion=ON +libcxx=ON +davix=OFF +tpython=OFF +minuit2_omp=OFF +# All C++ dependencies must be built with the same toolchain: the ones +# shipped by the distribution are compiled with libstdc++ and are ABI +# incompatible with a libc++ ROOT build. +builtin_civetweb=ON +builtin_fftw3=ON +builtin_freetype=ON +builtin_ftgl=ON +builtin_gif=ON +builtin_gl2ps=ON +builtin_gtest=ON +builtin_gsl=ON +builtin_jpeg=ON +builtin_lz4=ON +builtin_lzma=ON +builtin_nlohmann=ON +builtin_pcre=ON +builtin_png=ON +builtin_tbb=ON +builtin_tiff=ON +builtin_unuran=ON +builtin_vdt=ON +builtin_xrootd=ON +builtin_xxhash=ON +builtin_zlib=ON +builtin_zstd=ON +test_distrdf_dask=OFF +test_distrdf_pyspark=OFF diff --git a/.github/workflows/root-ci.yml b/.github/workflows/root-ci.yml index 0af636192a117..ace11ab1be0c1 100644 --- a/.github/workflows/root-ci.yml +++ b/.github/workflows/root-ci.yml @@ -430,6 +430,11 @@ jobs: is_special: true property: "clang Ninja builtins auto-registration off" overrides: ["CMAKE_CXX_STANDARD=20"] + # Fedora 44 with Clang and libc++ instead of GNU libstdc++ + - image: fedora44 + platform_config: fedora44-clang_libcxx + is_special: true + property: "clang Ninja libc++" # Asan build - image: alma10 platform_config: alma10-asan From 62f9b4f8802f2e64c3ff49a19efc5a8350b7489a Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Wed, 7 Oct 2026 23:39:33 +0000 Subject: [PATCH 2/2] [cling] Look up headers of the C++ standard library ROOT is built with MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With `libcxx=ON`, ROOT appends `-stdlib=libc++` to `CMAKE_CXX_FLAGS`, but the compiler commands cling uses to find the C++ standard library headers (`CLING_CXX_RLTV` and `CLING_CXX_PATH`, which are run at configure time and at runtime) did not include it. With a clang that defaults to libstdc++, like the one on Fedora, cling therefore parsed the libstdc++ headers while ROOT was compiled against libc++. With C++ modules, this failed right away in `rootcling_stage1` when generating `G__Core`: libstdc++ has no modulemap of its own and cling's `std.modulemap` is not installed for libc++ builds: ``` CIFactory.cpp:708: [...] Assertion `llvm::sys::fs::exists(originalLoc.str())' failed. ``` Forward a `-stdlib=` flag from `CMAKE_CXX_FLAGS` to these commands. 🤖 Done with the help of AI --- interpreter/cling/lib/Interpreter/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/interpreter/cling/lib/Interpreter/CMakeLists.txt b/interpreter/cling/lib/Interpreter/CMakeLists.txt index 0474f07d9892a..8aab15bac107d 100644 --- a/interpreter/cling/lib/Interpreter/CMakeLists.txt +++ b/interpreter/cling/lib/Interpreter/CMakeLists.txt @@ -264,11 +264,19 @@ if (UNIX) endif() endif() + # If CMAKE_CXX_FLAGS selects the C++ standard library (e.g. -stdlib=libc++ + # with a clang that defaults to libstdc++), cling has to look up the headers + # of that library, not the ones of the compiler default. + string(REGEX MATCH "-stdlib=[^ ]+" cling_cxx_stdlib "${CMAKE_CXX_FLAGS}") + if (cling_cxx_stdlib AND CLING_CXX_RLTV) + set(CLING_CXX_RLTV "${CLING_CXX_RLTV} ${cling_cxx_stdlib}") + endif() + if(NOT CLING_CXX_HEADERS) if (CLING_CXX_PATH) - execute_process(COMMAND ${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS} -xc++ -E -v /dev/null + execute_process(COMMAND ${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS} ${cling_cxx_stdlib} -xc++ -E -v /dev/null OUTPUT_QUIET ERROR_VARIABLE CLING_CXX_HEADERS) - set(CLING_CXX_PATH "${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS}") + set(CLING_CXX_PATH "${CLING_CXX_PATH} ${CLING_CXX_PATH_ARGS} ${cling_cxx_stdlib}") else() # convert CMAKE_CXX_FLAGS to a list for execute_process string(REPLACE "-fdiagnostics-color=always" "" cling_tmp_arg_list ${CMAKE_CXX_FLAGS})