CentOS 64 位糟糕的 ELF 解释器

发布于 2024-12-18 22:47:52 字数 156 浏览 1 评论 0原文

我刚刚安装了 CentOS 6 64 位版本,我尝试在 64 位计算机上安装 32 位应用程序并收到此错误:

/lib/ld-linux.so.2:错误的 ELF 解释器:没有这样的文件或目录

我该如何解决这个问题?

I have just installed CentOS 6 64bit version, I'm trying to install a 32-bit application on a 64-bit machine and got this error:

/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory

How do I resolve this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

一念一轮回 2024-12-25 22:47:52

您使用的是 64 位系统,并且没有安装 32 位库支持。

要安装对 32 位可执行文件的(基准)支持

(如果您在设置中不使用 sudo,请阅读下面的注释)

Fedora/Red Hat 系列中的大多数桌面 Linux 系统:

 pkcon install glibc.i686

可能是一些桌面 Debian/Ubuntu 系统?:

pkcon install ia32-libs

Fedora 或更新版本Red Hat、CentOS:

 sudo dnf install glibc.i686

较旧的 RHEL、CentOS:

   sudo yum install glibc.i686

甚至较旧的 RHEL、CentOS:

  sudo yum install glibc.i386

Debian 或 Ubuntu:

   sudo apt-get install ia32-libs

应该会获取您需要的(第一个、主要)库。

一旦你有了这个,你可能需要支持库

任何需要安装 glibc.i686 或 glibc.i386 的人也可能会遇到其他库依赖项。要识别提供任意库的包,

 ldd /usr/bin/YOURAPPHERE

如果您不确定它是否在 /usr/bin 中,您也可以

 ldd $(which YOURAPPNAME)

使用输出将如下所示:

    linux-gate.so.1 =>  (0xf7760000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xf773e000)
    libSM.so.6 => not found

检查缺少的库(例如上面输出中的 libSM.so.6 ),对于每一个,您都需要找到提供它的包。

用于查找每个发行版系列的软件包的命令

Fedora/Red Hat Enterprise/CentOS:

 dnf provides /usr/lib/libSM.so.6

或者,在较旧的 RHEL/CentOS 上:

 yum provides /usr/lib/libSM.so.6

或者,在 Debian/Ubuntu 上:

首先,安装并下载 apt-file 的数据库,

 sudo apt-get install apt-file && apt-file update

然后 进行搜索

 apt-file find libSM.so.6

在(通常)情况下使用注意前缀路径 /usr/lib ;很少,由于历史原因,一些库仍然存在于 /lib 下……在典型的 64 位系统上,32 位库存在于 /usr/lib 中,64 位库存在于 /usr/lib 中在/usr/lib64中。

(Debian/Ubuntu 以不同的方式组织多架构库。)

为缺失的库安装软件包

上面应该给你一个软件包名称,例如:

libSM-1.2.0-2.fc15.i686 : X.Org X11 SM runtime library
Repo        : fedora
Matched from:
Filename    : /usr/lib/libSM.so.6

在这个例子中,软件包的名称是 libSM32位版本的包的名称是libSM.i686

然后,您可以安装该软件包以在 GUI 中使用 pkcon 或适当时使用 sudo dnf/yum/apt-get 来获取必需的库……。例如pkcon install libSM.i686。如有必要,您可以完整指定版本。例如sudo dnf install ibSM-1.2.0-2.fc15.i686

有些图书馆的名字前会有一个“纪元”指示符;这可以省略(好奇的可以阅读下面的注释)。

注释

警告

顺便说一句,您遇到的问题要么意味着您的 RPM(或 DPkg/DSelect)数据库已损坏,要么意味着您尝试运行的应用程序不是通过包管理器安装的。如果您是 Linux 新手,您可能希望尽可能避免使用软件包管理器以外来源的软件...

如果您不在设置中使用“sudo”

键入

su -c

,请在每次看到 时 sudo,例如,

su -c dnf install glibc.i686

关于库名称中的纪元指示符

名称之前的“纪元”指示符是底层 RPM 库处理版本号的方式的产物;例如

2:libpng-1.2.46-1.fc16.i686 : A library of functions for manipulating PNG image format files
Repo        : fedora
Matched from:
Filename    : /usr/lib/libpng.so.3

这里的2:可以省略;只需pkcon install libpng.i686sudo dnf install libpng-1.2.46-1.fc16.i686。 (它模糊地暗示了这样的事情:在某个时刻,libpng 包的版本号向后滚动,并且“纪元”必须增加,以确保较新的版本在运行期间被认为是“较新的”更新。或者类似的事情发生了两次。)


更新以更全面地阐明和涵盖各种包管理器选项(2016 年 3 月)

You're on a 64-bit system, and don't have 32-bit library support installed.

To install (baseline) support for 32-bit executables

(if you don't use sudo in your setup read note below)

Most desktop Linux systems in the Fedora/Red Hat family:

 pkcon install glibc.i686

Possibly some desktop Debian/Ubuntu systems?:

pkcon install ia32-libs

Fedora or newer Red Hat, CentOS:

 sudo dnf install glibc.i686

Older RHEL, CentOS:

   sudo yum install glibc.i686

Even older RHEL, CentOS:

  sudo yum install glibc.i386

Debian or Ubuntu:

   sudo apt-get install ia32-libs

should grab you the (first, main) library you need.

Once you have that, you'll probably need support libs

Anyone needing to install glibc.i686 or glibc.i386 will probably run into other library dependencies, as well. To identify a package providing an arbitrary library, you can use

 ldd /usr/bin/YOURAPPHERE

if you're not sure it's in /usr/bin you can also fall back on

 ldd $(which YOURAPPNAME)

The output will look like this:

    linux-gate.so.1 =>  (0xf7760000)
    libpthread.so.0 => /lib/libpthread.so.0 (0xf773e000)
    libSM.so.6 => not found

Check for missing libraries (e.g. libSM.so.6 in the above output), and for each one you need to find the package that provides it.

Commands to find the package per distribution family

Fedora/Red Hat Enterprise/CentOS:

 dnf provides /usr/lib/libSM.so.6

or, on older RHEL/CentOS:

 yum provides /usr/lib/libSM.so.6

or, on Debian/Ubuntu:

first, install and download the database for apt-file

 sudo apt-get install apt-file && apt-file update

then search with

 apt-file find libSM.so.6

Note the prefix path /usr/lib in the (usual) case; rarely, some libraries still live under /lib for historical reasons … On typical 64-bit systems, 32-bit libraries live in /usr/lib and 64-bit libraries live in /usr/lib64.

(Debian/Ubuntu organise multi-architecture libraries differently.)

Installing packages for missing libraries

The above should give you a package name, e.g.:

libSM-1.2.0-2.fc15.i686 : X.Org X11 SM runtime library
Repo        : fedora
Matched from:
Filename    : /usr/lib/libSM.so.6

In this example the name of the package is libSM and the name of the 32bit version of the package is libSM.i686.

You can then install the package to grab the requisite library using pkcon in a GUI, or sudo dnf/yum/apt-get as appropriate…. E.g pkcon install libSM.i686. If necessary you can specify the version fully. E.g sudo dnf install ibSM-1.2.0-2.fc15.i686.

Some libraries will have an “epoch” designator before their name; this can be omitted (the curious can read the notes below).

Notes

Warning

Incidentially, the issue you are facing either implies that your RPM (resp. DPkg/DSelect) database is corrupted, or that the application you're trying to run wasn't installed through the package manager. If you're new to Linux, you probably want to avoid using software from sources other than your package manager, whenever possible...

If you don't use "sudo" in your set-up

Type

su -c

every time you see sudo, eg,

su -c dnf install glibc.i686

About the epoch designator in library names

The “epoch” designator before the name is an artifact of the way that the underlying RPM libraries handle version numbers; e.g.

2:libpng-1.2.46-1.fc16.i686 : A library of functions for manipulating PNG image format files
Repo        : fedora
Matched from:
Filename    : /usr/lib/libpng.so.3

Here, the 2: can be omitted; just pkcon install libpng.i686 or sudo dnf install libpng-1.2.46-1.fc16.i686. (It vaguely implies something like: at some point, the version number of the libpng package rolled backwards, and the “epoch” had to be incremented to make sure the newer version would be considered “newer” during updates. Or something similar happened. Twice.)


Updated to clarify and cover the various package manager options more fully (March, 2016)

最终幸福 2024-12-25 22:47:52

刚刚在新安装的 CentOS 6.4 64 位机器上遇到了同样的问题。一个 yum 命令就可以解决这个问题以及 99% 的类似问题:

yum groupinstall "Compatibilitylibrary"

可以在该命令前面加上 'sudo' 前缀,也可以以 root 身份运行,以最适合您的方式为准。

Just came across the same problem on a freshly installed CentOS 6.4 64-bit machine. A single yum command will fix this plus 99% of similar problems:

yum groupinstall "Compatibility libraries"

Either prefix this with 'sudo' or run as root, whichever works best for you.

莫多说 2024-12-25 22:47:52

一般来说,当你收到这样的错误时,只需执行以下操作

yum provides ld-linux.so.2

,你就会看到类似的内容:

glibc-2.20-5.fc21.i686 : The GNU libc libraries
Repo        : fedora
Matched from:
Provides    : ld-linux.so.2

然后你只需像 BRPocock 所写的那样运行以下命令(如果你想知道逻辑是什么......):

yum install glibc.i686

In general, when you get an error like this, just do

yum provides ld-linux.so.2

then you'll see something like:

glibc-2.20-5.fc21.i686 : The GNU libc libraries
Repo        : fedora
Matched from:
Provides    : ld-linux.so.2

and then you just run the following like BRPocock wrote (in case you were wondering what the logic was...):

yum install glibc.i686
终止放荡 2024-12-25 22:47:52

尝试

$ yum provides ld-linux.so.2
$ yum update
$ yum install glibc.i686 libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6

希望这能解决。

Try

$ yum provides ld-linux.so.2
$ yum update
$ yum install glibc.i686 libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6

Hope this clears out.

半透明的墙 2024-12-25 22:47:52

您还可以安装 OpenJDK 32 位 (.i686)。根据我的测试,它将安装并运行,没有问题。

sudo yum install java-1.8.0-openjdk.i686

笔记:

java-1.8.0-openjdk 包仅包含 Java 运行时环境。如果您想开发Java程序,请安装java-1.8.0-openjdk-devel包。

请参阅此处了解更多详细信息。

You can also install OpenJDK 32-bit (.i686) instead. According to my test, it will be installed and works without problems.

sudo yum install java-1.8.0-openjdk.i686

Note:

The java-1.8.0-openjdk package contains just the Java Runtime Environment. If you want to develop Java programs then install the java-1.8.0-openjdk-devel package.

See here for more details.

暗藏城府 2024-12-25 22:47:52

只是想在 BRPocock 中添加评论,但我没有足够的权限。

因此,我的贡献是为每个尝试从 IBM 的 Integration Bus 捆绑包安装 IBM Integration Toolkit 的人提供的。

当您尝试从文件夹 /Integration_Toolkit/IM_Linux 运行“安装管理器”命令(要运行的文件是“install”)时,您会收到本文中显示的错误。

您可以在 IBM 的网页中找到解决此问题的进一步说明:
https://www-304.ibm.com/support/docview.wss ?uid=swg21459143

希望这对尝试安装它的人有所帮助。

Just wanted to add a comment in BRPocock, but I don't have the sufficient privilegies.

So my contribution was for everyone trying to install IBM Integration Toolkit from IBM's Integration Bus bundle.

When you try to run "Installation Manager" command from folder /Integration_Toolkit/IM_Linux (the file to run is "install") you get the error showed in this post.

Further instructions to fix this problem you'll find in this IBM's web page:
https://www-304.ibm.com/support/docview.wss?uid=swg21459143

Hope this helps for anybody trying to install that.

尐偏执 2024-12-25 22:47:52

sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6

sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6

晒暮凉 2024-12-25 22:47:52

我想补充一下,对于 Debian,系统中至少需要一个编译器(根据 Debian Stretch 和 Jessie 32 位库)。

我安装了 apt-get install -y gcc-multilib 以便在基于 debian:jessie 的 docker 容器中运行 32 位可执行文件。

I would add for Debian you need at least one compiler in the system (according to Debian Stretch and Jessie 32-bit libraries ).

I installed apt-get install -y gcc-multilib in order to run 32-bit executable file in my docker container based on debian:jessie.

楠木可依 2024-12-25 22:47:52

就我而言,我已经使用命令 yum install redhat-lsb 解决了该问题

In my case, I have resolved the issue using command yum install redhat-lsb

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文