I’m having the following problem with pyroot and I can’t understand it…
I have 2 separated c++ libraries, say libA.so and libB.so containing some c++ objects.
They also contain a cint dictionary so the objects defined in A and B are available to pyroot.
I can load the libraries through ROOT.gSystem.Load() call.
From pyroot, I can then access without problem the class defined in A, say ClassA, instantiate an object and call its methods.
Now in B there is a class, say ClassB, having as data member a ClassA object.
I can instantiate ClassB but when I call any method from ClassB which uses internally a ClassA method through its data member, it results in something like :
/bin/python: symbol lookup error: /path/to/lib/libB.so: undefined symbol: _ZN4Root18ClassA15theMethodEfRf
and pyroot exits immediately.
Is there an obvious reason to this behaviour ? any thing I can try to debug this ?
I Compiled the same libraries on a different machine, same architecture (x86_64), same ROOT version (5.32) but with a more recent python (2.7 vs 2.6) : works as expected !
Independently, there is a workaround : use the archive file libA.a and libB.a and combine them in a new libAandB.so. Then load only libAandB.so and the error disappears.
Still I’d like to understand why the orginal problem occured. if anyaone has an idea…
you can use the LD_DEBUG variable to debug (set it to ‘help’ to see its options). I think, though, that libB needs to be linked with libA, or when libA is loaded, it should be loaded first and have RTLD_GLOBAL set (which I thought was the default for gSystem.Load()). Try loading them with ctypes.CDLL instead of gSystem, setting RTLD_GLOBAL and RTLD_NOW flags: