From b618f30f32489987f87152f37522c1085d9abc1b Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Thu, 22 Aug 2024 16:07:45 +0200 Subject: [PATCH 1/5] Merge branch 'ROOT-1' --- R/ROOT/build_tarballs.jl | 147 +++++++++++++ .../patches/rootcling-cross-compile.patch | 197 ++++++++++++++++++ 2 files changed, 344 insertions(+) create mode 100644 R/ROOT/build_tarballs.jl create mode 100644 R/ROOT/bundled/patches/rootcling-cross-compile.patch diff --git a/R/ROOT/build_tarballs.jl b/R/ROOT/build_tarballs.jl new file mode 100644 index 00000000000..4382bf14e8e --- /dev/null +++ b/R/ROOT/build_tarballs.jl @@ -0,0 +1,147 @@ +# 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.2" + +# Collection of sources required to complete build +sources = [ + ArchiveSource("https://root.cern/download/root_v6.32.02.source.tar.gz", "3d0f76bf05857e1807ccfb2c9e014f525bcb625f94a2370b455f4b164961602d"), + DirectorySource("./bundled") +] + +# Bash recipe for building across all platforms +script = raw""" + +cd $WORKSPACE +install_license srcdir/root-*/LICENSE + +# Release type and C++ standard +CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=Release) +CMAKE_FLAGS+=(-DCMAKE_CXX_STANDARD=17) + +# ROOT options to enable/disable +CMAKE_FLAGS+=(-Dgnuinstall=OFF) +CMAKE_FLAGS+=(-Drpath=ON) +CMAKE_FLAGS+=(-Dshared=ON) +CMAKE_FLAGS+=(-Dsoversion=OFF) +CMAKE_FLAGS+=(-Dfail-on-missing=ON) +CMAKE_FLAFS+=(-Dbuiltin_afterimage=ON) +CMAKE_FLAGS+=(-Druntime_cxxmodules=OFF) + +# LLVM tries to run a bunch of configure tests. Tell it what the output would have been. +CMAKE_FLAGS+=(-Dfound_urandom_EXITCODE=0) +CMAKE_FLAGS+=(-Dfound_urandom_EXITCODE__TRYRUN_OUTPUT='') + +export SYSTEM_INCLUDE_PATH= /opt/$MACHTYPE/$MACHTYPE/sys-root/usr/include:/opt/$MACHTYPE/$MACHTYPE/sys-root/usr/local/include +export CPLUS_INCLUDE_PATH=$SYSTEM_INCLUDE_PATH # Needed for the native build (musl) + +#---Build host native rootcling, llvm-tblgen, clang-tblgen for cross-compilation------------------------ +if [ $target != $MACHTYPE ]; then + # Patch the sources to use the native binary for rootcling + (cd srcdir/root-*/ + atomic_patch -p2 ../patches/rootcling-cross-compile.patch + ) + + # Build for the host binary native used in second step build process + mkdir native + cmake -GNinja -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_HOST_TOOLCHAIN} \ + -DLLVM_HOST_TRIPLE=$MACHTYPE \ + -DLLVM_DEFAULT_TARGET_TRIPLE=$target \ + -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF \ + -DCMAKE_PREFIX_PATH=$host_prefix \ + -DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath-link,$host_prefix/lib \ + -Dminimal=ON \ + ${CMAKE_FLAGS[@]} \ + -B native -S srcdir/root-*/ + ninja -C native -j${nproc} rootcling_stage1 rootcling llvm-tblgen clang-tblgen llvm-config llvm-symbolizer + + # Add extra options to use the built native binaries + CMAKE_EXTRA_OPTS+=(-DNATIVE_BINARY_DIR=$PWD/native) + CMAKE_EXTRA_OPTS+=(-DLLVM_TABLEGEN=$PWD/native/interpreter/llvm-project/llvm/bin/llvm-tblgen) + CMAKE_EXTRA_OPTS+=(-DCLANG_TABLEGEN=$PWD/native/interpreter/llvm-project/llvm/bin/clang-tblgen) + CMAKE_EXTRA_OPTS+=(-DLLVM_CONFIG_PATH=$PWD/native/interpreter/llvm-project/llvm/bin/llvm-config) + + # Define ROOTCLINGNATIVE to use the native rootcling + export ROOTCLINGNATIVE="env CPLUS_INCLUDE_PATH=${SYSTEM_INCLUDE_PATH} $PWD/native/bin/rootcling" + + # Remove the CPLUS_INCLUDE_PATH environment variable. Was needed for the native build only + unset CPLUS_INCLUDE_PATH +fi + +#---Standard build (cross-compilation)------------------------------------------------------------- +mkdir build +cmake -GNinja \ + -DCMAKE_INSTALL_PREFIX=$prefix \ + -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \ + ${CMAKE_FLAGS[@]} \ + -Dgminimal=ON \ + ${CMAKE_EXTRA_OPTS[@]} \ + -B build -S srcdir/root-*/ +ninja -C build -j${nproc} install +""" + +# These are the platforms we will build for by default, unless further +# platforms are passed in on the command line +platforms = [ + Platform("x86_64", "linux"; libc = "glibc"), + Platform("x86_64", "linux"; libc = "musl"), + # Platform("aarch64", "linux"; libc = "glibc"), + # Platform("armv6l", "linux", libc = "glibc"), + # Platform("armv7l", "linux", libc = "glibc"), + # Platform("powerpc64le", "linux"; libc = "glibc"), + Platform("aarch64", "macos"), + # Platform("x86_64", "macos"), +] |> expand_cxxstring_abis + +# The products that we will ensure are always built +products = [ + LibraryProduct("libCore", :libCore), + LibraryProduct("libCling", :libCling), + ExecutableProduct("root", :root), +] + +# Some dependencies are needed only on Linux and FreeBSD +x11_platforms = filter(p ->Sys.islinux(p) || Sys.isfreebsd(p), platforms) + +# Dependencies that must be installed before this package can be built +dependencies = [ + BuildDependency("Xorg_xorgproto_jll"; platforms=x11_platforms) + HostBuildDependency("Zlib_jll") + HostBuildDependency("Zstd_jll") + HostBuildDependency("Lz4_jll") + HostBuildDependency("nlohmann_json_jll") + HostBuildDependency("FreeType2_jll") + HostBuildDependency("PCRE_jll") + HostBuildDependency("XZ_jll") + HostBuildDependency("xxHash_jll") + Dependency("Zlib_jll") + Dependency("Zstd_jll") + Dependency("Lz4_jll") + Dependency("nlohmann_json_jll") + Dependency("FreeType2_jll") + Dependency("PCRE_jll") + Dependency("XZ_jll") + Dependency("xxHash_jll") + Dependency("OpenSSL_jll"; compat="1.1.10") + Dependency("Xorg_libX11_jll"; platforms=x11_platforms) + Dependency("Xorg_libXpm_jll"; platforms=x11_platforms) + Dependency("Xorg_libXft_jll"; platforms=x11_platforms) + Dependency("Xorg_libICE_jll"; platforms=x11_platforms) + Dependency("Xorg_libSM_jll"; platforms=x11_platforms) + Dependency("Xorg_libXfixes_jll"; platforms=x11_platforms) + Dependency("Xorg_libXi_jll"; platforms=x11_platforms) + Dependency("Xorg_libXinerama_jll"; platforms=x11_platforms) + Dependency("Xorg_libXmu_jll"; platforms=x11_platforms) + Dependency("Xorg_libXt_jll"; platforms=x11_platforms) + Dependency("Xorg_libXtst_jll"; platforms=x11_platforms) + Dependency("Xorg_xcb_util_jll"; platforms=x11_platforms) + Dependency("Xorg_libxkbfile_jll"; platforms=x11_platforms) + #Dependency("libLVM_jll") +] + +# Build the tarballs, and possibly a `build.jl` as well. +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; + preferred_gcc_version=v"11", julia_compat="1.6") diff --git a/R/ROOT/bundled/patches/rootcling-cross-compile.patch b/R/ROOT/bundled/patches/rootcling-cross-compile.patch new file mode 100644 index 00000000000..6e6421d5fa3 --- /dev/null +++ b/R/ROOT/bundled/patches/rootcling-cross-compile.patch @@ -0,0 +1,197 @@ +--- a/root/cmake/modules/RootMacros.cmake 2024-01-31 09:17:06.000000000 +0100 ++++ c/root/cmake/modules/RootMacros.cmake 2024-06-29 18:12:28.081464326 +0200 +@@ -8,6 +8,8 @@ + # RootMacros.cmake + #--------------------------------------------------------------------------------------------------- + ++set(NATIVE_BINARY_DIR FALSE CACHE FILEPATH "Path of native built in case of cross compiling.") ++ + if(WIN32) + set(libprefix lib) + set(ld_library_path PATH) +@@ -603,20 +605,37 @@ + #---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) ++ if(NATIVE_BINARY_DIR) ++ set(command ${CMAKE_COMMAND} -E ${NATIVE_BINARY_DIR}/bin/rootcling_stage1.exe) ++ else() ++ set(command ${CMAKE_COMMAND} -E ${CMAKE_BINARY_DIR}/bin/rootcling_stage1.exe) ++ endif() + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $) ++ if(NATIVE_BINARY_DIR) ++ set(command ${CMAKE_COMMAND} -E env "CPLUS_INCLUDE_PATH=$ENV{SYSTEM_INCLUDE_PATH}" "LD_LIBRARY_PATH=${NATIVE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ${NATIVE_BINARY_DIR}/core/rootcling_stage1/src/rootcling_stage1) ++ else() ++ set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" $) ++ endif() + 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) ++ if(NATIVE_BINARY_DIR) ++ set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${NATIVE_BINARY_DIR}/bin/rootcling.exe) ++ else() ++ set(command ${CMAKE_COMMAND} -E env "ROOTIGNOREPREFIX=1" ${CMAKE_BINARY_DIR}/core/rootcling_stage1/src/rootcling.exe) ++ endif() + else() +- set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" +- "ROOTIGNOREPREFIX=1" $ -rootbuild) +- # Modules need RConfigure.h copied into include/. ++ if(NATIVE_BINARY_DIR) ++ set(command ${CMAKE_COMMAND} -E env "CPLUS_INCLUDE_PATH=$ENV{SYSTEM_INCLUDE_PATH}" "LD_LIBRARY_PATH=${NATIVE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ++ "ROOTIGNOREPREFIX=1" ${NATIVE_BINARY_DIR}/bin/rootcling -rootbuild) ++ else() ++ set(command ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib:$ENV{LD_LIBRARY_PATH}" ++ "ROOTIGNOREPREFIX=1" $ -rootbuild) ++ endif() ++ # Modules need RConfigure.h copied into include/. + set(ROOTCINTDEP rootcling rconfigure) + endif() + elseif(TARGET ROOT::rootcling) + +--- a/root/CMakeLists.txt ++++ b/root/CMakeLists.txt +@@ -547,9 +547,11 @@ else() + ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py + ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py + ) +- add_custom_target(onepcm ALL DEPENDS etc/allDict.cxx.pch) +- install(FILES ${CMAKE_BINARY_DIR}/etc/allDict.cxx.pch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) +- install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/dictpch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) ++ if(NOT CMAKE_CROSSCOMPILING) ++ add_custom_target(onepcm ALL DEPENDS etc/allDict.cxx.pch) ++ install(FILES ${CMAKE_BINARY_DIR}/etc/allDict.cxx.pch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) ++ install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/dictpch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) ++ endif() + endif() + + # FIXME: move installation of PCMS in ROOT_GENERATE_DICTIONARY(). +@@ -601,24 +603,26 @@ if(runtime_cxxmodules) + endif() + + #---hsimple.root---------(use the executable for clearer dependencies and proper return code)--- +-add_custom_target(hsimple ALL DEPENDS tutorials/hsimple.root) +-add_dependencies(hsimple onepcm) +-if(WIN32) +- add_custom_command(OUTPUT tutorials/hsimple.root +- COMMAND set PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && +- set ROOTIGNOREPREFIX=1 && set ROOT_HIST=0 && +- $ -l -q -b -n -x hsimple.C -e return +- WORKING_DIRECTORY tutorials +- DEPENDS $ Cling Hist Tree Gpad Graf HistPainter move_artifacts) +-else() +- add_custom_command(OUTPUT tutorials/hsimple.root +- COMMAND ${MODULES_ROOT_INCPATH} ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{${ld_library_path}} +- ROOTIGNOREPREFIX=1 ROOT_HIST=0 +- $ -l -q -b -n -x hsimple.C -e return +- WORKING_DIRECTORY tutorials +- DEPENDS $ Cling Hist Tree Gpad Graf HistPainter move_artifacts) ++if(NOT CMAKE_CROSSCOMPILING) ++ add_custom_target(hsimple ALL DEPENDS tutorials/hsimple.root) ++ add_dependencies(hsimple onepcm) ++ if(WIN32) ++ add_custom_command(OUTPUT tutorials/hsimple.root ++ COMMAND set PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY} && ++ set ROOTIGNOREPREFIX=1 && set ROOT_HIST=0 && ++ $ -l -q -b -n -x hsimple.C -e return ++ WORKING_DIRECTORY tutorials ++ DEPENDS $ Cling Hist Tree Gpad Graf HistPainter move_artifacts) ++ else() ++ add_custom_command(OUTPUT tutorials/hsimple.root ++ COMMAND ${MODULES_ROOT_INCPATH} ${ld_library_path}=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}:$ENV{${ld_library_path}} ++ ROOTIGNOREPREFIX=1 ROOT_HIST=0 ++ $ -l -q -b -n -x hsimple.C -e return ++ WORKING_DIRECTORY tutorials ++ DEPENDS $ Cling Hist Tree Gpad Graf HistPainter move_artifacts) ++ endif() ++ install(FILES ${CMAKE_BINARY_DIR}/tutorials/hsimple.root DESTINATION ${CMAKE_INSTALL_TUTDIR} COMPONENT tests) + endif() +-install(FILES ${CMAKE_BINARY_DIR}/tutorials/hsimple.root DESTINATION ${CMAKE_INSTALL_TUTDIR} COMPONENT tests) + + if(runtime_cxxmodules) + add_dependencies(hsimple modules_idx) +@@ -805,4 +809,6 @@ Linker flags: + ROOT_SHOW_ENABLED_OPTIONS() + + #---Packaging------------------------------------------------------------------------------------- +-include(RootCPack) ++if(NOT CMAKE_CROSSCOMPILING) ++ include(RootCPack) ++endif() +--- a/root/cmake/modules/SetUpMacOS.cmake ++++ b/root/cmake/modules/SetUpMacOS.cmake +@@ -113,15 +113,14 @@ endif() + + #---Avoid using a x86_64 Ninja executable with on a arm64 MacOS + #---This issue leads to the external being build for x86_64 instead of arm64 +-execute_process(COMMAND lipo -archs ${CMAKE_MAKE_PROGRAM} OUTPUT_VARIABLE _NINJA_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) +-if(CMAKE_GENERATOR MATCHES Ninja) +- +- set( _NINJA_ARCH_LIST ${_NINJA_ARCH} ) +- separate_arguments(_NINJA_ARCH_LIST) # This replace space with semi-colons +- if (NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" IN_LIST _NINJA_ARCH_LIST) +- message(FATAL_ERROR +- " ${CMAKE_MAKE_PROGRAM} does not support ${CMAKE_HOST_SYSTEM_PROCESSOR}.\n" +- " It only supports ${_NINJA_ARCH_LIST}.\n" +- " Downloading the latest version of Ninja might solve the problem.\n") +- endif() +-endif() ++#execute_process(COMMAND lipo -archs ${CMAKE_MAKE_PROGRAM} OUTPUT_VARIABLE _NINJA_ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) ++#if(CMAKE_GENERATOR MATCHES Ninja) ++# set( _NINJA_ARCH_LIST ${_NINJA_ARCH} ) ++# separate_arguments(_NINJA_ARCH_LIST) # This replace space with semi-colons ++# if (NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" IN_LIST _NINJA_ARCH_LIST) ++# message(FATAL_ERROR ++# " ${CMAKE_MAKE_PROGRAM} does not support ${CMAKE_HOST_SYSTEM_PROCESSOR}.\n" ++# " It only supports ${_NINJA_ARCH_LIST}.\n" ++# " Downloading the latest version of Ninja might solve the problem.\n") ++# endif() ++#endif() +--- a/root/cmake/modules/SearchInstalledSoftware.cmake ++++ b/root/cmake/modules/SearchInstalledSoftware.cmake +@@ -37,7 +37,9 @@ endif() + if(cocoa) + if(APPLE) + set(x11 OFF CACHE BOOL "Disabled because cocoa requested (${x11_description})" FORCE) +- set(builtin_freetype ON CACHE BOOL "Enabled because needed for Cocoa graphics (${builtin_freetype_description})" FORCE) ++ if(NOT CMAKE_CROSSCOMPILING) # leave freetype as external on cross-compiling ++ set(builtin_freetype ON CACHE BOOL "Enabled because needed for Cocoa graphics (${builtin_freetype_description})" FORCE) ++ endif() + else() + message(STATUS "Cocoa option can only be enabled on MacOSX platform") + set(cocoa OFF CACHE BOOL "Disabled because only available on MacOSX (${cocoa_description})" FORCE) +--- a/root/etc/dictpch/makepch.py ++++ b/root/etc/dictpch/makepch.py +@@ -99,7 +99,12 @@ def makepch(): + allheadersFilename.replace("\\","/") + alllinkdefsFilename.replace("\\","/") + +- rootclingExe = os.path.join(rootdir,"bin","rootcling") ++ if "ROOTCLINGNATIVE" in os.environ: ++ rootclingExe = os.environ["ROOTCLINGNATIVE"] ++ crosscomp = True ++ else: ++ rootclingExe = os.path.join(rootdir,"bin","rootcling") ++ crosscomp = False + command = "%s %s -generate-pch -f allDict.cxx -noDictSelection %s %s %s %s" %(rootclingExe, + rootbuildFlag, + allCppFlags, +@@ -111,9 +116,10 @@ def makepch(): + print(command) + + my_env = os.environ.copy() +- existing_ldlib = my_env.get("LD_LIBRARY_PATH") +- if not existing_ldlib: existing_ldlib = "" +- my_env["LD_LIBRARY_PATH"] = os.path.join(rootdir, "lib") + ":" + existing_ldlib ++ if not crosscomp: ++ existing_ldlib = my_env.get("LD_LIBRARY_PATH") ++ if not existing_ldlib: existing_ldlib = "" ++ my_env["LD_LIBRARY_PATH"] = os.path.join(rootdir, "lib") + ":" + existing_ldlib + + ret = subprocess.call(command.split(), env=my_env) + if ret == 0: From a503434165b0e25f2c61b4d13c6031fb3f67cc6f Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Fri, 23 Aug 2024 15:00:54 +0200 Subject: [PATCH 2/5] Added more library products --- R/ROOT/build_tarballs.jl | 57 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/R/ROOT/build_tarballs.jl b/R/ROOT/build_tarballs.jl index 4382bf14e8e..64b5a3a2764 100644 --- a/R/ROOT/build_tarballs.jl +++ b/R/ROOT/build_tarballs.jl @@ -34,7 +34,7 @@ CMAKE_FLAGS+=(-Druntime_cxxmodules=OFF) CMAKE_FLAGS+=(-Dfound_urandom_EXITCODE=0) CMAKE_FLAGS+=(-Dfound_urandom_EXITCODE__TRYRUN_OUTPUT='') -export SYSTEM_INCLUDE_PATH= /opt/$MACHTYPE/$MACHTYPE/sys-root/usr/include:/opt/$MACHTYPE/$MACHTYPE/sys-root/usr/local/include +export SYSTEM_INCLUDE_PATH="`$MACHTYPE-g++ --sysroot="/opt/$MACHTYPE/$MACHTYPE/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}'`" export CPLUS_INCLUDE_PATH=$SYSTEM_INCLUDE_PATH # Needed for the native build (musl) #---Build host native rootcling, llvm-tblgen, clang-tblgen for cross-compilation------------------------ @@ -60,8 +60,8 @@ if [ $target != $MACHTYPE ]; then # Add extra options to use the built native binaries CMAKE_EXTRA_OPTS+=(-DNATIVE_BINARY_DIR=$PWD/native) - CMAKE_EXTRA_OPTS+=(-DLLVM_TABLEGEN=$PWD/native/interpreter/llvm-project/llvm/bin/llvm-tblgen) - CMAKE_EXTRA_OPTS+=(-DCLANG_TABLEGEN=$PWD/native/interpreter/llvm-project/llvm/bin/clang-tblgen) + CMAKE_EXTRA_OPTS+=(-DLLVM_TABLEGEN_EXE=$PWD/native/interpreter/llvm-project/llvm/bin/llvm-tblgen) + CMAKE_EXTRA_OPTS+=(-DCLANG_TABLEGEN_EXE=$PWD/native/interpreter/llvm-project/llvm/bin/clang-tblgen) CMAKE_EXTRA_OPTS+=(-DLLVM_CONFIG_PATH=$PWD/native/interpreter/llvm-project/llvm/bin/llvm-config) # Define ROOTCLINGNATIVE to use the native rootcling @@ -98,9 +98,56 @@ platforms = [ # The products that we will ensure are always built products = [ - LibraryProduct("libCore", :libCore), - LibraryProduct("libCling", :libCling), ExecutableProduct("root", :root), + LibraryProduct("libCling", :libCling; dont_dlopen=true), + LibraryProduct("libCore", :libCore; dont_dlopen=true), + LibraryProduct("libEG", :libEG; dont_dlopen=true), + LibraryProduct("libFitPanel", :libFitPanel; dont_dlopen=true), + LibraryProduct("libFoam", :libFoam; dont_dlopen=true), + LibraryProduct("libFumili", :libFumili; dont_dlopen=true), + LibraryProduct("libGed", :libGed; dont_dlopen=true), + LibraryProduct("libGenVector", :libGenVector; dont_dlopen=true), + LibraryProduct("libGeomBuilder", :libGeomBuilder; dont_dlopen=true), + LibraryProduct("libGeomPainter", :libGeomPainter; dont_dlopen=true), + LibraryProduct("libGeom", :libGeom; dont_dlopen=true), + LibraryProduct("libGpad", :libGpad; dont_dlopen=true), + LibraryProduct("libGraf3d", :libGraf3d; dont_dlopen=true), + LibraryProduct("libGraf", :libGraf; dont_dlopen=true), + LibraryProduct("libGuiBld", :libGuiBld; dont_dlopen=true), + LibraryProduct("libGuiHtml", :libGuiHtml; dont_dlopen=true), + LibraryProduct("libGui", :libGui; dont_dlopen=true), + LibraryProduct("libGX11", :libGX11; dont_dlopen=true), + LibraryProduct("libGX11TTF", :libGX11TTF; dont_dlopen=true), + LibraryProduct("libHistPainter", :libHistPainter; dont_dlopen=true), + LibraryProduct("libHist", :libHist; dont_dlopen=true), + LibraryProduct("libHtml", :libHtml; dont_dlopen=true), + LibraryProduct("libImt", :libImt; dont_dlopen=true), + LibraryProduct("libMathCore", :libMathCore; dont_dlopen=true), + LibraryProduct("libMatrix", :libMatrix; dont_dlopen=true), + LibraryProduct("libMinuit2", :libMinuit2; dont_dlopen=true), + LibraryProduct("libMinuit", :libMinuit; dont_dlopen=true), + LibraryProduct("libMLP", :libMLP; dont_dlopen=true), + LibraryProduct("libMultiProc", :libMultiProc; dont_dlopen=true), + LibraryProduct("libNet", :libNet; dont_dlopen=true), + LibraryProduct("libNew", :libNew; dont_dlopen=true), + LibraryProduct("libPhysics", :libPhysics; dont_dlopen=true), + LibraryProduct("libPostscript", :libPostscript; dont_dlopen=true), + LibraryProduct("libQuadp", :libQuadp; dont_dlopen=true), + LibraryProduct("libRCsg", :libRCsg; dont_dlopen=true), + LibraryProduct("libRecorder", :libRecorder; dont_dlopen=true), + LibraryProduct("libRint", :libRint; dont_dlopen=true), + LibraryProduct("libRIO", :libRIO; dont_dlopen=true), + LibraryProduct("libRootAuth", :libRootAuth; dont_dlopen=true), + LibraryProduct("libROOTVecOps", :libROOTVecOps; dont_dlopen=true), + LibraryProduct("libSmatrix", :libSmatrix; dont_dlopen=true), + LibraryProduct("libSPlot", :libSPlot; dont_dlopen=true), + LibraryProduct("libSQLIO", :libSQLIO; dont_dlopen=true), + LibraryProduct("libThread", :libThread; dont_dlopen=true), + LibraryProduct("libTreePlayer", :libTreePlayer; dont_dlopen=true), + LibraryProduct("libTree", :libTree; dont_dlopen=true), + LibraryProduct("libTreeViewer", :libTreeViewer; dont_dlopen=true), + LibraryProduct("libX3d", :libX3d; dont_dlopen=true), + LibraryProduct("libXMLIO", :libXMLIO; dont_dlopen=true) ] # Some dependencies are needed only on Linux and FreeBSD From 19cf8bfee6a8a2e08d96f26800623dfab85ca3dc Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Fri, 23 Aug 2024 16:34:18 +0200 Subject: [PATCH 3/5] Build the global PCH --- .../patches/rootcling-cross-compile.patch | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/R/ROOT/bundled/patches/rootcling-cross-compile.patch b/R/ROOT/bundled/patches/rootcling-cross-compile.patch index 6e6421d5fa3..fa159a12b0c 100644 --- a/R/ROOT/bundled/patches/rootcling-cross-compile.patch +++ b/R/ROOT/bundled/patches/rootcling-cross-compile.patch @@ -54,24 +54,9 @@ endif() elseif(TARGET ROOT::rootcling) ---- a/root/CMakeLists.txt -+++ b/root/CMakeLists.txt -@@ -547,9 +547,11 @@ else() - ${CMAKE_SOURCE_DIR}/build/unix/makepchinput.py - ${CMAKE_SOURCE_DIR}/etc/dictpch/makepch.py - ) -- add_custom_target(onepcm ALL DEPENDS etc/allDict.cxx.pch) -- install(FILES ${CMAKE_BINARY_DIR}/etc/allDict.cxx.pch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) -- install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/dictpch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) -+ if(NOT CMAKE_CROSSCOMPILING) -+ add_custom_target(onepcm ALL DEPENDS etc/allDict.cxx.pch) -+ install(FILES ${CMAKE_BINARY_DIR}/etc/allDict.cxx.pch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) -+ install(DIRECTORY ${CMAKE_BINARY_DIR}/etc/dictpch DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}) -+ endif() - endif() - - # FIXME: move installation of PCMS in ROOT_GENERATE_DICTIONARY(). -@@ -601,24 +603,26 @@ if(runtime_cxxmodules) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -601,24 +601,26 @@ if(runtime_cxxmodules) endif() #---hsimple.root---------(use the executable for clearer dependencies and proper return code)--- @@ -115,7 +100,7 @@ if(runtime_cxxmodules) add_dependencies(hsimple modules_idx) -@@ -805,4 +809,6 @@ Linker flags: +@@ -805,4 +807,6 @@ Linker flags: ROOT_SHOW_ENABLED_OPTIONS() #---Packaging------------------------------------------------------------------------------------- From 423106811f821e2367796ae0c2ea740b5ccc2db3 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Fri, 23 Aug 2024 16:37:44 +0200 Subject: [PATCH 4/5] typo in patch --- R/ROOT/bundled/patches/rootcling-cross-compile.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/ROOT/bundled/patches/rootcling-cross-compile.patch b/R/ROOT/bundled/patches/rootcling-cross-compile.patch index fa159a12b0c..0ad3948f06b 100644 --- a/R/ROOT/bundled/patches/rootcling-cross-compile.patch +++ b/R/ROOT/bundled/patches/rootcling-cross-compile.patch @@ -54,8 +54,8 @@ endif() elseif(TARGET ROOT::rootcling) ---- a/CMakeLists.txt -+++ b/CMakeLists.txt +--- a/root/CMakeLists.txt ++++ b/root/CMakeLists.txt @@ -601,24 +601,26 @@ if(runtime_cxxmodules) endif() From 717866fc02033e0ea90fd760d8889ed87f520407 Mon Sep 17 00:00:00 2001 From: Pere Mato Date: Wed, 4 Sep 2024 11:28:03 +0200 Subject: [PATCH 5/5] Temporary fix for host local prefix to simplify recipe --- R/ROOT/build_tarballs.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/ROOT/build_tarballs.jl b/R/ROOT/build_tarballs.jl index 64b5a3a2764..2303b9257b7 100644 --- a/R/ROOT/build_tarballs.jl +++ b/R/ROOT/build_tarballs.jl @@ -43,16 +43,16 @@ if [ $target != $MACHTYPE ]; then (cd srcdir/root-*/ atomic_patch -p2 ../patches/rootcling-cross-compile.patch ) + # host $sysroot/local should point to $host_prefix (issue BinaryBuilder) + rm /opt/$MACHTYPE/$MACHTYPE/sys-root/usr/local + ln -s $host_prefix /opt/$MACHTYPE/$MACHTYPE/sys-root/usr/local # Build for the host binary native used in second step build process mkdir native cmake -GNinja -DCMAKE_INSTALL_PREFIX=$prefix \ -DCMAKE_TOOLCHAIN_FILE=${CMAKE_HOST_TOOLCHAIN} \ -DLLVM_HOST_TRIPLE=$MACHTYPE \ - -DLLVM_DEFAULT_TARGET_TRIPLE=$target \ - -DCMAKE_FIND_USE_CMAKE_SYSTEM_PATH=OFF \ - -DCMAKE_PREFIX_PATH=$host_prefix \ - -DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath-link,$host_prefix/lib \ + -DLLVM_TARGET_TRIPLE=$target \ -Dminimal=ON \ ${CMAKE_FLAGS[@]} \ -B native -S srcdir/root-*/