Linux libstdc++.so.5:无法打开共享对象文件 - 但库已安装且是最新的

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3731384/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 23:33:58  来源:igfitidea点击:

libstdc++.so.5: cannot open shared object file - but library is installed and up-to-date

linuxfedoralibstdc++

提问by Jake Wilson

My client had some developer write a small c++ command-line app to run on their Linux servers. On one of the servers (running Fedora 11), when I execute the app I get the following error:

我的客户让一些开发人员编写了一个小的 c++ 命令行应用程序来在他们的 Linux 服务器上运行。在其中一台服务器(运行 Fedora 11)上,当我执行应用程序时,出现以下错误:

error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

Obviously the first thing I did was

显然我做的第一件事是

yum install libstdc++

But I get

但我得到

Package libstdc++-4.4.1-2.fc11.x86_64 already installed and latest version

So the library already exists and is up-to-date. Usually to me these errors indicate a missing library. So where should I look next?

所以图书馆已经存在并且是最新的。通常对我来说,这些错误表明缺少库。那么接下来我应该看哪里呢?

采纳答案by Ken Bloom

libstdc++-4.4.1-2.fc11.x86_64installs libstdc++.so.6. You need the compat-libstdc++-33-3.2.3-66.x86_64package to get libstdc++.so.5. (Do not symlink! libstdc++.so.5and libstdc++.so.6are incompatible.)

libstdc++-4.4.1-2.fc11.x86_64安装libstdc++.so.6. 您需要该compat-libstdc++-33-3.2.3-66.x86_64软件包才能获取libstdc++.so.5. (不要符号链接!libstdc++.so.5并且 libstdc++.so.6不兼容。)

回答by Timo Geusch

Have you checked that the package does install libstdc++.so.5 and not some other version? That's your most likely problem.

您是否检查过该软件包是否安装了 libstdc++.so.5 而不是其他版本?那是你最有可能的问题。

回答by nos

libstdc++.so.5 is a very old version of the standard c++ library.

libstdc++.so.5 是标准 c++ 库的一个非常旧的版本。

Do a yum search libstdc++, you'll have to install one of the compat-libstdc++ packages.

做一个yum search libstdc++,你必须安装一个 compat-libstdc++ 包。

回答by anon

rpm hence the repo knows about shared library names and what provides them. So

rpm 因此,repo 知道共享库名称以及提供它们的内容。所以

yum install 'libstdc++.so.5'

wiil install whatever is necessary if the repo has it.

如果 repo 有它,wiil 安装任何必要的东西。

In your case it would fetch compat-libstdc++-33-3.2.3-66.i586.rpm and its 32-bit deps if you don't have them already because the binary you are trying to run is apparently 32-bit

在您的情况下,如果您还没有它们,它将获取 compat-libstdc++-33-3.2.3-66.i586.rpm 及其 32 位 deps,因为您尝试运行的二进制文件显然是 32 位

回答by andymal

yum install compat-libstdc++-33 solved this for me.

yum install compat-libstdc++-33 为我解决了这个问题。

回答by RunThor

As stated by caf and aaron, running yum install compat-libstdc++-33 libstdc++.so.5 -yworked for me when I got a similar error.

正如 caf 和 aaron 所说,yum install compat-libstdc++-33 libstdc++.so.5 -y当我遇到类似的错误时,跑步对我有用。

The only catch I ran into was, I didn't have the correct repo checked out so I had to run yum-config-manager --enable rhel-7-server-optional-rpmsto access the files. If you are using something other than RedHat 7 you will need to search for the correct repo.

我遇到的唯一问题是,我没有检出正确的存储库,所以我必须运行yum-config-manager --enable rhel-7-server-optional-rpms才能访问文件。如果您使用的是 RedHat 7 以外的其他东西,您将需要搜索正确的存储库。

You could always check if you have the correct repo by running yum provides libstdc++.so.5first.

您始终可以通过yum provides libstdc++.so.5首先运行来检查您是否拥有正确的存储库。

回答by Zakaria AnisInfo

worked for me too on RedHat 7 : error was :

在 RedHat 7 上也为我工作:错误是:

error while loading shared libraries: libstdc++.so.5: wrong ELF class: ELFCLASS32

加载共享库时出错:libstdc++.so.5:错误的 ELF 类:ELFCLASS32

The solution was :
yum install compat-libstdc++-33 libstdc++.so.5 -y

解决方案是:
yum install compat-libstdc++-33 libstdc++.so.5 -y