Is that Boost version compiled for Python 3.6 (what OS/version is this on, and id the Boost install a system package or self installed)? That undefined symbol can be a symptom of using a Boost.Python that was compiled for Python 2.
Geant4’s Python interface has been built against Boost 1.70 successfully, and I’d guess that most recent versions should work fine. To point CMake to a specific Boost installed at, say /my/boost/install, add that path to CMAKE_PREFIX_PATH either in the environment, or as an argument to cmake (cmake -DCMAKE_PREFIX_PATH=/my/boost/install <otherargs>)
– Found PythonInterp: /cvmfs/cms.cern.ch/slc7_amd64_gcc820/cms/cmssw/CMSSW_10_6_1/external/slc7_amd64_gcc820/bin/python3 (found suitable version “3.6.4”, minimum required is “3.0”)
– Found PythonLibs: /cvmfs/cms.cern.ch/slc7_amd64_gcc820/cms/cmssw/CMSSW_10_6_1/external/slc7_amd64_gcc820/lib/libpython3.6m.so (found version “3.6.8”)
CMake Warning at /cvmfs/sft.cern.ch/lcg/contrib/CMake/3.14.2/Linux-x86_64/share/cmake-3.14/Modules/FindBoost.cmake:896 (message):
New Boost version may have incorrect or missing dependencies and imported
Call Stack (most recent call first):
– Boost version: 1.72.0
– Found the following Boost libraries:
But everything compiled as usual. It still gave me the same error when I did:
from GEANT4 import *
If I look inside /cvmfs/cms.cern.ch/slc7_amd64_gcc820/external/boost/1.72.0-gchjei/lib/, I see this: libboost_python27.so
so probably its compiled with python2.7 - I am not sure…
So your suggestion would be install a boost version 1.7 using python3?
Also, may I ask which versions of GEANT4 can work with python2? I can try with that as well.
I have another problem in running the test codes. I am using code inside: environments/g4py/tests/gtest01/
If I do:
python test.py, I get this error:
Traceback (most recent call last):
File “test.py”, line 103, in
Boost.Python.ArgumentError: Python argument types in
did not match C++ signature:
SetParticleByName(G4ParticleGun*, std::__cxx11::basic_string<char, std::char_traits, std::allocator >)
which to me seems can arise if the compiled boost version is not compatible with the python version I am using. For reference, I am using python version 2.7.15+ and boost version 1.72.0 which seems to have libboost_python27.so in its lib directory so my guess its compiled with python2.7.
I’d recommend sticking with Geant4 10.6.2 as this has significant improvements to the build of the Python bindings. As you are running on lxplus, it would be easiest to use the LCG packages either via a view, e.g.