Platform: Ubuntu 12.04LTS x86_64
Version for Python: 2.7.3
I have a shared library that was provided to me by the provider, and it included libcrypto.so.0.9.8 and libssl.0.9.8 with a note that it will not work with other versions of these libraries.
The version of Ubuntu that we are running (12.04LTS) uses libcrypto.so.1.0.0 and libssl.so.1.0.0, and I tried to compile them and confirmed that it was not working.
I started writing my C-function and tested its compilation against these libraries, and it works, everything is happy, I get the results back, I expect, and so on. Here where it gets sticky. When I import a function in python and try to run it, it looks like ld.so is still trying to link it to libcrypto.so.1.0.0 instead of the specified library.
I copied all the libraries to the / etc / directory (renamed for publication) to create a permanent place to put them on other servers.
I am compiling with:
gcc -fPIC -shared vendor_lib_test.c -o libmylib.so -lvendor_ssl
Additional gcc options I tried:
-Wl,-rpath,/etc/directory,-rpath-link,/etc/directory
I tried to run the code on an older server with 10.04LTS, which uses 0.9.8 of both of these libraries, and it worked as expected, but this is the last 10.04 server that we have and will not be used in production.
checking for ldd produces (edited to remove confidential information):
linux-vdso.so.1 => (0x00007fff39fe9000) libvendor_ssl.so => /etc/directory/liblpcapi_ssl.so (0x00007f3c7602b000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f3c75c64000) libssl.so.0.9.8 => /etc/directory/libssl.so.0.9.8 (0x00007f3c75b1c000) libcrypto.so.0.9.8 => /etc/directory/libcrypto.so.0.9.8 (0x00007f3c758ab000) /lib64/ld-linux-x86-64.so.2 (0x00007f3c76341000) libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f3c756a7000)
so it seems to be linked to the correct libraries, but running a python script causes a segmentation error, and gdb gives us:
$ gdb python (gdb) run ./ptest.py Starting program: /usr/bin/python ./ptest.py [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". Program received signal SIGSEGV, Segmentation fault. 0x00007ffff724dc68 in RSA_public_encrypt () from /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
so it is still trying to connect with 1.0.0, I am banging my head on the wall here.
edit: export LD_LIBRARY_PATH = / etc / directory does not work either.