In a third party software there is a static library containing some classes, which I then link to a dynamic library in my project. The static library comes with a PCM file in the lib folder of the installation path. My dynamic library is located in a different path, so I added the lib folder of the static library to LD_LIBRARY_PATH for automatically loading the PCM file when I load my dynamic library. Sadly this doesn’t seem to work:
$ echo $LD_LIBRARY_PATH
/home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/:/home/mori/software/install/ROOT_6.26.04/lib:/home/mori/software/install//GIT_2.30.2/lib:/home/mori/software/install//EVENTANALYSIS_1.3.0_ROOT_6.26.04/lib:/home/mori/software/install//EVENTANALYSIS_1.3.0_ROOT_6.26.04/plugin:
$ ls /home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/
G__KM3NeTROOT_rdict.pcm cmake libKM3NeTROOT.a
$ root
root [0] .L Debug/plugin/libKM3NeTDataProviders.so
Error in <TCling::LoadPCM>: ROOT PCM /home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/G__KM3NeTROOT_rdict.pcm file does not exist
Info in <TCling::LoadPCM>: In-memory ROOT PCM candidate /home/mori/software/install/ROOT_6.26.04/lib/libASImageGui_rdict.pcm
. . .
According to this post putting the static library lib folder in LD_LIBRARY_PATH should be sufficient, so I don’t understand what’s wrong.
I see a mismatch in your paths, as your library requires /home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/G__KM3NeTROOT_rdict.pcm, which does not exists, while it should ask for /home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/G__KM3NeTROOT_rdict.pcm. Try to rebuild the .so file.
the first path (/home/mori/software/KM3/KM3NeTSoftware/Debug/plugin/) is the one containing my shared library, while the second one (/home/mori/software/install/KM3NETDATAFORMAT_v3.5.1/lib/) is the one for the static library holding the dictionaries and for the PCM file. I load my shared library from the first path, and that’s probably the reason why it tries to load the PCM from that path. But when the PCM is not found I’d expect the second folder to be tried, being it specified in LD_LIBRARY_PATH, but this is not the case.
Anyway I rebuilt both libraries but as expected this didn’t help.
Apparently there is a bug in older ROOT versions, see e.g. this post. I just noticed you’re using a quite old ROOT version, I would suggest to update your ROOT installation.
Yes I found that thread after opening this one, so I started to compile 6.34.04. In the meantime you answered me, but now the build is finished and I can confirm that with 6.34.04 the problem is fixed.
Thank you for your support.
@mdessole I spoke too fast. After installing 6.34.04 I had an inconsistent environment which for some reason made my test pass. Now I cleaned up and re-set everything, and the error is still there. Copying the PCM file into the folder of the shared library fixes the error; this could be used as a workaround, but I would prefer a proper solution. Do you have any other suggestions?