找到库,但ldconfig没有

时间:2015-07-07 12:16:46

标签: linux shared-libraries

我正在使用Centos 6.6,并且有一个共享库,构建生成的共享库使用多个可执行文件,使用此共享库的任何可执行文件都无法找到它,如ldd所示。 我可以找到图书馆:

$ locate libcs.so.1
/opt/cloudshield/lib/libcs.so.1

ldd显示以下内容:

$ sudo ldd /opt/cloudshield/lib/libcs.so.1
ldd: warning: you do not have execution permission for `/opt/cloudshield/lib/libcs.so.1'
    linux-vdso.so.1 =>  (0x00007ffff4fff000)
    libc.so.6 => /lib64/libc.so.6 (0x00007f7a0fd56000)
    /lib64/ld-linux-x86-64.so.2 (0x000000340ba00000)

$ sudo ldconfig -v | grep libcs.so.1

是不是因为内核库linux-vdso.so.1?

Executable cannot find the library libcs.so.1:
[fpeter@localhost radius]$ ldd radius
    `linux-vdso.so.1 =>  (0x00007fff634b4000)
    libconfd.so => /home/fpeter/trunk/thirdparty/tailf/confd/lib/libconfd.so (0x00007f5db20e6000)
    libcs.so.1 => not found
    libpthread.so.0 => /lib64/libpthread.so.0 (0x000000340c600000)
    libc.so.6 => /lib64/libc.so.6 (0x000000340c200000)
    libm.so.6 => /lib64/libm.so.6 (0x000000340ce00000)
    libcrypto.so.1.0.0 => /usr/lib64/libcrypto.so.1.0.0 (0x0000003ba4a00000)
    /lib64/ld-linux-x86-64.so.2 (0x000000340ba00000)
    libdl.so.2 => /lib64/libdl.so.2 (0x000000340be00000)
    libz.so.1 => /lib64/libz.so.1 (0x000000340d600000)

1 个答案:

答案 0 :(得分:1)

/opt/cloudshield/lib/添加到您的LD_LIBRARY_PATH环境变量中,例如:

LD_LIBRARY_PATH=/opt/cloudshield/lib
export LD_LIBRARY_PATH

另见How to build library ithoutsudoshared libraries