Make sure to set RPATH correctly in the cmake config to make ODD usable within...
Make sure to set RPATH correctly in the cmake config to make ODD usable within newer Key4hep installations
Following the instructions from P11 from these slides leads to the following error:
PersistencyIO INFO +++ Set Streamer to dd4hep::OpaqueDataBlock
Info in <TGeoManager::TGeoManager>: Geometry default, Detector Geometry created
Info in <TGeoNavigator::BuildCache>: --- Maximum geometry depth set to 100
XMLLoader INFO +++ Processing XML file: file:OpenDataDetector/xml/OpenDataDetector.xml
DD4hep WARN ++ STD conditions NOT defined by client. NTP defaults taken.
Detector INFO *********** Created World volume with size: 1000 1000 1000
Info in <TGeoManager::SetTopVolume>: Top volume is world_volume. Master volume is world_volume
WARNING: cannot load libOpenDataDetector.so for factory ODDCylinder
WARNING: libPhysics.so.6.26: cannot open shared object file: No such file or directory
Compact ERROR FAILED subdetector:BeamPipe of type ODDCylinder
WARNING: cannot load libOpenDataDetector.so for factory ODDCylinder
WARNING: libPhysics.so.6.26: cannot open shared object file: No such file or directory
PluginService ERROR Factory requested: ODDCylinder (N10__cxxabiv120__function_type_infoE) :bad any_cast
PluginService ERROR Stub is invalid!
Compact ERROR ++ FAILED to convert subdetector: BeamPipe: Failed to execute subdetector creation plugin. No factory with name Create(ODDCylinder) for type ODDCylinder found.
Please check library load path and/or plugin factory name.
****************************************************
* A runtime error has occured :
* Failed to execute subdetector creation plugin. No factory with name Create(ODDCylinder) for type ODDCylinder found.
Please check library load path and/or plugin factory name.
* the program will have to be terminated - sorry.
****************************************************
*** Break *** segmentation violation
[...]
This is caused by the fact that in the Key4hep stacks many components / packages no longer use LD_LIBRARY_PATH
but rely on RPATH
instead (see also: https://github.com/key4hep/k4-project-template/issues/12).
Simply using dd4hep_set_compiler_flags
here seems to be the easiest solution, but obviously it would also be posssible to just directly use the relevant pieces here. This is also used in lcgeo. The relevant bits are these