libstdc++.so.5:无法打开共享对象文件 - 但库已安装并且是最新的
我的客户让一些开发人员编写了一个小型 C++ 命令行应用程序以在他们的 Linux 服务器上运行。在其中一台服务器(运行 Fedora 11)上,当我执行该应用程序时,出现以下错误:
error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory
显然我做的第一件事是
yum install libstdc++
但是我得到
Package libstdc++-4.4.1-2.fc11.x86_64 already installed and latest version
所以该库已经存在并且是最新的。通常对我来说,这些错误表明缺少库。那么接下来我该看哪里呢?
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:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
rpm 因此,存储库知道共享库名称以及提供它们的内容。所以
如果repo有的话,会安装任何必要的东西。
在你的情况下,如果你不这样做,它会获取compat-libstdc++-33-3.2.3-66.i586.rpm及其32位依赖已经有了它们,因为您尝试运行的二进制文件显然是 32 位的
rpm hence the repo knows about shared library names and what provides them. So
wiil install whatever is necessary if the repo has it.
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
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
不兼容。)libstdc++-4.4.1-2.fc11.x86_64
installslibstdc++.so.6
. You need thecompat-libstdc++-33-3.2.3-66.x86_64
package to getlibstdc++.so.5
. (Do not symlink!libstdc++.so.5
andlibstdc++.so.6
are incompatible.)yum install compat-libstdc++-33 为我解决了这个问题。
yum install compat-libstdc++-33 solved this for me.
libstdc++.so.5 是标准 C++ 库的一个非常旧的版本。
执行
yum search libstdc++
,您必须安装 compat-libstdc++ 软件包之一。libstdc++.so.5 is a very old version of the standard c++ library.
Do a
yum search libstdc++
, you'll have to install one of the compat-libstdc++ packages.正如 caf 和 aaron 所说,当我遇到类似的错误时,运行
yum install compat-libstdc++-33 libstdc++.so.5 -y
对我有用。我遇到的唯一问题是,我没有签出正确的存储库,因此我必须运行 yum-config-manager --enable rhel-7-server-Optional-rpms 才能访问文件。如果您使用的是 RedHat 7 以外的其他版本,您将需要搜索正确的存储库。
您始终可以先运行 yum gets libstdc++.so.5 来检查是否拥有正确的存储库。
As stated by caf and aaron, running
yum install compat-libstdc++-33 libstdc++.so.5 -y
worked for me when I got a similar error.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-rpms
to access the files. If you are using something other than RedHat 7 you will need to search for the correct repo.You could always check if you have the correct repo by running
yum provides libstdc++.so.5
first.在 RedHat 7 上也为我工作:错误是:
解决方案是:
yum install compat-libstdc++-33 libstdc++.so.5 -y
worked for me too on RedHat 7 : error was :
The solution was :
yum install compat-libstdc++-33 libstdc++.so.5 -y
您是否检查过该软件包是否安装了 libstdc++.so.5 而不是其他版本?这是你最有可能遇到的问题。
Have you checked that the package does install libstdc++.so.5 and not some other version? That's your most likely problem.