/usr/bin/ld: 找不到 -lcrypt (rhel 6 )

/usr/bin/ld: 找不到 -lcrypt (rhel 6 )

系统信息

[root@xilinx busybox-1.22.1]# uname -r
2.6.32-71.el6.x86_64

在 rhel 6 上创建 busybox 时出现以下错误:

/usr/bin/ld: cannot find -lcrypt
collect2: ld returned 1 exit status
make: *** [busybox_unstripped] Error 1

我还可以看到 lib 中存在库:

[root@xilinx busybox-1.22.1]# ls  -ld /lib/libcry*
-rwxr-xr-x. 1 root root 38380 Sep  7  2010 /lib/libcrypt-2.12.so
lrwxrwxrwx. 1 root root    16 Jan 25 16:48 /lib/libcrypt.so.1 -> libcrypt-2.12.so

[root@xilinx busybox-1.22.1]# ls -ld /usr/bin/ld*
-rwxr-xr-x. 1 root root  595192 May  5  2010 /usr/bin/ld
-rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3add
-rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3del
-rwxr-xr-x. 1 root root 1685416 Aug 24  2010 /usr/bin/ldb3edit
-rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3modify
-rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3rename
-rwxr-xr-x. 1 root root 1685424 Aug 24  2010 /usr/bin/ldb3search
-rwxr-xr-x. 1 root root    5656 Sep  7  2010 /usr/bin/ldd

为什么会发生这种情况?

附加信息:

[root@xilinx busybox-1.22.1]# yum install glibc-*
Loaded plugins: refresh-packagekit, rhnplugin
There was an error parsing the RHN proxy settings.
RHN support will be disabled.
Setting up Install Process
Package glibc-devel-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-headers-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-utils-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-common-2.12-1.7.el6.x86_64 already installed and latest version
Nothing to do

这些也是以 glib* 开头的已安装软件包

[root@xilinx busybox-1.22.1]# yum list installed |grep glibc*
There was an error parsing the RHN proxy settings.
RHN support will be disabled.
NetworkManager-glib.x86_64          1:0.8.1-5.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
PackageKit-glib.x86_64              0.5.8-13.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
avahi-glib.x86_64                   0.6.25-8.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
dbus-glib.x86_64                    0.86-5.el6                         @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
dbus-glib-devel.x86_64              0.86-5.el6                         @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glib.x86_64                         1:1.2.10-33.el6                    @epel    
glib-devel.x86_64                   1:1.2.10-33.el6                    @epel    
glib2.x86_64                        2.22.5-5.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glib2-devel.x86_64                  2.22.5-5.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glibc.i686                          2.12-1.7.el6                       @server  
glibc.x86_64                        2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glibc-common.x86_64                 2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glibc-devel.x86_64                  2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glibc-headers.x86_64                2.12-1.7.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
glibc-utils.x86_64                  2.12-1.7.el6                       @server  
glibmm24.x86_64                     2.22.1-1.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
poppler-glib.x86_64                 0.12.4-3.el6                       @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
pulseaudio-libs-glib2.x86_64        0.9.21-13.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0
taglib.x86_64                       1.6.1-1.1.el6                      @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0

glibc已安装:

[root@xilinx busybox-1.22.1]# yum list installed glibc
Loaded plugins: refresh-packagekit, rhnplugin
There was an error parsing the RHN proxy settings.
RHN support will be disabled.
Installed Packages
glibc.i686                                              2.12-1.7.el6                                             @server                                                
glibc.x86_64                                            2.12-1.7.el6                                             @anaconda-RedHatEnterpriseLinux-201009221801.x86_64/6.0

尝试过转速

[root@xilinx Downloads]# rpm -ivh glibc-static-2.12-7.2.x86_64.rpm 
warning: glibc-static-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY
error: Failed dependencies:
    glibc-devel = 2.12-7.2 is needed by glibc-static-2.12-7.2.x86_64

现在这是一个先有鸡还是先有蛋的问题

[root@xilinx Downloads]# rpm -ivh glibc-2.12-7.2.x86_64.rpm 
warning: glibc-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY
error: Failed dependencies:
    glibc-common = 2.12-7.2 is needed by glibc-2.12-7.2.x86_64

好的,然后我安装了这个依赖项:

[root@xilinx Downloads]# rpm -ivh glibc-common-2.12-7.2.x86_64.rpm
warning: glibc-common-2.12-7.2.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 2ca06d46: NOKEY
error: Failed dependencies:
    glibc = 2.12-7.2 is needed by glibc-common-2.12-7.2.x86_64

即当我安装 glibc-2.12-7.2 时,它说我需要 glibc-common-2.12-7.2 但现在当我安装 glibc-common-2.12-7.2 时,它说它需要 glibc-2.12-7.2

如何打破这个鸡生蛋蛋生鸡的循环?

但实际上所有必需的 glibc 都已安装

[root@xilinx busybox-1.22.1]# yum install glibc-*
     Package glibc-devel-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-headers-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-utils-2.12-1.7.el6.x86_64 already installed and latest version
Package glibc-common-2.12-1.7.el6.x86_64 already installed and latest version
Nothing to do

答案1

Busybox 使用静态库,因此您必须安装glibc-static(我认为 RHEL6 中没有,您必须找到它)才能将 Busybox 与 librcrypt.a 一起使用,而不是动态版本。

答案2

这帮助我最终解决了自己的ld -lcrypt问题。我也验证了我的所有库都在我的/usr/lib64/libcrypto.so库中libcrypt.a,但没有找到这些库! (但可以看到他们)。

将静态 glibc 库添加到我的 Centos-7 系统中

yum install glibc-static

解决了问题..

答案3

版本不匹配。你有2.12-1.7,但它正在寻找2.12-7.2。虽然很微妙,但足以让 rpm 惊慌失措。

您可以传递--nodeps给 RPM 来强制安装静态包。如果之后不起作用,只需将包装取出即可。

答案4

此错误可能是由于系统无法在您的目录libcrypt.so中找到指定的文件引起的。/lib它只找到/lib/libcrypt-2.12.so/lib/libcrypt.so.1

解决此问题的一个简单方法是创建一个名为 的符号链接libcrypt.so,链接到libcrypt-2.12.so同一目录中的文件。

就我而言,您可以运行以下命令:

ln -s /lib/libcrypt-2.12.so /lib/libcrypt.so

相关内容