Skip to content

Conversation

@hageboeck
Copy link
Member

@hageboeck hageboeck commented Jan 9, 2026

This follows up on 3161321, where LD_LIBRARY_PATH was removed from roottest.

It cannot be removed without replacement for tests that compile macros. Either LD_LIBRARY_PATH or RUNPATH is needed for those: When ROOT is installed in the system, or when an LD_LIBRARY_PATH is set such that a different ROOT installation is visible, compiled macros can fail. The sequence of events is as follows:

  • roottest compiles a macro into an .so
  • In a subsequent test, that .so is loaded.
  • The dynamic loader will try to load the dependencies of that .so, e.g. libROOTVecOps.so, libCore.so, ... Given that the library being opened (the .so resulting from the macro) doesn't have any RUNPATHs set, the ROOT libraries it depends on are searched for first in LD_LIBRARY_PATH and then in the system.
  • If a library of another ROOT is found in one of those two locations, the whole chain of library loads starts, opening all ROOT libraries that the last library found depends on, loading e.g. /usr/lib64/libCore.so and similar. This will provoke a lot of warnings, because TClassTable is already populated, and potentially crashes the program.

Therefore, in this PR, a RUNPATH is added for ACLiC libraries on Linux and Mac. TSystem::GetMakeSharedLib() by default now contains $RPath, which gets expanded to -Wl,-rpath,<ROOT library path>.

Copy link
Contributor

@guitargeek guitargeek left a comment

Choose a reason for hiding this comment

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

LGTM! It would just be nice to add some comment avoid the a possible more future-proof solution as a TODO, so we maybe attract effort to implement RUNPATH embedding in ACLiC.

@hageboeck hageboeck force-pushed the roottest-LD_LIBRARY_PATH branch from 25229a7 to 6e2dcc0 Compare January 9, 2026 17:19
cmd.ReplaceAll("\"$BuildDir","$BuildDir");
cmd.ReplaceAll("$BuildDir","\"$BuildDir\"");
cmd.ReplaceAll("$BuildDir",build_loc);
cmd.ReplaceAll("$RPath", "-Wl,-rpath=" + gROOT->GetSharedLibDir());
Copy link
Member

Choose a reason for hiding this comment

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

   cmd.ReplaceAll("$RPath", "-Wl,-rpath=" + gROOT->GetSharedLibDir());

This syntax is likely to be platform dependent (eg. different on Windows) and thus the -Wl,-rpath= may belong to the compiledata.sh.

Copy link
Member

Choose a reason for hiding this comment

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

humm .. on the other hand for the Windows case, just not having $PATH on the produced line would have the same effect ... still is -Wl,-rpath= for all other platforms?

Copy link
Member Author

Choose a reason for hiding this comment

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

The Mac linker indeed didn't support -rpath=x, it was -rpath x. Since Linux supports this, too, I changed it to use spaces.
For Windows, there's no rpath as far as I understand, so compiledata for Windows doesn't contain the $RPath placeholder.

@github-actions
Copy link

github-actions bot commented Jan 9, 2026

Test Results

    22 files      22 suites   3d 22h 26m 42s ⏱️
 3 816 tests  3 815 ✅ 0 💤 1 ❌
76 957 runs  76 956 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 7f5bc86.

♻️ This comment has been updated with latest results.

@hageboeck hageboeck force-pushed the roottest-LD_LIBRARY_PATH branch from 6e2dcc0 to abd03e1 Compare January 12, 2026 12:52
@hageboeck hageboeck changed the title [roottest] Re-introduce LD_LIBRARY_PATH to macro tests. Introduce a RUNPATH for compiled macros. Jan 12, 2026
With the previous commit, users have control over whether an rpath is
added or not, so the unconditial addition of an rpath can be replaced
with the placeholder.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants