Dear Rooters,
I am trying to compile ROOT with the python support, python (version 3.6.1) being taken from an Anaconda3 installation.
I tried to compile it using both the classic configure/make/make install procedure and using cmake.
In both cases, the compilation failed at the very end (when linking the PyROOT.so). Here is below a short example of the message obtained [*].
Searching a bit the internet I found this:
But in this case, the missing symbols were found in the conda libs (so setting up a dedicated Python env or adding LDFLAGS make sense), and in my case they are from the PyROOT bindings. How could I be missing the symbols?
According to nm, the symbols I am missing are global symbols (checking against ROOT compiled with another python):
$ nm libPyROOT.so |grep PyType_IsSubtype
U PyType_IsSubtype
To give more information, digging into the bindings/pyroot directory, I found the failing command line [**]. But I still do not get what I am missing here… Any idea?
Thanks,
Cheers,
Sébastien
[*]:
/scratch/root/bindings/pyroot/src/MethodProxy.h:81: undefined reference to PyType_IsSubtype' CMakeFiles/PyROOT.dir/src/Utility.cxx.o: In function
PyROOT::Utility::AddUsingToClass(_object*, char const*)’:
/scratch/root/bindings/pyroot/src/Utility.cxx:289: undefined reference to PyErr_Clear' CMakeFiles/PyROOT.dir/src/Utility.cxx.o: In function
PyROOT::Utility::BuildTemplateName(_object*&, _object*, int)’:
/scratch/root/bindings/pyroot/src/Utility.cxx:421: undefined reference to PyUnicode_FromString' /scratch/root/bindings/pyroot/src/Utility.cxx:421: undefined reference to
PyUnicode_AppendAndDel’
/scratch/root/bindings/pyroot/src/Utility.cxx:428: undefined reference to PyUnicode_Append' CMakeFiles/PyROOT.dir/src/Utility.cxx.o: In function
PyROOT::Utility::InitProxy(_object*, _typeobject*, char const*)’:
/scratch/root/bindings/pyroot/src/Utility.cxx:470: undefined reference to PyType_Ready' /scratch/root/bindings/pyroot/src/Utility.cxx:475: undefined reference to
PyModule_AddObject’
CMakeFiles/PyROOT.dir/src/Utility.cxx.o: In function `PyROOT::Utility::GetBuffer(_object*, char, int, void*&, bool)’:
[**] command in bindings/pyroot/CMakeFiles/PyROOT.dir/link.txt and objects are in the src/ directory:
/bin/c++ -fPIC -pipe -m64 -Wall -W -Woverloaded-virtual -fPIC -pthread -Wno-deprecated-declarations -DRHAVE_CONFIG -O2 -g -DNDEBUG -Wl,–no-undefined -shared -Wl, -rpath, -l/pbs/software/cl7/anaconda/anaconda3/lib/, -soname,libPyROOT.so -o …/…/lib/libPyROOT.so CMakeFiles/PyROOT.dir/GPyROOT.cxx.o CMakeFiles/PyROOT.dir/src/Adapters.cxx.o CMakeFiles/PyROOT.dir/src/ClassMethodHolder.cxx.o CMakeFiles/PyROOT.dir/src/ConstructorHolder.cxx.o CMakeFiles/PyROOT.dir/src/Converters.cxx.o CMakeFiles/PyROOT.dir/src/Executors.cxx.o CMakeFiles/PyROOT.dir/src/FunctionHolder.cxx.o CMakeFiles/PyROOT.dir/src/MemoryRegulator.cxx.o CMakeFiles/PyROOT.dir/src/MethodHolder.cxx.o CMakeFiles/PyROOT.dir/src/MethodProxy.cxx.o CMakeFiles/PyROOT.dir/src/ObjectProxy.cxx.o CMakeFiles/PyROOT.dir/src/PropertyProxy.cxx.o CMakeFiles/PyROOT.dir/src/PyBufferFactory.cxx.o CMakeFiles/PyROOT.dir/src/PyRootType.cxx.o CMakeFiles/PyROOT.dir/src/PyStrings.cxx.o CMakeFiles/PyROOT.dir/src/Pythonize.cxx.o CMakeFiles/PyROOT.dir/src/RootModule.cxx.o CMakeFiles/PyROOT.dir/src/RootWrapper.cxx.o CMakeFiles/PyROOT.dir/src/TCustomPyTypes.cxx.o CMakeFiles/PyROOT.dir/src/TPyClassGenerator.cxx.o CMakeFiles/PyROOT.dir/src/TPyDispatcher.cxx.o CMakeFiles/PyROOT.dir/src/TPyException.cxx.o CMakeFiles/PyROOT.dir/src/TPyFitFunction.cxx.o CMakeFiles/PyROOT.dir/src/TPyROOTApplication.cxx.o CMakeFiles/PyROOT.dir/src/TPyReturn.cxx.o CMakeFiles/PyROOT.dir/src/TPySelector.cxx.o CMakeFiles/PyROOT.dir/src/TPython.cxx.o CMakeFiles/PyROOT.dir/src/TRflxCallback.cxx.o CMakeFiles/PyROOT.dir/src/TSetItemHolder.cxx.o CMakeFiles/PyROOT.dir/src/TemplateProxy.cxx.o CMakeFiles/PyROOT.dir/src/Utility.cxx.o -Wl,-rpath,/scratch/gadrat/build_root_v5.34.36/lib: …/…/lib/libGraf3d.so …/…/lib/libGpad.so …/…/lib/libTree.so -lpython3 …/…/lib/libGraf.so …/…/lib/libHist.so …/…/lib/libMatrix.so …/…/lib/libNet.so …/…/lib/libRIO.so …/…/lib/libMathCore.so …/…/lib/libThread.so …/…/lib/libCore.so …/…/lib/libCint.so