Compiling ROOT 5.34 with PyROOT

I am trying to compile a legacy version of ROOT 5.34.xx with pyROOT support on my system which is:

Scientific linux 6.9 with kernel version: Linux 2.6.32-696.18.7.el6.x86_64

I do the configure step correctly (I think) like this:

./configure --prefix=/local/install/path/v5_34_26_64_Python2.7 --with-python-incdir=/home/directory/path/python/anaconda3/envs/py2710/include/python2.7 --with-python-libdir=/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config

Clearly I am using an anaconda-installed python (v2.7.10). And I am also letting the install target directory be inside the unpacked source directory. I think both of those are ok.

I’ve tried with many variants of ROOT version and python version. See list below:

ROOT Version ------------ Python Version
5.34.36 ---------------------- 3.6 (epic fail, this was dumb on my part-- didn’t want to go to a 3.2 and try this instead would settle for a working 2.7)
5.34.36 ---------------------- 2.7.13 (realized that this release of python came after the ROOT release)
5.34.36 ---------------------- 2.7.11 (failed with error below)
5.34.36---------------------- 2.7.10 (failed with error below)
5.34.26---------------------- 2.7.11 (failed with error below)

The last three I consider to be sensible tries given the release dates and my lack of knowledge about specific compatibility issues. Each fails with the error seen at the bottom of this post.

I would like to know if documentation exists about specific python compatibilities. Further, what does the error below indicate? I couldn’t quite parse it, it almost looks like an internal inconsistency in the Python library file. Is my procedure incorrect (configure; see above, make; failed, make install)?

Important NOTE I do not have sudo privileges on this machine so solutions that require being root are unacceptable. Further, I cannot upgrade to ROOT6 because of compiler compatibility issues.

g++ -shared -Wl,-soname,libPyROOT.so -m64 -O2 -Wl,–no-undefined -Wl,–as-needed -o lib/libPyROOT.so bindings/pyroot/src/Adapters.o bindings/pyroot/src/ClassMethodHolder.o bindings/pyroot/src/ConstructorHolder.o bindings/pyroot/src/Converters.o bindings/pyroot/src/Executors.o bindings/pyroot/src/FunctionHolder.o bindings/pyroot/src/MemoryRegulator.o bindings/pyroot/src/MethodHolder.o bindings/pyroot/src/MethodProxy.o bindings/pyroot/src/ObjectProxy.o bindings/pyroot/src/PropertyProxy.o bindings/pyroot/src/PyBufferFactory.o bindings/pyroot/src/PyRootType.o bindings/pyroot/src/PyStrings.o bindings/pyroot/src/Pythonize.o bindings/pyroot/src/RootModule.o bindings/pyroot/src/RootWrapper.o bindings/pyroot/src/TCustomPyTypes.o bindings/pyroot/src/TemplateProxy.o bindings/pyroot/src/TPyClassGenerator.o bindings/pyroot/src/TPyDispatcher.o bindings/pyroot/src/TPyException.o bindings/pyroot/src/TPyFitFunction.o bindings/pyroot/src/TPyReturn.o bindings/pyroot/src/TPyROOTApplication.o bindings/pyroot/src/TPySelector.o bindings/pyroot/src/TPython.o bindings/pyroot/src/TRflxCallback.o bindings/pyroot/src/TSetItemHolder.o bindings/pyroot/src/Utility.o bindings/pyroot/src/G__PyROOT.o -Llib -lCore -lCint -ldl -Llib -lRIO -lHist -lGraf -lGraf3d -lGpad -lTree -lMatrix -lNet -lThread -lMathCore -lCore -lCint -L/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config -lpython2.7

/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(dynload_shlib.o): In function _PyImport_GetDynLoadFunc': -------src-dir-------/Python-2.7.10/Python/dynload_shlib.c:94: undefined reference todlsym’
-------src-dir-------/Python-2.7.10/Python/dynload_shlib.c:130: undefined reference to dlopen' -------src-dir-------/Python-2.7.10/Python/dynload_shlib.c:141: undefined reference todlsym’
-------src-dir-------/Python-2.7.10/Python/dynload_shlib.c:133: undefined reference to dlerror' /home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In function_pythread_pthread_set_stacksize’:
-------src-dir-------/Python-2.7.10/Python/thread_pthread.h:497: undefined reference to pthread_attr_setstacksize' /home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In functionPyThread_release_lock’:
-------src-dir-------/Python-2.7.10/Python/thread_pthread.h:350: undefined reference to sem_post' /home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In functionPyThread_acquire_lock’:
-------src-dir-------/Python-2.7.10/Python/thread_pthread.h:326: undefined reference to sem_trywait' -------src-dir-------/Python-2.7.10/Python/thread_pthread.h:324: undefined reference tosem_wait’
/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In function PyThread_free_lock': -------src-dir-------/Python-2.7.10/Python/thread_pthread.h:294: undefined reference tosem_destroy’
/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In function PyThread_allocate_lock': -------src-dir-------/Python-2.7.10/Python/thread_pthread.h:269: undefined reference tosem_init’
/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(thread.o): In function PyThread_start_new_thread': -------src-dir-------/Python-2.7.10/Python/thread_pthread.h:184: undefined reference topthread_attr_setstacksize’
-------src-dir-------/Python-2.7.10/Python/thread_pthread.h:194: undefined reference to pthread_create' -------src-dir-------/Python-2.7.10/Python/thread_pthread.h:210: undefined reference topthread_detach’
/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function posix_forkpty': -------src-dir-------/Python-2.7.10/./Modules/posixmodule.c:4012: undefined reference toforkpty’
/home/directory/path/python/anaconda3/envs/py2710/lib/python2.7/config/libpython2.7.a(posixmodule.o): In function posix_openpty': -------src-dir-------/Python-2.7.10/./Modules/posixmodule.c:3952: undefined reference toopenpty’
collect2: ld returned 1 exit status
make: *** [lib/libPyROOT.so] Error 1

-pthread -lm -ldl

I assume you mean add these to the link line? Firstly, -ldl is already there; are you specifying it for the ordering? Secondly, why does the ROOT build not do this correctly? Do I need to add an option to the configure?

Yes, all at the end. As for the other questions: anaconda does its own thing (C++ compiler, libs, linker scripts, etc.). If you get PyROOT to work properly with anaconda, you’ll be in select company.

The only sure way you can get ROOT to work properly with anaconda is to use the same compiler that was used to compile anaconda’s Python. That is because anaconda’s Python links against its own standard library and if you use a different compiler it will try to link libPyROOT.so against it’s standard library and anaconda’s Python, which is trying to use the different (and very likely incompatible) standard library. That cannot work. You also need to make sure to not set your LD_LIBRARY_PATH in a way that you’ll pick up the wrong libraries for Python (e.g., pick Python from anaconda and libraries from the system).

https://sft.its.cern.ch/jira/browse/ROOT-9145

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.