From 8dd0ae4d5487b3ecba05d8170b2e323ba8bc06ee Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Mon, 9 Feb 2026 22:45:58 +0100 Subject: [PATCH 1/2] Revert "[build] Add extra RPATH to test library created with CompileMacro" This reverts commit df8b468acfab02161cbbbbbd5c0617bb8498a68e. --- cmake/modules/RootMacros.cmake | 12 ++---------- roottest/root/io/arrayobject/CMakeLists.txt | 2 -- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/cmake/modules/RootMacros.cmake b/cmake/modules/RootMacros.cmake index 87c95d2e7ddf3..1fc36f5899169 100644 --- a/cmake/modules/RootMacros.cmake +++ b/cmake/modules/RootMacros.cmake @@ -2482,8 +2482,7 @@ endfunction(ROOTTEST_ADD_AUTOMACROS) #------------------------------------------------------------------------------- # # macro ROOTTEST_COMPILE_MACRO( [BUILDOBJ object] [BUILDLIB lib] -# [FIXTURES_SETUP ...] [FIXTURES_CLEANUP ...] [FIXTURES_REQUIRED ...] -# [EXTRA_RPATHS ...]) +# [FIXTURES_SETUP ...] [FIXTURES_CLEANUP ...] [FIXTURES_REQUIRED ...]) # # This macro creates and loads a shared library containing the code from # the file . A test that performs the compilation is created. @@ -2493,7 +2492,7 @@ endfunction(ROOTTEST_ADD_AUTOMACROS) # #------------------------------------------------------------------------------- macro(ROOTTEST_COMPILE_MACRO filename) - CMAKE_PARSE_ARGUMENTS(ARG "" "BUILDOBJ;BUILDLIB" "FIXTURES_SETUP;FIXTURES_CLEANUP;FIXTURES_REQUIRED;EXTRA_RPATHS" ${ARGN}) + CMAKE_PARSE_ARGUMENTS(ARG "" "BUILDOBJ;BUILDLIB" "FIXTURES_SETUP;FIXTURES_CLEANUP;FIXTURES_REQUIRED" ${ARGN}) # Add defines to root_compile_macro, in order to have out-of-source builds # when using the scripts/build.C macro. @@ -2508,18 +2507,11 @@ macro(ROOTTEST_COMPILE_MACRO filename) endforeach() cmake_path(CONVERT "${CMAKE_CURRENT_BINARY_DIR}" TO_NATIVE_PATH_LIST NATIVE_BINARY_DIR) - if(ARG_EXTRA_RPATHS) - set(extra_rpaths) - foreach(rpath ${ARG_EXTRA_RPATHS}) - list(APPEND extra_rpaths -e "gSystem->SetMakeSharedLib(TString{gSystem->GetMakeSharedLib()}.ReplaceAll(\"$RPath\", \"$RPath -Wl,-rpath,${rpath}\"))") - endforeach() - endif() set(root_compile_macro ${CMAKE_COMMAND} -E env ROOT_LIBRARY_PATH=${NATIVE_BINARY_DIR} ROOT_INCLUDE_PATH=${CMAKE_CURRENT_BINARY_DIR}:${DEFAULT_ROOT_INCLUDE_PATH} ${ROOT_root_CMD} -e "gSystem->SetBuildDir(\"${CMAKE_CURRENT_BINARY_DIR}\", true)" - ${extra_rpaths} ${RootMacroDirDefines} -q -b ) diff --git a/roottest/root/io/arrayobject/CMakeLists.txt b/roottest/root/io/arrayobject/CMakeLists.txt index 2aaf64961bb64..60efffe130f1a 100644 --- a/roottest/root/io/arrayobject/CMakeLists.txt +++ b/roottest/root/io/arrayobject/CMakeLists.txt @@ -3,13 +3,11 @@ ROOTTEST_COMPILE_MACRO(foo.C ROOTTEST_COMPILE_MACRO(bar.C BUILDLIB foo_C - EXTRA_RPATHS ${CMAKE_CURRENT_BINARY_DIR} FIXTURES_REQUIRED root-io-arrayobject-foo-fixture FIXTURES_SETUP root-io-arrayobject-bar-fixture) ROOTTEST_COMPILE_MACRO(main.C BUILDLIB bar_C - EXTRA_RPATHS ${CMAKE_CURRENT_BINARY_DIR} FIXTURES_REQUIRED root-io-arrayobject-bar-fixture FIXTURES_SETUP root-io-arrayobject-main-fixture) From 03387dfab2f4702e18091d593f9ba57eb500acb1 Mon Sep 17 00:00:00 2001 From: Vincenzo Eduardo Padulano Date: Mon, 9 Feb 2026 23:23:01 +0100 Subject: [PATCH 2/2] [core] Avoid need for setting RPATH with multiple dependent ACLiC libraries By adding the directory where ACLiC is generating the shared library to its RPATH, we can enable use cases of creating multiple shared libraries via ACLiC that depend on each other within the same session. Such functionality is embodied by the tests found in roottest/root/io/arrayobject directory and was previously working, so now it is restored while still keeping the same RPATH-based approach. --- core/base/src/TSystem.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/core/base/src/TSystem.cxx b/core/base/src/TSystem.cxx index 018ea869ed8eb..9df99712e9c0c 100644 --- a/core/base/src/TSystem.cxx +++ b/core/base/src/TSystem.cxx @@ -3736,7 +3736,12 @@ int TSystem::CompileMacro(const char *filename, Option_t *opt, cmd.ReplaceAll("\"$BuildDir","$BuildDir"); cmd.ReplaceAll("$BuildDir","\"$BuildDir\""); cmd.ReplaceAll("$BuildDir",build_loc); - cmd.ReplaceAll("$RPath", "-Wl,-rpath," + gROOT->GetSharedLibDir()); + // Add relevant directories to RPATH: + // - Directory with all the ROOT libraries. + // - Directory where this shared library is being created. This enables creating multiple + // libraries via ACLiC in the same session and have them depend on each other without + // the need to set further environment variables. + cmd.ReplaceAll("$RPath", "-Wl,-rpath," + gROOT->GetSharedLibDir() + " -Wl,-rpath," + build_loc); TString optdebFlags; if (mode & kDebug) optdebFlags = fFlagsDebug + " ";