如果未导出 LD_LIBRARY_PATH,则共享库获取失败

如果未导出 LD_LIBRARY_PATH,则共享库获取失败

通过查看,/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)

相关内容