简体   繁体   English

CFFI如何避免手动设置LD_LIBRARY_PATH

[英]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. 我正在使用python CFFI在某个名为libfpta的外部库周围构建包装,我想将其放入我的python存储库(myrepo / lib / libfpta.so)中,并因此与python代码一起分发。 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. 第一件好事是实际上生成了表示为共享库(_amnesia.so)的包装器,但是为了导入它,我必须正确设置LD_LIBRARY_PATH。 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. 在我的set_source声明中,按照那里的建议,它没有用。

Oh, I get it) 哦,我明白了)

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

Big thanks to everyone! 非常感谢大家!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM