centos7.5 解決缺少libstdc++.so.6庫的原因及解決辦法


centos7.5 解決缺少libstdc++.so.6庫的原因及解決辦法

執行node -v報錯如下:

[root@bogon ~]# node -v
node: error while loading shared libraries: libstdc++.so.6: cannot open shared object file: No such file or directory

先加載所有安裝包

yum repolist


查看哪個安裝包包含該庫:

yum provides libstdc++.so.6

執行結果:

[root@bogon ~]# yum whatprovides libstdc++.so.6
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.njupt.edu.cn
libstdc++-4.8.5-36.el7.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Provides    : libstdc++.so.6


可以看到安裝包 libstdc++-4.8.5-36.el7.i686


安裝libstdc++-4.8.5-36.el7.i686

yum -y install libstdc++-4.8.5-28.el7.x86_64

報錯:

       ...you can also use --setopt=protected_multilib=false to remove
       this checking, however this is almost never the correct thing to
       do as something else is very likely to go wrong (often causing
       much more problems).
       
       Protected multilib versions: libstdc++-4.8.5-36.el7.i686 != libstdc++-4.8.5-28.el7.x86_64


解決辦法:

1、升級安裝包

yum  update libstdc++-4.8.5-28.el7.x86_64 -y


2、修復/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory問題

yum install glibc.i686 -y

3、 修復error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory

yum install zlib.i686 -y


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

先查找這個庫存在於哪個安裝包中

yum whatprovides libstdc++.so.6

執行結果:

[root@bogon ~]# yum whatprovides libstdc++.so.6
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.njupt.edu.cn
 * extras: mirrors.163.com
 * updates: mirrors.njupt.edu.cn
libstdc++-4.8.5-36.el7.i686 : GNU Standard C++ Library
Repo        : base
Matched from:
Provides    : libstdc++.so.6


可以看到包  libstdc++-4.8.5-36.el7.i686


安裝libstdc++-4.8.5-36.el7.i686

yum install libstdc++-4.8.5-36.el7.i686 -y


到此就解決了缺少共享庫到問題



參照文檔:

https://blog.csdn.net/qiaoliang328/article/details/79266008

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM