Library for macro cannot be found after first compilation

Hi there,

I have been seeing a weird issue where a ROOT macro runs fine when I first compile it, but then complains about a missing library when I run a second time (without compiling).

Here is an example:

rm Macro_C* # delete compiled version
root -l Macro.C+\(\"filename.root\"\) # works
root -l Macro.C+\(\"filename.root\"\) # doesn't work

Here is the error:

cling::DynamicLibraryManager::loadLibrary(): libcanvas_root_io_Dictionaries_clhep_dict.so: cannot open shared object file: No such file or directory

The library is in my ROOT_LIBRARY_PATH.

Does anyone know why ROOT can find the library the first time I run (when it also compiles) but not the second time (when it doesn’t compile)?

Thanks,

Andy


Please read tips for efficient and successful posting and posting code

Please fill also the fields below. Note that root -b -q will tell you this info, and starting from 6.28/06 upwards, you can call .forum bug from the ROOT prompt to pre-populate a topic.

ROOT Version: 6.32.06
Platform: linuxx8664gcc
Compiler: g++ (Spack GCC) 13.3.0


Hi @aedmonds,

Thanks for reporting the issue. That’s a strange issue. Does the results change if you rm Macro_C* after the first invocation?

If you can, could you provide a stripped down version of Macro.Cso that I can try and reproduce on my end?

Cheers,

Dev

Hi @devajith ,

Thanks for your reply. Yes, if I rm Macro_C* after the first invocation, then it works again. i.e.

rm Macro_C*
root -l Macro.C+\(\"filename.root\"\) # works
rm Macro_C*
root -l Macro.C+\(\"filename.root\"\) # works
root -l Macro.C+\(\"filename.root\"\) # doesn't work

I’m struggling to get a simplified version to reproduce the error. It could be tied to our experiment’s environment so if you have any information about what might be going wrong, then I can dig in further on my side. For example, does ROOT consult different environment variables when it compiles and runs vs running something that is already compiled?

Thanks,

Andy

I’ve just solved it. It looks like LD_LIBRARY_PATH might be the culprit, which I guess is used for subsequent invocations. When I do:

export LD_LIBRARY_PATH=${ROOT_LIBRARY_PATH}:${LD_LIBRARY_PATH}

then it all works. I’ll work with my experiment’s software experts to find a proper solution. Thanks and apologies for the noise

1 Like

The output and your observation about LD_LIBRARY_PATH indicates that during the ACLiC compilation of Macro.C (i.e. the first invocation), root somehow manages to find and load libcanvas_root_io_Dictionaries_clhep_dict.so but somehow no longer does unless you update the LD_LIBRARY_PATH. The Canvas/ART team might know what mechanism is used in the first pass and why it does not work for the second pass.

1 Like