Welcome to Cadabra Q&A, where you can ask questions and receive answers from other members of the community.
+1 vote

Hi, I am trying to install CADABRA2 in my computer, Ubuntu 18.04. I am doing it by following the instructions given in https://github.com/kpeeters/cadabra2/. Everything was going well until I typed in my terminal:

cmake .. make

and a bunch of messages of the following type started to pop up:

/usr/local/lib/libpython3.7m.a(abstract.o): relocation R_X86_64_32S against symbol _Py_NotImplementedStruct' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.7m.a(boolobject.o): relocation R_X86_64_32S against symbol_Py_FalseStruct' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytearrayobject.o): relocation R_X86_64_32 against symbol _PyByteArray_empty_string' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.7m.a(bytesobject.o): relocation R_X86_64_32 against symbol_Py_NoneStruct' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: /usr/local/lib/libpython3.7m.a(call.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIC

etc,

I have been trying to find the main cause of the problem, but I did not succeed. Do you guys understand what it is going on? I would really appreciate any comments or suggestions which help me to fix this issue.

in Installation trouble by (130 points)

Surprising. I'll try on a clean 18.04 machine, hang on.

1 Answer

+1 vote

You are building against python3.7 which you installed yourself, right? (since it fetches libpython3.7m.a from /usr/local/lib).

Moreover, you are lacking the shared libraries, since it tries to link to the .a, not the .so. That by itself won't work; you need to link against shared libraries in order to produce the Python cadabra2.so module.

Any chance you can just build against stock python3.6 which comes with Ubuntu 18.04? I just tried that on a clean 18.04 install and it works fine. If that's not an option for you, you'll need to figure out why your python 3.7 installation does not have the shared libraries.

by (83.1k points)

Hi Kasper,

Thanks for your answer. I tried to fix the python3.7 libraries by reconfiguring and updating them, and now the error message appears is the following

usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_tss_create': /tmp/Python-3.7.2/Python/thread_pthread.h:750: undefined reference topthread_key_create' /usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_start_new_thread': /tmp/Python-3.7.2/Python/thread_pthread.h:222: undefined reference topthread_create' /tmp/Python-3.7.2/Python/thread_pthread.h:239: undefined reference to pthread_detach' /usr/local/lib/libpython3.7m.a(thread.o): In functionPyThread_tss_delete': /tmp/Python-3.7.2/Python/thread_pthread.h:767: undefined reference to pthread_key_delete' /usr/local/lib/libpython3.7m.a(thread.o): In functionPyThread_acquire_lock_timed': /tmp/Python-3.7.2/Python/thread_pthread.h:372: undefined reference to sem_wait' /tmp/Python-3.7.2/Python/thread_pthread.h:369: undefined reference tosem_trywait' /tmp/Python-3.7.2/Python/thread_pthread.h:369: undefined reference to sem_trywait' /usr/local/lib/libpython3.7m.a(thread.o): In functionPyThread_start_new_thread': /tmp/Python-3.7.2/Python/thread_pthread.h:203: undefined reference to pthread_attr_setstacksize' /usr/local/lib/libpython3.7m.a(thread.o): In functionPyThread_tss_delete': /tmp/Python-3.7.2/Python/thread_pthread.h:767: undefined reference to pthread_key_delete' /usr/local/lib/libpython3.7m.a(thread.o): In function_pythread_pthread_set_stacksize': /tmp/Python-3.7.2/Python/thread_pthread.h:640: undefined reference to pthread_attr_setstacksize' /usr/local/lib/libpython3.7m.a(thread.o): In functionPyThread_create_key': /tmp/Python-3.7.2/Python/thread_pthread.h:677: undefined reference to pthread_key_create' /tmp/Python-3.7.2/Python/thread_pthread.h:682: undefined reference topthread_key_delete' /usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_set_key_value': /tmp/Python-3.7.2/Python/thread_pthread.h:712: undefined reference topthread_setspecific' /usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_delete_key': /tmp/Python-3.7.2/Python/thread_pthread.h:696: undefined reference topthread_key_delete' /usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_delete_key_value': /tmp/Python-3.7.2/Python/thread_pthread.h:704: undefined reference topthread_setspecific' /usr/local/lib/libpython3.7m.a(thread.o): In function PyThread_get_key_value': /tmp/Python-3.7.2/Python/thread_pthread.h:723: undefined reference topthread_getspecific' /usr/local/lib/libpython3.7m.a(thread.o): In function `PyThread_allocate_lock':

etc,

Following your suggestion, I started to look for websites where I can download the file libpython3.7m.so.1.0, but I did find anything useful.

I have also considered your suggestion of using python3.6 instead of python3.7, but it did not work, apparently I should make some modifications in the file CMakeCache.txt. Does this make sense for you?

It is still linking to the static version, so that will eventually break too. You are probably not building python3.7 for shared libraries, but without more details on how you install python3.7 I can't say.

Did you try simply install the cadabra2-2.2.9-bionic.deb package which you can download from the Cadabra web site? I uploaded that this morning after the successful build on Ubuntu 18.04.

Did you try simply install the cadabra2-2.2.9-bionic.deb package which you can download from the Cadabra web site? I uploaded that this morning after the successful build on Ubuntu 18.04.

Hi, yes that was my first option, but it didn't work (I click on the cadabra2 icon and it seems that it's loading but at the end it appears nothing). That's why I tried to install it step by step (manually). I just did it again, and unfortunately it's still not working.

What happens if you install the binary package and then start cadabra2 or cadabra2-gtk from a terminal window? Send me the error message.

...