Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/root-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
- platform: mac-beta
is_special: true
arch: ARM64
overrides: ["gnuinstall=ON"]

runs-on: # Using '[self-hosted, ..., ...]' does not work for some reason :)
- self-hosted
Expand Down Expand Up @@ -400,8 +401,8 @@ jobs:
overrides: ["runtime_cxxmodules=Off"]
- image: alma9
is_special: true
property: march_native
overrides: ["CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_CXX_FLAGS=-march=native", "CMAKE_C_FLAGS=-march=native", "builtin_zlib=ON", "builtin_zstd=ON"]
property: "march_native, gnuinstall"
overrides: ["CMAKE_BUILD_TYPE=RelWithDebInfo", "CMAKE_CXX_FLAGS=-march=native", "CMAKE_C_FLAGS=-march=native", "builtin_zlib=ON", "builtin_zstd=ON", "gnuinstall=ON"]
- image: alma9
is_special: true
property: arm64
Expand Down
8 changes: 8 additions & 0 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ add_custom_target(rconfigure ALL DEPENDS ${CMAKE_BINARY_DIR}/include/RConfigure.

ROOT_LINKER_LIBRARY(Core BUILTINS LZMA)

# This sets RUNPATH for libCore, which enables it to dlopen any ROOT library in its directory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very good addition in any case 👍

# If omitted, Core might try to load libraries from a ROOT that's installed in the system.
if(APPLE)
set_property(TARGET Core APPEND PROPERTY @loader_path)
elseif(NOT WIN32)
set_property(TARGET Core APPEND PROPERTY BUILD_RPATH $ORIGIN)
endif()

generateHeader(Core
${CMAKE_SOURCE_DIR}/core/base/src/root-argparse.py
${CMAKE_BINARY_DIR}/ginclude/TApplicationCommandLineOptionsHelp.h
Expand Down
19 changes: 17 additions & 2 deletions core/unix/src/TUnixSystem.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -4684,7 +4684,22 @@ static const char *DynamicPath(const char *newpath = nullptr, Bool_t reset = kFA
dynpath_syspart = "/usr/local/lib:/usr/X11R6/lib:/usr/lib:/lib:";
dynpath_syspart += "/lib/x86_64-linux-gnu:/usr/local/lib64:/usr/lib64:/lib64:";
#else
// trick to get the system search path
// Generally, ROOT libraries are in the same directory as libCore. We can therefore use its current
// location to speed up most library searches.
{
void *handle = dlopen("libCore.so", RTLD_LAZY | RTLD_NOLOAD);
if (handle) {
char buf[PATH_MAX+1];
buf[PATH_MAX] = 0;
auto result = dlinfo(handle, RTLD_DI_ORIGIN, buf);
if (result == 0) {
dynpath_syspart = buf;
dynpath_syspart += ':';
}
dlclose(handle);
}
}
// If the above doesn't work, one can fall back to ld search paths:
std::string cmd("LD_DEBUG=libs LD_PRELOAD=DOESNOTEXIST ls 2>&1");
FILE *pf = popen(cmd.c_str (), "r");
std::string result = "";
Expand All @@ -4700,7 +4715,7 @@ static const char *DynamicPath(const char *newpath = nullptr, Bool_t reset = kFA
from += 12;
std::string sys_path = result.substr(from, to-from);
sys_path.erase(std::remove_if(sys_path.begin(), sys_path.end(), isspace), sys_path.end());
dynpath_syspart = sys_path.c_str();
dynpath_syspart += sys_path.c_str();
}
dynpath_envpart.ReplaceAll("::", ":");
dynpath_syspart.ReplaceAll("::", ":");
Expand Down
Loading