Reading every library in LD_LIBRARY_PATH when using EDM4hep on Python
Check duplicate issues.
- [x] Checked for duplicates
Description
I'm not sure if this is an issue in ROOT or in our code. As explained in https://github.com/AIDASoft/podio/issues/770, doing
strace -e open,openat,creat python -c "import edm4hep; edm4hep.CaloHitContribution();" 2>&1 | wc -l
gives 20k lines on my system, corresponding to opening every library that can be found in LD_LIBRARY_PATH (and others like /usr/lib). This doesn't happen however for all the EDM4hep objects. It seems to be happening because there is a static constexpr std::string_view typeName for each EDM4hep class (generated from https://github.com/AIDASoft/podio/blob/777437d955ba1035ede052643e5b457e8b68d113/python/templates/Object.h.jinja2#L57) . Removing static constexpr (and a few more changes as described in https://github.com/AIDASoft/podio/issues/770 since there is other code that needs it to be constexpr) fixes this issue.
Reproducer
With CVMFS, doing:
source /cvmfs/sw-nightlies.hsf.org/key4hep/setup.sh
or
source /cvmfs/sft-nightlies.cern.ch/lcg/views/devkey-head/latest/x86_64-el9-gcc14-opt/setup.sh
is enough to load podio and EDM4hep and run the strace command above. Otherwise the setup is:
git clone https://github.com/AIDASoft/podio
cd podio
mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=20 -G Ninja
ninja install
cd ../..
git clone https://github.com/key4hep/EDM4hep
cd EDM4hep
mkdir build && cd build
podio_DIR=$PWD/../../podio/install cmake .. -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTING=OFF -DCMAKE_CXX_STANDARD=20 -G Ninja
ninja install
cd ../install
export PYTHONPATH=$PWD/lib/python*/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH=$PWD/lib:$PWD/lib64:$LD_LIBRARY_PATH
ROOT version
Reproducible with 6.32, 6.34 and locally with 6.36 RC1.
Installation method
Spack, LCG, built from source
Operating system
Linux, Alma 9
Additional context
Related issue: https://github.com/root-project/root/issues/14277