ldconfig 错误:“不是符号链接"使用 Linux 加载程序时 [英] ldconfig error:"is not a symbolic link" when using Linux loader
问题描述
运行时:
sudo /sbin/ldconfig
出现如下错误:
/sbin/ldconfig: /usr/local/lib/ is not a symbolic link
当我运行 file
命令时,会出现以下内容:
When I run the file
command, the below appears:
file /usr/local/lib/
/usr/local/lib/: directory
在 /usr/local/lib/
中,我使用了三个库.我在这里将它们称为 lib1
、lib2
和 lib3
.
Inside /usr/local/lib/
there are three libraries that I use. I'll call them here as lib1
, lib2
and lib3
.
现在,当我对我的二进制文件执行 ldd
时,结果:
Now, when I do an ldd
on my binary it results:
lib1.so => not found
lib2.so => not found
lib3.so => /usr/local/lib/lib3.so (0x00216000)
但它们都与 /usr/local/lib/{lib1,lib2,lib3}.so
位于同一文件夹中.
But all of them are in the same folder as /usr/local/lib/{lib1,lib2,lib3}.so
.
每次运行ldconfig
,都会出现同样的错误:
Every time I run ldconfig
, the same error appears:
/usr/local/lib/ is not a symbolic link
我认为 /usr/local/lib
应该在 /etc/ld.conf.d/*.conf
中声明两次,但不是:
I thought /usr/local/lib
should be declared twice in /etc/ld.conf.d/*.conf
, but not:
sudo egrep '/usr/local' /etc/ld.so.conf.d/*
projectA.conf.old:/usr/local/projectA/lib
local.conf:/usr/local/lib
ld.so.conf
只包含/etc/ld.so.conf.d/*.conf
,所以这个*.old
没有被处理,它引用 /usr/local/projectA/lib
.
ld.so.conf
only includes /etc/ld.so.conf.d/*.conf
, so this *.old
isn't processed, and it refers to /usr/local/projectA/lib
.
经过一段时间的尝试,我删除了所有 lib1 和 lib2(有时我在二进制文件夹中对其进行了测试),出现了同样的错误.
After a time trying I deleted all lib1 and lib2 (at some point I tested it on binary's folder), the same error occurs.
推荐答案
我在使用 Oracle 11R2 客户端时遇到了这个问题.不确定 Oracle 安装程序是这样做的,还是在我到达之前有人这样做.不是 64 位 vs 32 位,都是 64 位.
I ran into this issue with the Oracle 11R2 client. Not sure if the Oracle installer did this or someone did it here before I arrived. It was not 64-bit vs 32-bit, all was 64-bit.
错误是 libexpat.so.1
不是符号链接.
The error was that libexpat.so.1
was not a symbolic link.
原来有两个完全相同的文件,libexpat.so.1.5.2
和libexpat.so.1
.删除有问题的文件并使其成为 1.5.2 版本的符号链接会导致错误消失.
It turned out that there were two identical files, libexpat.so.1.5.2
and libexpat.so.1
. Removing the offending file and making it a symlink to the 1.5.2 version caused the error to go away.
您希望知名名称成为当前版本的符号链接是有道理的.如果你这样做,你最终得到一个陈旧的库的可能性就会降低.
Makes sense that you'd want the well-known name to be a symlink to the current version. If you do this, it's less likely that you'll end up with a stale library.
这篇关于ldconfig 错误:“不是符号链接"使用 Linux 加载程序时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!