通过查看,/etc/ld.so.conf.d
有一个libc.conf
文件指向/usr/local/lib
包含.so
正确运行我的应用程序所需的文件。即使运行ldconfig -v
它也表明上面的路径已设置,但当我启动程序时,它无法运行其中包含的库。我必须export LD_LIBRARY_PATH="/usr/local/lib"
为了正确执行它,但我需要每次打开新 shell 时都设置它,所以我尝试将环境变量添加到/etc/environment
或/home/user/.profile
甚至/home/user/.bashrc
没有任何成功。
.conf
永久设置该变量的正确方法是什么?为什么即使文件指向正确的路径也无法选择库?
编辑:
ldd /usr/local/lib
asant@ANTONIO-PC:~$ ldd /usr/local/lib/libsqlcipher.so
linux-vdso.so.1 (0x00007fff25d9e000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f133d2f2000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f133d2cf000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f133d0dd000)
/lib64/ld-linux-x86-64.so.2 (0x00007f133d6c5000)
asant@ANTONIO-PC:~$ ldd /usr/local/lib/libsqlcipher.so.0
linux-vdso.so.1 (0x00007ffcaede4000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f02bb35d000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f02bb33a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f02bb148000)
/lib64/ld-linux-x86-64.so.2 (0x00007f02bb730000)
asant@ANTONIO-PC:~$ ldd /usr/local/lib/libsqlcipher.so.0.8.6
linux-vdso.so.1 (0x00007ffe7daa7000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007ff66585b000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007ff665838000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007ff665646000)
/lib64/ld-linux-x86-64.so.2 (0x00007ff665c2e000)