hello world
hello world

Reputation: 624

CFFI how to avoid manual setting of LD_LIBRARY_PATH

I am using python CFFI to build a wrapper around some external library, called libfpta, which I would like to put inside my python repo (myrepo/lib/libfpta.so) and thus distribute alongside with python code. First good thing is that wrapper represented as a shared object (_amnesia.so) is actually generated, but in order to even import it I have to have LD_LIBRARY_PATH properly set. In other words

(venv) magniff@magniffy700:~/workspace/amnesia $ ldd _amnesia.so 
linux-vdso.so.1 =>  (0x00007ffeb506f000)
libfpta.so => not found  # path to actual code is not set
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fed7910b000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fed78d41000)
/lib64/ld-linux-x86-64.so.2 (0x0000563c4cac8000)

I have been trying to solve this by setting

extra_link_args=['-Wl,-rpath=./lib/libfpta.so'],

inside my set_source declaration, as recommended there, by it didnt work.

Upvotes: 2

Views: 1000

Answers (1)

hello world
hello world

Reputation: 624

Oh, I get it)

extra_link_args=['-Wl,-rpath=./lib'],

Big thanks to everyone!

Upvotes: 3

Related Questions