diff --git a/R/ROOT/build_tarballs.jl b/R/ROOT/build_tarballs.jl new file mode 100644 index 00000000000..db82efd8ef6 --- /dev/null +++ b/R/ROOT/build_tarballs.jl @@ -0,0 +1,220 @@ +# Note that this script can accept some limited command-line arguments, run +# `julia build_tarballs.jl --help` to see a usage message. + +using BinaryBuilder, Pkg + +name = "ROOT" +version = v"6.32.8" + +rootgithash = Dict(v"6.32.6" => "5380676d1f0ed3055048f305de917572f976a090", + v"6.32.8" => "a1748a069d2d5f27ec528cfd89b54b12dcba793e") + + +# Collection of sources required to complete build +sources = [ + GitSource("https://github.com/root-project/root.git", rootgithash[version]), + DirectorySource("./bundled") +] + +# Bash recipe for building across all platforms +script = raw""" + +echo USE_CCACHE: $USE_CCACHE + +cd $WORKSPACE +if echo "$target" | grep -q musl; then #build wih musl library +# Disabling what is not working with musl: + CMAKE_EXTRA_OPTS=(-Ddavix=OFF -Dxrootd=OFF -Dssl=OFF -Druntime_cxxmodules=OFF -Droofit=OFF) +else + CMAKE_EXTRA_OPTS=(-Druntime_cxxmodules=OFF) +fi + +# Required to compile graf3d/ftgl/src/FTVectoriser.cxx (for gcc to accept a conversion from char* to unsigned char*) +CMAKE_EXTRA_OPTS+=(-DCMAKE_CXX_FLAGS=-fpermissive) + +# Uncomment for a minimal build for debugging purposes +#CMAKE_EXTRA_OPTS+=(-Dclad=OFF -Dhtml=OFF -Dwebgui=OFF -Dcxxmodules=OFF -Dproof=OFF -Dtmva=OFF -Drootfit=OFF -Dxproofd=OFF -Dxrootd=OFF -Dssl=OFF -Dpyroot=OFF -Dtesting=OFF -Droot7=OFF -Dspectrum=OFF -Dunfold=OFF -Dasimage=OFF -Dgviz=OFF -Dfitiso=OFF -Dcocoa=OFF -Dopengl=OFF -Dproof=OFF -Dxml=OFF -Dgfal=OFF -Dmpi=OFF) + +export SYSTEM_INCLUDE_PATH="`g++ --sysroot="/opt/$target/$target/sys-root" -E -x c++ -v /dev/null 2>&1 | awk '{gsub(\"^ \", \"\")} /End of search list/{a=0} {if(a==1){s=s d $0;d=":"}} /#include <...> search starts here/{a=1} END{print s}'`" + +# build-in compilation of the libAfterImage library needs this directory +mkdir -p /tmp/user/0 + +cd / + +cd "$WORKSPACE" + +# For the cross-compiling, LLVM needs to compile the llvm-tblgen tool +# for the host. The ROOT LLVM code tree does not include the test and +# benchmark directories cmake will need to configure for the host for +# this bootstrap. Therefore, we need to disable the build of the test and +# benchmarks. +sed -i 's/\(option(LLVM_INCLUDE_TESTS[[:space:]].*[[:space:]]\)on)\(.*\)/\1OFF)\2/i + s/\(option(LLVM_INCLUDE_BENCHMARKS[[:space:]].*[[:space:]]\)on)\(.*\)/\1OFF)\2/i' \ + srcdir/root/interpreter/llvm-project/llvm/CMakeLists.txt +echo "set(CXX_STANDARD 17)" >> srcdir/root/interpreter/llvm-project/llvm/CMakeLists.txt + +# N llvm links. LLVM link command needs 15GB +njobs=${nproc} +LLVM_PARALLEL_LINK_JOBS=`grep MemTot /proc/meminfo | awk '{a=int($2/15100000); if(a>'"$njobs"') a='"$njobs"'; if(a<1) a=1; print a;}'` + +# For the rootcling execution performed during the build: +echo "include_directories(SYSTEM /opt/$target/$target/sys-root/usr/include)" >> ${CMAKE_TARGET_TOOLCHAIN} + +# Build with or without debug information: Debug / Release +BUILD_TYPE=Release + +#Patch needed for gcc [9.1.0, 9.3.0) +cat < "\$WORKSPACE/recipe.sh" < "\\\\", "\$" => "\\\$", "`" => "\\`")) +END_OF_SCRIPT + +chmod a+x "\$WORKSPACE/recipe.sh" +$script +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = [ + # Platform("i686", "linux"; libc = "glibc"), + Platform("x86_64", "linux"; libc = "glibc"), + # Platform("aarch64", "linux"; libc = "glibc"), + # Platform("armv6l", "linux"; call_abi = "eabihf", libc = "glibc"), + # Platform("armv7l", "linux"; call_abi = "eabihf", libc = "glibc"), + # Platform("powerpc64le", "linux"; libc = "glibc"), + # Platform("i686", "linux"; libc = "musl"), + # Platform("x86_64", "linux"; libc = "musl"), + # Platform("aarch64", "linux"; libc = "musl"), + # Platform("armv6l", "linux"; call_abi = "eabihf", libc = "musl"), + # Platform("armv7l", "linux"; call_abi = "eabihf", libc = "musl") +] + + +# The products that we will ensure are always built +products = Product[ + ExecutableProduct("root", :root) + ExecutableProduct("rootcling", :rootcling) + ExecutableProduct("rootcling_stage1", :rootcling_stage1) +] + +# Dependencies that must be installed before this package can be built +dependencies = [ + #Mandatory dependencies + BuildDependency(PackageSpec(name="Xorg_xorgproto_jll", uuid="c4d99508-4286-5418-9131-c86396af500b")) + Dependency(PackageSpec(name="Xorg_libX11_jll", uuid="4f6342f7-b3d2-589e-9d20-edeb45f2b2bc")) + Dependency(PackageSpec(name="Xorg_libXpm_jll", uuid="1a3ddb2d-74e3-57f3-a27b-e9b16291b4f2")) + Dependency(PackageSpec(name="Xorg_libXft_jll", uuid="2c808117-e144-5220-80d1-69d4eaa9352c")) + + #Optionnal dependencies (if absent, either a feature will be disabled or a built-in version will be compiled) + Dependency(PackageSpec(name="VDT_jll", uuid="474730fa-5ea9-5b8c-8629-63de62f23418")) + Dependency(PackageSpec(name="XRootD_jll", uuid="b6113df7-b24e-50c0-846f-35a2e36cb9d5")) + Dependency(PackageSpec(name="Lz4_jll", uuid="5ced341a-0733-55b8-9ab6-a4889d929147")) + Dependency(PackageSpec(name="FFTW_jll", uuid="f5851436-0d7a-5f13-b9de-f02708fd171a")) + Dependency(PackageSpec(name="Giflib_jll", uuid="59f7168a-df46-5410-90c8-f2779963d0ec")) + Dependency(PackageSpec(name="Zstd_jll", uuid="3161d3a3-bdf6-5164-811a-617609db77b4")) + Dependency(PackageSpec(name="PCRE2_jll", uuid="efcefdf7-47ab-520b-bdef-62a2eaa19f15")) + Dependency(PackageSpec(name="Graphviz_jll", uuid="3c863552-8265-54e4-a6dc-903eb78fde85")) + Dependency(PackageSpec(name="xxHash_jll", uuid="5fdcd639-92d1-5a06-bf6b-28f2061df1a9")) + Dependency(PackageSpec(name="XZ_jll", uuid="ffd25f8a-64ca-5728-b0f7-c24cf3aae800")) + Dependency(PackageSpec(name="Librsvg_jll", uuid="925c91fb-5dd6-59dd-8e8c-345e74382d89")) + Dependency(PackageSpec(name="FreeType2_jll", uuid="d7e528f0-a631-5988-bf34-fe36492bcfd7")) + Dependency(PackageSpec(name="Xorg_libICE_jll", uuid="f67eecfb-183a-506d-b269-f58e52b52d7c")) + Dependency(PackageSpec(name="Xorg_libSM_jll", uuid="c834827a-8449-5923-a945-d239c165b7dd")) + Dependency(PackageSpec(name="Xorg_libXfixes_jll", uuid="d091e8ba-531a-589c-9de9-94069b037ed8")) + Dependency(PackageSpec(name="Xorg_libXi_jll", uuid="a51aa0fd-4e3c-5386-b890-e753decda492")) + Dependency(PackageSpec(name="Xorg_libXinerama_jll", uuid="d1454406-59df-5ea1-beac-c340f2130bc3")) + Dependency(PackageSpec(name="Xorg_libXmu_jll", uuid="6bc1fdef-f8f4-516b-84c1-6f5f86a35b20")) + Dependency(PackageSpec(name="Xorg_libXt_jll", uuid="28c4a263-0105-5ca0-9a8c-f4f6b89a1dd4")) + Dependency(PackageSpec(name="Xorg_libXtst_jll", uuid="b6f176f1-7aea-5357-ad67-1d3e565ea1c6")) + Dependency(PackageSpec(name="Xorg_xcb_util_jll", uuid="2def613f-5ad1-5310-b15b-b15d46f528f5")) + Dependency(PackageSpec(name="Xorg_libxkbfile_jll", uuid="cc61e674-0454-545c-8b26-ed2c68acab7a")) + Dependency(PackageSpec(name="Libglvnd_jll", uuid="7e76a0d4-f3c7-5321-8279-8d96eeed0f29")) + Dependency(PackageSpec(name="GLU_jll", uuid="bd17208b-e95e-5925-bf81-e2f59b3e5c61")) + Dependency(PackageSpec(name="GLEW_jll", uuid="bde7f898-03f7-559e-8810-194d950ce600")) + Dependency(PackageSpec(name="CFITSIO_jll", uuid="b3e40c51-02ae-5482-8a39-3ace5868dcf4")) + Dependency(PackageSpec(name="oneTBB_jll", uuid="1317d2d5-d96f-522e-a858-c73665f53c3e"), compat="2021.9.0") + Dependency(PackageSpec(name="OpenBLAS32", uuid="51095b67-9e93-468d-a683-508b52f74e81")) +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, scriptwrapper, platforms, products, + dependencies; julia_compat="1.6", preferred_gcc_version=v"9", lock_microarchitecture=false) + diff --git a/R/ROOT/bundled/patches/afterimage-cross-compile.patch b/R/ROOT/bundled/patches/afterimage-cross-compile.patch new file mode 100644 index 00000000000..01894043c23 --- /dev/null +++ b/R/ROOT/bundled/patches/afterimage-cross-compile.patch @@ -0,0 +1,10 @@ +--- a/root/cmake/modules/SearchInstalledSoftware.cmake 2024-06-28 12:55:26.471599664 +0200 ++++ b/root/cmake/modules/SearchInstalledSoftware.cmake 2024-06-28 12:57:58.417875621 +0200 +@@ -499,6 +499,7 @@ + DOWNLOAD_COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/graf2d/asimage/src/libAfterImage AFTERIMAGE + INSTALL_DIR ${CMAKE_BINARY_DIR} + CONFIGURE_COMMAND ./configure --prefix ++ --host=$ENV{target} + --libdir=/lib + --with-ttf ${_ttf_include} --with-afterbase=no + --without-svg --disable-glx ${_after_mmx} diff --git a/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.6.patch b/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.6.patch new file mode 100644 index 00000000000..520ced2d6b2 --- /dev/null +++ b/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.6.patch @@ -0,0 +1,189 @@ +diff -r -u a/root/etc/dictpch/makepch.py b/root/etc/dictpch/makepch.py +--- a/root/etc/dictpch/makepch.py 2024-09-21 20:21:53.000000000 +0200 ++++ b/root/etc/dictpch/makepch.py 2025-01-30 22:13:47.783673060 +0100 +@@ -82,8 +82,6 @@ + cppFlags = getCppFlags(cppflagsFilename) + + cppflagsList=["-D__CLING__", +- "-D__STDC_LIMIT_MACROS", +- "-D__STDC_CONSTANT_MACROS", + "-DROOT_PCH", + "-I%s" %os.path.join(rootdir,"include"), + "-I%s" %os.path.join(rootdir,"etc"), +diff -r -u a/root/cmake/modules/RootMacros.cmake b/root/cmake/modules/RootMacros.cmake +--- a/root/cmake/modules/RootMacros.cmake 2024-09-21 20:21:53.000000000 +0200 ++++ b/root/cmake/modules/RootMacros.cmake 2024-12-18 22:51:27.159808704 +0100 +@@ -8,6 +8,21 @@ + # RootMacros.cmake + #--------------------------------------------------------------------------------------------------- + ++set(NATIVE_BINARY_DIR FALSE CACHE FILEPATH "Path of native built in case of cross compiling.") ++set(CLING_SYSTEM_INCLUDE_PATH FALSE CACHE FILEPATH "List of system paths for rootcling. This option is relevant for a cross compilation that require change of the default path.") ++ ++set(CLING_TARGET_GLIBC FALSE CACHE BOOL "Force rootcling to generate code for glibc. The option is relevant if rootcling is run on one platform to build code for another platform that uses a different libc library") ++ ++if(CLING_TARGET_GLIBC) ++ add_compile_definitions(TARGET_GLIBC=1) ++endif() ++ ++set(CLING_TARGET_GLIBCXX FALSE CACHE BOOL "Force rootcling to generate code for GNU libstdc++. The option is relevant if rootcling is run on one platform to build code for another platform that uses a different standard c++ library") ++ ++if(CLING_TARGET_GLIBCXX) ++ add_compile_definitions(TARGET_GLIBCXX=1) ++endif() ++ + if(WIN32) + set(libprefix lib) + set(ld_library_path PATH) +@@ -302,6 +317,12 @@ + # list of include directories for dictionary generation + set(incdirs) + ++ # for cross compilation ++ set(system_include_dir_opt "") ++ if(CLING_SYSTEM_INCLUDE_PATH) ++ set(system_include_dir_opt "CPLUS_INCLUDE_PATH=${CLING_SYSTEM_INCLUDE_PATH}") ++ endif() ++ + if((CMAKE_PROJECT_NAME STREQUAL ROOT) AND (TARGET ${ARG_MODULE})) + set(headerdirs) + +@@ -602,33 +623,47 @@ + set(newargs -cxxmodule ${newargs}) + endif() + ++ set(rootcling_env "${system_include_dir_opt}") ++ ++ if(NATIVE_BINARY_DIR) ++ set(rootcling_libdir "${NATIVE_BINARY_DIR}/lib") ++ set(rootcling "${NATIVE_BINARY_DIR}/bin/rootcling") ++ set(rootcling_stage1 "${NATIVE_BINARY_DIR}/core/rootcling_stage1/src/rootcling_stage1") ++ set(rootcling_env ${rootcling_env} LLVM_SYMBOLIZER_PATH=${NATIVE_BINARY_DIR}/tools/llvm-symbolizer) ++ else() ++ set(rootcling_libdir "${CMAKE_BINARY_DIR}/lib") ++ set(rootcling "$") ++ set(rootcling_stage1 "$") ++ endif() ++ ++ if(APPLE) ++ set(rootcling_env ${rootcling_env} DYLD_LIBRARY_PATH=${rootcling_libdir}:$ENV{DYLD_LIBRARY_PATH}) ++ else() ++ set(rootcling_env ${rootcling_env} LD_LIBRARY_PATH=${rootcling_libdir}:$ENV{LD_LIBRARY_PATH}) ++ endif() ++ + #---what rootcling command to use-------------------------- + if(ARG_STAGE1) + if(MSVC AND CMAKE_ROOTTEST_DICT) + set(command ${CMAKE_COMMAND} -E ${CMAKE_BINARY_DIR}/bin/rootcling_stage1.exe) + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $) ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} ${rootcling_stage1}) + endif() + set(ROOTCINTDEP rconfigure) + set(pcm_name) + else() + if(CMAKE_PROJECT_NAME STREQUAL ROOT) + if(MSVC AND CMAKE_ROOTTEST_DICT) +- set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/bin/rootcling.exe) ++ set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/core/rootcling_stage1/src/rootcling.exe) + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" +- "ROOTIGNOREPREFIX=1" $ -rootbuild) ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} "ROOTIGNOREPREFIX=1" ${rootcling} -rootbuild) + # Modules need RConfigure.h copied into include/. + set(ROOTCINTDEP rootcling rconfigure) + endif() + elseif(TARGET ROOT::rootcling) +- if(APPLE) +- set(command ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}" $) +- else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH}" $) +- endif() ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} $rootcling) + else() +- set(command ${CMAKE_COMMAND} -E env rootcling) ++ set(command ${CMAKE_COMMAND} -E env ${system_include_dir_opt} rootcling) + endif() + endif() + +diff -r -u a/root/CMakeLists.txt b/root/CMakeLists.txt +--- a/root/CMakeLists.txt 2024-09-21 20:21:53.000000000 +0200 ++++ b/root/CMakeLists.txt 2024-12-19 08:02:12.146813011 +0100 +@@ -530,6 +530,16 @@ + get_property(__pch_dependencies GLOBAL PROPERTY ROOT_PCH_DEPENDENCIES) + get_property(__pch_dictionaries GLOBAL PROPERTY ROOT_PCH_DICTIONARIES) + ++ if(NATIVE_BINARY_DIR) ++ set(rootcling_env "LLVM_SYMBOLIZER_PATH=${NATIVE_BINARY_DIR}/tools/llvm-symbolizer") ++ else() ++ set(rootcling_dir "") ++ endif() ++ ++ if(CLING_SYSTEM_INCLUDE_PATH) ++ set(rootcling_env ${rootcling_env} "CPLUS_INCLUDE_PATH=${CLING_SYSTEM_INCLUDE_PATH}") ++ endif() ++ + add_custom_command(OUTPUT etc/allDict.cxx.pch + BYPRODUCTS + etc/dictpch/allCppflags.txt +@@ -539,7 +549,7 @@ + ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py + ${CMAKE_SOURCE_DIR} . ${pyroot_legacy} ${__cling_pch} + COMMAND +- ${CMAKE_COMMAND} -E env ROOTIGNOREPREFIX=1 ${Python3_EXECUTABLE} ++ ${CMAKE_COMMAND} -E env ${rootcling_env} ROOTIGNOREPREFIX=1 ${Python3_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch + ${__allIncludes} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_SOURCE_DIR}/core + DEPENDS +diff -r -u a/root/interpreter/cling/lib/Interpreter/Interpreter.cpp b/root/interpreter/cling/lib/Interpreter/Interpreter.cpp +--- a/root/interpreter/cling/lib/Interpreter/Interpreter.cpp 2024-09-21 20:21:53.000000000 +0200 ++++ b/root/interpreter/cling/lib/Interpreter/Interpreter.cpp 2024-12-14 23:53:56.203728225 +0100 +@@ -67,6 +67,30 @@ + + using namespace clang; + ++ ++// For cross-compilation, TARGET_GLIBC should be set when invoking ++// the compiler to 0 or 1, depending if target is using glibc. ++// It is set automatically for normal compilation. ++#if !defined(TARGET_GLIBC) ++# ifdef __GLIBC__ ++# define TARGET_GLIBC 1 ++# else ++# define TARGET_GLIBC 0 ++# endif ++#endif ++ ++// For cross-compilation, TARGET_GLIBCXX should be set when invoking ++// the compiler to 0 or 1, depending if target is using GNU libstdc++. ++// It is set automatically for normal compilation. ++#if !defined(TARGET_GLIBCXX) ++# ifdef __GLIBCXX__ ++# define TARGET_GLIBCXX 1 ++# else ++# define TARGET_GLIBCXX 0 ++# endif ++#endif ++ ++ + namespace { + + static void registerCxaAtExitHelper(void *Self, void (*F)(void *), void *Ctx, +@@ -460,7 +484,7 @@ + + // Intercept all atexit calls, as the Interpreter and functions will be long + // gone when the -native- versions invoke them. +-#if defined(__GLIBC__) ++#if TARGET_GLIBC + const char* LinkageCxx = "extern \"C++\""; + const char* Attr = LangOpts.CPlusPlus ? " throw () " : ""; + #else +@@ -468,7 +492,7 @@ + const char* Attr = ""; + #endif + +-#if defined(__GLIBCXX__) ++#if TARGET_GLIBCXX + const char* cxa_atexit_is_noexcept = LangOpts.CPlusPlus ? " noexcept" : ""; + #else + const char* cxa_atexit_is_noexcept = ""; diff --git a/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.8.patch b/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.8.patch new file mode 100644 index 00000000000..31b9a3176a6 --- /dev/null +++ b/R/ROOT/bundled/patches/rootcling-cross-compile_6.32.8.patch @@ -0,0 +1,190 @@ +diff -ru a/root/cmake/modules/RootMacros.cmake b/root/cmake/modules/RootMacros.cmake +--- a/root/cmake/modules/RootMacros.cmake 2024-11-14 10:27:26.000000000 +0100 ++++ b/root/cmake/modules/RootMacros.cmake 2025-01-31 11:01:18.350881086 +0100 +@@ -8,6 +8,21 @@ + # RootMacros.cmake + #--------------------------------------------------------------------------------------------------- + ++set(NATIVE_BINARY_DIR FALSE CACHE FILEPATH "Path of native built in case of cross compiling.") ++set(CLING_SYSTEM_INCLUDE_PATH FALSE CACHE FILEPATH "List of system paths for rootcling. This option is relevant for a cross compilation that require change of the default path.") ++ ++set(CLING_TARGET_GLIBC FALSE CACHE BOOL "Force rootcling to generate code for glibc. The option is relevant if rootcling is run on one platform to build code for another platform that uses a different libc library") ++ ++if(CLING_TARGET_GLIBC) ++ add_compile_definitions(TARGET_GLIBC=1) ++endif() ++ ++set(CLING_TARGET_GLIBCXX FALSE CACHE BOOL "Force rootcling to generate code for GNU libstdc++. The option is relevant if rootcling is run on one platform to build code for another platform that uses a different standard c++ library") ++ ++if(CLING_TARGET_GLIBCXX) ++ add_compile_definitions(TARGET_GLIBCXX=1) ++endif() ++ + if(WIN32) + set(libprefix lib) + set(ld_library_path PATH) +@@ -302,6 +317,12 @@ + # list of include directories for dictionary generation + set(incdirs) + ++ # for cross compilation ++ set(system_include_dir_opt "") ++ if(CLING_SYSTEM_INCLUDE_PATH) ++ set(system_include_dir_opt "CPLUS_INCLUDE_PATH=${CLING_SYSTEM_INCLUDE_PATH}") ++ endif() ++ + if((CMAKE_PROJECT_NAME STREQUAL ROOT) AND (TARGET ${ARG_MODULE})) + set(headerdirs) + +@@ -602,33 +623,47 @@ + set(newargs -cxxmodule ${newargs}) + endif() + ++ set(rootcling_env "${system_include_dir_opt}") ++ ++ if(NATIVE_BINARY_DIR) ++ set(rootcling_libdir "${NATIVE_BINARY_DIR}/lib") ++ set(rootcling "${NATIVE_BINARY_DIR}/bin/rootcling") ++ set(rootcling_stage1 "${NATIVE_BINARY_DIR}/core/rootcling_stage1/src/rootcling_stage1") ++ set(rootcling_env ${rootcling_env} LLVM_SYMBOLIZER_PATH=${NATIVE_BINARY_DIR}/tools/llvm-symbolizer) ++ else() ++ set(rootcling_libdir "${CMAKE_BINARY_DIR}/lib") ++ set(rootcling "$") ++ set(rootcling_stage1 "$") ++ endif() ++ ++ if(APPLE) ++ set(rootcling_env ${rootcling_env} DYLD_LIBRARY_PATH=${rootcling_libdir}:$ENV{DYLD_LIBRARY_PATH}) ++ else() ++ set(rootcling_env ${rootcling_env} LD_LIBRARY_PATH=${rootcling_libdir}:$ENV{LD_LIBRARY_PATH}) ++ endif() ++ + #---what rootcling command to use-------------------------- + if(ARG_STAGE1) + if(MSVC AND CMAKE_ROOTTEST_DICT) + set(command ${CMAKE_COMMAND} -E ${CMAKE_BINARY_DIR}/bin/rootcling_stage1.exe) + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $) ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} ${rootcling_stage1}) + endif() + set(ROOTCINTDEP rconfigure) + set(pcm_name) + else() + if(CMAKE_PROJECT_NAME STREQUAL ROOT) + if(MSVC AND CMAKE_ROOTTEST_DICT) +- set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/bin/rootcling.exe) ++ set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/core/rootcling_stage1/src/rootcling.exe) + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" +- "ROOTIGNOREPREFIX=1" $ -rootbuild) ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} "ROOTIGNOREPREFIX=1" ${rootcling} -rootbuild) + # Modules need RConfigure.h copied into include/. + set(ROOTCINTDEP rootcling rconfigure) + endif() + elseif(TARGET ROOT::rootcling) +- if(APPLE) +- set(command ${CMAKE_COMMAND} -E env "DYLD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{DYLD_LIBRARY_PATH}" $) +- else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${ROOT_LIBRARY_DIR}:$ENV{LD_LIBRARY_PATH}" $) +- endif() ++ set(command ${CMAKE_COMMAND} -E env ${rootcling_env} $rootcling) + else() +- set(command ${CMAKE_COMMAND} -E env rootcling) ++ set(command ${CMAKE_COMMAND} -E env ${system_include_dir_opt} rootcling) + endif() + endif() + +diff -ru a/root/CMakeLists.txt b/root/CMakeLists.txt +--- a/root/CMakeLists.txt 2024-11-14 10:27:26.000000000 +0100 ++++ b/root/CMakeLists.txt 2025-01-31 11:01:18.352881145 +0100 +@@ -531,6 +531,16 @@ + get_property(__pch_dependencies GLOBAL PROPERTY ROOT_PCH_DEPENDENCIES) + get_property(__pch_dictionaries GLOBAL PROPERTY ROOT_PCH_DICTIONARIES) + ++ if(NATIVE_BINARY_DIR) ++ set(rootcling_env "LLVM_SYMBOLIZER_PATH=${NATIVE_BINARY_DIR}/tools/llvm-symbolizer") ++ else() ++ set(rootcling_dir "") ++ endif() ++ ++ if(CLING_SYSTEM_INCLUDE_PATH) ++ set(rootcling_env ${rootcling_env} "CPLUS_INCLUDE_PATH=${CLING_SYSTEM_INCLUDE_PATH}") ++ endif() ++ + add_custom_command(OUTPUT etc/allDict.cxx.pch + BYPRODUCTS + etc/dictpch/allCppflags.txt +@@ -540,7 +550,7 @@ + ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py + ${CMAKE_SOURCE_DIR} . ${pyroot_legacy} ${__cling_pch} + COMMAND +- ${CMAKE_COMMAND} -E env ROOTIGNOREPREFIX=1 ${Python3_EXECUTABLE} ++ ${CMAKE_COMMAND} -E env ${rootcling_env} ROOTIGNOREPREFIX=1 ${Python3_EXECUTABLE} + ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py etc/allDict.cxx.pch + ${__allIncludes} -I${CMAKE_BINARY_DIR}/include -I${CMAKE_SOURCE_DIR}/core + DEPENDS +Only in b/root: CMakeLists.txt.orig +diff -ru a/root/etc/dictpch/makepch.py b/root/etc/dictpch/makepch.py +--- a/root/etc/dictpch/makepch.py 2024-11-14 10:27:26.000000000 +0100 ++++ b/root/etc/dictpch/makepch.py 2025-01-31 11:01:18.347880996 +0100 +@@ -82,8 +82,6 @@ + cppFlags = getCppFlags(cppflagsFilename) + + cppflagsList=["-D__CLING__", +- "-D__STDC_LIMIT_MACROS", +- "-D__STDC_CONSTANT_MACROS", + "-DROOT_PCH", + "-I%s" %os.path.join(rootdir,"include"), + "-I%s" %os.path.join(rootdir,"etc"), +diff -ru a/root/interpreter/cling/lib/Interpreter/Interpreter.cpp b/root/interpreter/cling/lib/Interpreter/Interpreter.cpp +--- a/root/interpreter/cling/lib/Interpreter/Interpreter.cpp 2024-11-14 10:27:26.000000000 +0100 ++++ b/root/interpreter/cling/lib/Interpreter/Interpreter.cpp 2025-01-31 11:01:18.355881235 +0100 +@@ -67,6 +67,30 @@ + + using namespace clang; + ++ ++// For cross-compilation, TARGET_GLIBC should be set when invoking ++// the compiler to 0 or 1, depending if target is using glibc. ++// It is set automatically for normal compilation. ++#if !defined(TARGET_GLIBC) ++# ifdef __GLIBC__ ++# define TARGET_GLIBC 1 ++# else ++# define TARGET_GLIBC 0 ++# endif ++#endif ++ ++// For cross-compilation, TARGET_GLIBCXX should be set when invoking ++// the compiler to 0 or 1, depending if target is using GNU libstdc++. ++// It is set automatically for normal compilation. ++#if !defined(TARGET_GLIBCXX) ++# ifdef __GLIBCXX__ ++# define TARGET_GLIBCXX 1 ++# else ++# define TARGET_GLIBCXX 0 ++# endif ++#endif ++ ++ + namespace { + + static void registerCxaAtExitHelper(void *Self, void (*F)(void *), void *Ctx, +@@ -460,7 +484,7 @@ + + // Intercept all atexit calls, as the Interpreter and functions will be long + // gone when the -native- versions invoke them. +-#if defined(__GLIBC__) ++#if TARGET_GLIBC + const char* LinkageCxx = "extern \"C++\""; + const char* Attr = LangOpts.CPlusPlus ? " throw () " : ""; + #else +@@ -468,7 +492,7 @@ + const char* Attr = ""; + #endif + +-#if defined(__GLIBCXX__) ++#if TARGET_GLIBCXX + const char* cxa_atexit_is_noexcept = LangOpts.CPlusPlus ? " noexcept" : ""; + #else + const char* cxa_atexit_is_noexcept = ""; diff --git a/R/ROOT/bundled/patches/x86_64-linux-gnu-variant.patch b/R/ROOT/bundled/patches/x86_64-linux-gnu-variant.patch new file mode 100644 index 00000000000..4dce931344f --- /dev/null +++ b/R/ROOT/bundled/patches/x86_64-linux-gnu-variant.patch @@ -0,0 +1,11 @@ +--- a/opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/9.1.0/variant ++++ b/opt/x86_64-linux-gnu/x86_64-linux-gnu/include/c++/9.1.0/variant +@@ -1556,7 +1556,7 @@ + #endif + + template +- friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); ++ friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v) noexcept; + + template + friend void* __detail::__variant::__get_storage(_Vp&& __v); diff --git a/R/ROOT/bundled/patches/x86_64-linux-musl-variant.patch b/R/ROOT/bundled/patches/x86_64-linux-musl-variant.patch new file mode 100644 index 00000000000..b3b34018419 --- /dev/null +++ b/R/ROOT/bundled/patches/x86_64-linux-musl-variant.patch @@ -0,0 +1,11 @@ +--- /opt/x86_64-linux-musl/bin/../lib/gcc/x86_64-linux-musl/9.1.0/../../../../x86_64-linux-musl/include/c++/9.1.0/variant.orig ++++ /opt/x86_64-linux-musl/bin/../lib/gcc/x86_64-linux-musl/9.1.0/../../../../x86_64-linux-musl/include/c++/9.1.0/variant +@@ -1556,7 +1556,7 @@ + #endif + + template +- friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v); ++ friend constexpr decltype(auto) __detail::__variant::__get(_Vp&& __v) noexcept; + + template + friend void* __detail::__variant::__get_storage(_Vp&& __v);