Loading shared libraries without using their suffixes breaks the interpreter

This is ROOT 6.28/10 on a Ubuntu 22.04 / x86_64 (GCC 11.4) and HepMC3 3.2.7.

When loading shared libraries at runtime, ROOT “checks” what’s available, automatically trying all possible suffixes: “.so”, “.dll”, “.dylib”, “.sl”, “.dl”, “.a”.
However, I have found that it sometimes breaks the interpreter when the user does not provide the suffix explicitly (“.so” in my case).

In the trials below, I am using the absolute path to the shared library as the “LD_LIBRARY_PATH” environment variable does NOT include “/full/path/to/my/HepMC3/lib” (and it never will).

When one loads a shared library using its full name, which ends with the “.so” suffix, it seems to work:

[...]$ root -n
root [0] gSystem->Load("/full/path/to/my/HepMC3/lib/libHepMC3rootIO.so")
(int) 0
root [1] gSystem->GetLibraries("libHepMC3rootIO", "", kFALSE)
(const char *) "/full/path/to/my/HepMC3/lib/libHepMC3rootIO.so.3"
root [2] #include "HepMC3/WriterRootTree.h"
root [3] .q

However, when one does NOT explicitly use the “.so” suffix, the interpreter misbehaves:

[...]$ root -n
root [0] gSystem->Load("/full/path/to/my/HepMC3/lib/libHepMC3rootIO")
(int) 0
root [1] gSystem->GetLibraries("libHepMC3rootIO", "", kFALSE)
(const char *) "/full/path/to/my/HepMC3/lib/libHepMC3rootIO.so.3"
root [2] #include "HepMC3/WriterRootTree.h"
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libHepMC3rootIO.so for HepMC3/Units.h
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libHepMC3rootIO.so for HepMC3/Units.h
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libHepMC3rootIO.so for HepMC3/Data/GenEventData.h
Error in <TInterpreter::TCling::AutoLoad>: failure loading library libHepMC3rootIO.so for HepMC3/Data/GenRunInfoData.h
root [3] .q

Hello,

Thanks for the report!
We are looking into the problem. Thanks for pointing out that ROOT is able to correctly find the library but somehow fails to load it.

best,
D

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.