处理图书馆的位置

处理图书馆的位置

当您的 Linux 系统“找不到”确实安装在正确位置的动态链接库时,您该怎么办?

举个例子,我正在尝试运行一个名为“ucanvcam”的程序:

oliver@human ~/installed/ucanvcam-0.1.6/bin $ ./ucanvcam
./ucanvcam: error while loading shared libraries: libgd.so.2: cannot open shared object file: No such file or directory

oliver@human ~/installed/ucanvcam-0.1.6/bin $ locate libgd.so.2
/usr/lib64/libgd.so.2.0.0
/usr/lib64/libgd.so.2

oliver@human ~/installed/ucanvcam-0.1.6/bin $ ldd ./ucanvcam
    linux-gate.so.1 =>  (0xf7706000)
    [...]
    libgd.so.2 => not found
    [...]
    librt.so.1 => /lib32/librt.so.1 (0xf6b1e000)

我怎样才能让它在 /usr/lib64 中查找 libgd.so.2?更重要的是,它为什么不在那里查找?它在哪里查找?

谢谢,
马拉

答案1

的手册页将帮助您解决此问题。特别是要查看的重要内容可能是 shell 变量和文件ld.so的内容。LD_LIBRARY_PATH/etc/ld.so.conf

相关内容