当在 CentOS 6.5 下执行某些命令时,有缺少共享库的报错:

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

解决办法

执行命令

yum whatprovides libstdc++.so.6

然后会提示哪个安装包有这个库文件如下:

yum whatprovides libstdc++.so.6
 Loaded plugins: aliases, changelog, downloadonly, fastestmirror, kabi, presto, refresh-packagekit, security, tmprepo, verify,
              : versionlock
 Loading support for CentOS kernel ABI
 Loading mirror speeds from cached hostfile
  * base: centos.ustc.edu.cn
  * centosplus: centos.ustc.edu.cn
  * contrib: centos.ustc.edu.cn
  * extras: centos.ustc.edu.cn
  * updates: centos.ustc.edu.cn
 libstdc++-4.4.7-3.el6.i686 : GNU Standard C++ Library
 Repo        : base
 Matched from:
 Other      : libstdc++.so.6

然后执行:

yum install libstdc++-4.4.7-3.el6.i686

搞定!

2018.10.6 补充:

或者直接运行:

yum -y install libstdc++
yum -y install libstdc++.i686