Closed mirguest closed 4 years ago
Hi Tao Lin @mirguest , thanks for opening this issue and the detailed explanations! I think you are completely right, any program that writes edm4hep data to a root file must link against the edm4hepDict
target. I don't think the additional compiler flags are necessary. I also overlooked this in the https://github.com/key4hep/k4-project-template repository. I'm also unsure where the warnings about the missing dictionary are coming from, I'll investigate.
By the way, are you planning to extend this repository and use it for the experiment software? My experience from FCCSW is that it can be helpful to split the framework into different repositories, so I set up the k4-project-template repository, which can be built on top of the common components in K4FWCore and used as a template for the actual experiment framework. Of course it is also possible to work with a fork of this repository. If you can open Pull Requests to this repository with any work you do on it, it is highly appreciated and will help to stay in sync.
Another small thing I noticed: both ${podio_INCLUDE_DIRS}
and ${podio_LIBRARIES}
are no longer needed, writing the target podio::podioRootIO
should be enough.
What was the compiler and operating system used?
What was the compiler and operating system used?
Hi @andresailer , we use SL6 and gcc 8.3.0:
[lint@lxslc607]$ which g++
/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-slc6/bin/g++
[lint@lxslc607]$ lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: Scientific
Description: Scientific Linux release 6.9 (Carbon)
Release: 6.9
Codename: Carbon
Does Gaudi add the as-needed
flag?
Can you run
make VERBOSE=1
when compiling and linking the example?
@andresailer , you are right. It looks like Gaudi add the flags:
[ 69%] Linking CXX shared module ../lib/libExamples.so
cd /dev/shm/lint/K4FWCoreIHEPSFT/build/Examples && /cvmfs/sft.cern.ch/lcg/releases/CMake/3.14.3-34449/x86_64-slc6-gcc8-opt/bin/cmake -E cmake_link_script CMakeFiles/Examples.dir/link.txt --verbose=1
/cvmfs/sft.cern.ch/lcg/releases/gcc/8.3.0-cebb0/x86_64-slc6/bin/g++ -fPIC -fmessage-length=0 -pipe -Wall -Wextra -Werror=return-type -pthread -pedantic -Wwrite-strings -Wpointer-arith -Woverloaded-virtual -Wno-long-long -Wno-shadow -Wl,--as-needed -Wl,--no-undefined -Wl,-z,max-page-size=0x1000 -shared -o ../lib/libExamples.so CMakeFiles/Examples.dir/src/Edm4hepTest/Edm4hepReadAlg.cpp.o CMakeFiles/Examples.dir/src/Edm4hepTest/Edm4hepWriteAlg.cpp.o -L/cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib -Wl,-rpath,/dev/shm/lint/K4FWCoreIHEPSFT/build/lib:/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/Gaudi/lib:/cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib:/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/EDM4hep/lib64:/cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64:/cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib: ../lib/libFWCore.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/Gaudi/lib/libGaudiAlgLib.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/Gaudi/lib/libGaudiUtilsLib.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/Gaudi/lib/libGaudiKernel.so -ldl /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_filesystem.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_thread.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_system.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_regex.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_chrono.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_date_time.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libboost_atomic.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libCore.so -ltbb /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/Gaudi/lib/libGaudiPluginService.so -lstdc++fs -lrt /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/liblzma.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libRIO.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libHist.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libXMLIO.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libThread.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libMatrix.so /cvmfs/sft.cern.ch/lcg/views/LCG_97/x86_64-slc6-gcc8-opt/lib/libMathCore.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/EDM4hep/lib64/libedm4hep.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/EDM4hep/lib64/libedm4hepDict.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodioRootIO.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodioRootIO.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodioDict.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodio.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libCore.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libImt.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libRIO.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libNet.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libHist.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libGraf.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libGraf3d.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libGpad.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libROOTDataFrame.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libTree.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libTreePlayer.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libRint.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libPostscript.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libMatrix.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libPhysics.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libMathCore.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libThread.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libMultiProc.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodioDict.so /cvmfs/cepcsw.ihep.ac.cn/prototype/releases/externals/97.0.0/podio/lib64/libpodio.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libTree.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libImt.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libNet.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libRIO.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libThread.so /cvmfs/sft.cern.ch/lcg/releases/ROOT/v6.20.02-d9e99/x86_64-slc6-gcc8-opt/lib/libCore.so -lpthread
make[2]: Leaving directory `/dev/shm/lint/K4FWCoreIHEPSFT/build'
Should we link the edm4hepDict into the podioDataSvc? Then that would remove the need to link it into other libraries, right?
Yes, we could link edm4hepDict publicly. I think the FWCore
library still needs to be linked to all modules using the DataService though.
See #11
From our meeting discussion: maybe root should load the library via the rootmap file?
Maybe this solves the problem without having to link the dictionaries https://github.com/AIDASoft/podio/pull/99 https://github.com/key4hep/EDM4hep/pull/68
@andresailer Thanks! It works now. After deploying the latest PODIO and EDM4hep, ROOT could load the correct dictionary using the latest rootmap.
I have created an example in https://github.com/ihep-sft-group/K4FWCore to write and read the EDM4hep data using K4FWCore and Gaudi v33r1. One problem is that the contents of the branches are not shown due to the dictionary are not linked to the module.
Following is how to repeat the problem:
Then, run the script and file test.root is created:
Using root to explore the content:
As you see here, the contents of the branches are not split and shown here.
My current solution is forcing linking the dictionary library.
I am not sure where I am wrong. Thank you!
Tao Lin (IHEP)