Auto-loading does not find ROOT shared libraries

Hi,

I am (cross-) compiling ROOT for an ARMv7 system. Everything works fine, except
for the target “Generating tutorials/hsimple.root”. When running root.exe it does not
find the shared libraries required and has several unresolved references.
LD_LIBRARY_PATH is set correctly to where the libraries and rootmap files are.
Running interactively it works when I do gSystem->Load(“libHist”) etc.
So, what is missing to make the auto-loading work? Another variable to be set? A
rootrc file or similar?

Thanks for your help.

Cheers,
Ralf.


_ROOT Version: 6.17/01
_Platform: cortexa9t2hf-neon-poky-linux-gnueabi
_Compiler: gcc


Hi Ralf,

the autoloading is based on the mapping encoded in the rootmap files, which sit in the LD_LIBRARY_PATH, typically next to the shared libraries and the root pcms. Do you have rootmap files in the $ROOTSYS/lib directory? Is the pch file generated correctly when hsimple is generated?

Cheers,
D

Hi Danilo,

Thanks for your prompt reply. Unfortunately, I am not a ROOT expert enough to answer
your questions easily. Here is the command which fails and the printout:

[ 94%] Generating tutorials/hsimple.root
cd /home/spiwoks/yocto/thud/root-build/tutorials && LD_LIBRARY_PATH=/home/spiwoks/yocto/thud/root-build/lib:/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/lib:/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi/usr/lib: ROOTIGNOREPREFIX=1 /home/spiwoks/yocto/thud/root-build/bin/root.exe -l -q -b -n -x hsimple.C -e return
<built-in>:5:9: warning: '__STDC_LIMIT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_LIMIT_MACROS 1
        ^
/home/spiwoks/yocto/thud/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/8.2.0/include/stdint.h:5:11: note: previous definition is here
#  define __STDC_LIMIT_MACROS
          ^
<built-in>:6:9: warning: '__STDC_CONSTANT_MACROS' macro redefined [-Wmacro-redefined]
#define __STDC_CONSTANT_MACROS 1
        ^
/home/spiwoks/yocto/thud/sdk/sysroots/x86_64-pokysdk-linux/usr/lib/arm-poky-linux-gnueabi/gcc/arm-poky-linux-gnueabi/8.2.0/include/stdint.h:7:11: note: previous definition is here
#  define __STDC_CONSTANT_MACROS
          ^

Processing hsimple.C...
IncrementalExecutor::executeFunction: symbol '_ZN4TH1FC1EPKcS1_idd' unresolved while linking [cling interface function]!
You are probably missing the definition of TH1F::TH1F(char const*, char const*, int, double, double)
Maybe you need to load the corresponding shared library?
...

The path to the library, rootmap and pcm files if in the LD_LIBRARY_PATH, i.e./home/spiwoks/yocto/thud/root-build/lib. ROOTSYS is not explicitly set, but would point to the same path I guess.

I do not know what a pch file is. If that is somehting that should be generated from executing hsimple.C, then I never get that far.

Thank you very much for your help,
Ralf.
but would be pointing to the same path I guess.

Hi,

are the rootmap files next to the libraries? Is the libHist.rootmap file available?
We’ll need to fix the warning too because it does not look too good…

Cheers,
D

Hi,

Yes, rootmap files are there, in $ROOTSYS/lib, in particular, the one for libHist:

-rw-r–r-- 1 spiwoks zp 632 May 21 09:38 libHist_rdict.pcm
-rw-r–r-- 1 spiwoks zp 5620 May 21 09:38 libHist.rootmap
-rwxr-xr-x 1 spiwoks zp 24676808 May 21 09:38 libHist.so

No idea about the warning. As I wrote earlier when running manually
and loading the libraries manually, it works fine.

It has to be said that this is cross-compilation and root.exe is called
using the binfmt_misc facility and qemu. But the environment is passed.
Could it be that anything else than LD_LIBRARY_PATH and ROOTSYS
is needed?

Cheers,
Ralf.

Hi Ralf,
I am not sure. Native compilation on ARM works out of the box so perhaps the qemu layer could be part of the issue. Are you sure that the $ROOTSYS and LD_LIBRARY_PATH variables are passed properly?

Cheers,
Danilo

Hi Danilo,

You might be right. Is there a way to see what the value of ROOTSYS in root.exe is?
Is there a way to start root.exe in debugging or tracing mode to see what it actually
loads, because it turns out some ROOT libraries are loaded …

Cheers,
Ralf.

Try:

ldd `which root.exe`
ldd ${ROOTSYS}/lib/libHist.so

Hi Ralf,

sure some libraries are, for example Core, Thread and RIO (and Cling, in a sophisticated way as well as MathCore in a less sophisticated way).
About what ROOTSYS is “used/seen” by root.exe, it depends. If you mean at runtime, you can use

cout << gSystem->Getenv("ROOTSYS") << endl;

Cheers,
D

Hi Danilo,

That command is useful. Here is what I get:

root [0] cout << gSystem->Getenv("ROOTSYS") << endl;
/home/spiwoks/yocto/thud/root-build
root [1] cout << gSystem->Getenv("LD_LIBRARY_PATH") << endl;
/home/spiwoks/yocto/thud/root-build/lib:/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//lib:/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//usr/lib:
root [2] gSystem->ListLibraries()
 
Loaded shared libraries
=======================
-lRint
-lCore
/home/spiwoks/yocto/thud/root-build/lib/libCore.so
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//lib/libpthread.so.0
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//usr/lib/libpcre.so.1
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//usr/lib/liblzma.so.5
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//lib/libz.so.1
/home/spiwoks/yocto/thud/root-build/lib/libRIO.so
/home/spiwoks/yocto/thud/root-build/lib/libThread.so
/home/spiwoks/yocto/thud/root-build/lib/libCling.so
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//lib/librt.so.1
/home/spiwoks/yocto/thud/sdk/sysroots/cortexa9t2hf-neon-poky-linux-gnueabi//lib/libtinfo.so.5
/home/spiwoks/yocto/thud/root-build/lib/libMathCore.so
-----------------------
13 libraries loaded
=======================
root [3] .x hsimple.C
IncrementalExecutor::executeFunction: symbol '_ZN4TH1FC1EPKcS1_idd' unresolved while linking [cling interface function]!
You are probably missing the definition of TH1F::TH1F(char const*, char const*, int, double, double)
Maybe you need to load the corresponding shared library?

Does that point to some problem with the set up?

Cheers,
Ralf.

Hi Danilo,

I found out that copying a file containing the following line
include /home/spiwoks/yocto/thud/root-build/lib
to /etc/ld.so.conf.d, solves my problem.

Could it be that the ld configuration does not get updated because
I am cross-compiling? Then qemu and the ld-linux-armhf.so cannot
find the libraries despite the ROOTSYS and LD_LIBRARY_PATH
variables?

Cheers,
Ralf.

Hi, Sorry, That was a false alert!
It is not the solution, yet. I was playing with the rootlogon script
which loaded the libraries, and not the loader.

Cheers,
Ralf.

On your installation, autoloading of libraries seems broken. First to verify, try

gSystem->Load("libHist");
.x hsimple.C

then if this works, check to see if there are ‘rootmap’ file in /home/spiwoks/yocto/thud/root-build/lib

Hi pcanal,

To both suggestion I can reply “yes”, i.e. if I load the library explicitly it works, and
the .rootmap files are in the $ROOTSYS/lib directory.

Cheers,
Ralf.

What does:

 gDebug = 9; cout << "res: " << gInterpreter->AutoLoad("TH1F") << "\n"; gDebug = 0;

prints to the screen?

not very verbous! here is the print out:

root [0] gDebug = 9; cout << "res: " << gInterpreter->AutoLoad(“TH1F”) << “\n”; gDebug = 0;
Info in TInterpreter::TCling::AutoLoad: Trying to autoload for TH1F
res: 0

What about:

if (gInterpreter->GetRootMapFiles()) gInterpreter->GetRootMapFiles()->ls() 

and

cout << gInterpreter->LoadLibraryMap("home/spiwoks/yocto/thud/root-build/lib/libHist.rootmap") << '\n';

Hi,

Here is what I get:

root [0] if (gInterpreter->GetRootMapFiles()) gInterpreter->GetRootMapFiles()->ls()
OBJ: TObjArray TObjArray An array of objects : 0
OBJ: TNamed libMathCore.rootmap /home/spiwoks/yocto/thud/root-build/lib/libMathCore.rootmap : 0 at: 0xf8ae6858
root [1] cout << gInterpreter->LoadLibraryMap(“home/spiwoks/yocto/thud/root-build/lib/libHist.rootmap”) << ‘\n’;
0

Thanks for your help. Cheers, Ralf.

‘Interesting’ … there should be many rootmap files. What is the output of

ls -lart  /home/spiwoks/yocto/thud/root-build/lib/*rootmap

Thanks,
Philippe.