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)?
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.
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?
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.