--> 解决依赖关系完成
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:libm.so.6(GLIBC_2.27)(64bit)
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:libstdc++.so.6(GLIBCXX_3.4.21)(64bit)
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:glibc >= 2.28
          已安装: glibc-2.17-317.el7.x86_64 (@anaconda)
              glibc = 2.17-317.el7
          可用: glibc-2.17-322.el7_9.i686 (updates)
              glibc = 2.17-322.el7_9
          可用: glibc-2.17-323.el7_9.i686 (updates)
              glibc = 2.17-323.el7_9
          可用: glibc-2.17-324.el7_9.i686 (updates)
              glibc = 2.17-324.el7_9
          可用: glibc-2.17-325.el7_9.i686 (updates)
              glibc = 2.17-325.el7_9
          可用: glibc-2.17-326.el7_9.i686 (updates)
              glibc = 2.17-326.el7_9
          可用: glibc-2.17-326.el7_9.3.i686 (updates)
              glibc = 2.17-326.el7_9.3
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:libstdc++.so.6(GLIBCXX_3.4.20)(64bit)
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:libc.so.6(GLIBC_2.28)(64bit)
错误:软件包:2:nodejs-18.20.4-1nodesource.x86_64 (nodesource-nodejs)
          需要:libstdc++.so.6(CXXABI_1.3.9)(64bit)
 您可以尝试添加 --skip-broken 选项来解决该问题
 您可以尝试执行:rpm -Va --nofiles --nodigest

解决办法:

centos在2024年6月30日停止维护,因此yum的默认镜像地址http://mirrorlist.centos.org也无法访问了。需要更正yum源配置,如下是步骤

1 更正.repo文件里的mirrors信息,然后安装centos-release-scl和centos-release-scl-rh,以使得devtoolset*系列的包可用

在/etc/yum.repos.d目录下执行如下命令:

sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo

sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo

sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo

sudo yum clean all

sudo yum makecache

2 安装gcc8

sudo yum install devtoolset-8

3 进入devtoolset-8环境

source /opt/rh/devtoolset-8/enable,并将其加入到~/.bashrc中

# 升级GCC(默认为4 升级为8)
yum install -y centos-release-scl
yum install -y devtoolset-8-gcc*
mv /usr/bin/gcc /usr/bin/gcc-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/gcc /usr/bin/gcc
mv /usr/bin/g++ /usr/bin/g++-4.8.5
ln -s /opt/rh/devtoolset-8/root/bin/g++ /usr/bin/g++

# 升级 make(默认为3 升级为4)
wget http://ftp.gnu.org/gnu/make/make-4.3.tar.gz
tar -xzvf make-4.3.tar.gz && cd make-4.3/
./configure  --prefix=/usr/local/make
make && make install
cd /usr/bin/ && mv make make.bak
ln -sv /usr/local/make/bin/make /usr/bin/make

报错

/usr/bin/ld: cannot find -lnss_test2
collect2: error: ld returned 1 exit status
Execution of gcc -B/usr/bin/ failed!
The script has found some problems with your installation!
Please read the FAQ and the README file and check the following:
- Did you change the gcc specs file (necessary after upgrading from
  Linux libc5)?
- Are there any symbolic links of the form libXXX.so to old libraries?
  Links like libm.so -> libm.so.5 (where libm.so.5 is an old library) are wrong,
  libm.so should point to the newly installed glibc file - and there should be
  only one such link (check e.g. /lib and /usr/lib)
You should restart this script from your build directory after you've
fixed all problems!
Btw. the script doesn't work if you're installing GNU libc not as your
primary library!
make[1]: *** [Makefile:111: install] Error 1
make[1]: Leaving directory '/dat/glibc/glibc-2.28'
make: *** [Makefile:12:install] 错误 2


网上说此错误可以无视

验证
ls -l /lib64/libc.so.6

升级glibc

wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar xf glibc-2.28.tar.gz 
cd glibc-2.28/ && mkdir build  && cd build
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install

安装过程挺长的 , 出现上面的错误无视


 

参考: https://www.cnblogs.com/dingshaohua/p/17103654.html

使用nodejs报错

./node: /lib64/libstdc++.so.6: version `CXXABI_1.3.9' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./node)
./node: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./node)

通过命令检查

strings /usr/lib64/libstdc++.so.6 | grep CXXABI

发现最高版本只有 1.3.7

解决办法


1.  执行以下命令,查找编译gcc时生成的最新动态库:

find / -name "libstdc++.so.*"

2. 将上面的最新目录复制到/usr/lib64/目录下:

cp /dat/docker/overlay2/91d0f194e44dada6347afd7ab214a5eb3f758d94c227ae66cc9ec3399bd3a9f8/merged/usr/lib/libstdc++.so.6.0.22 /usr/lib64/
尝试了, 22,30版本都不对, 从别的系统拷贝了 29版本过来,就可以了


3. 将libstdc++.so.6连接到libstdc++.so.6.0.29上去:

cd /usr/lib64 
rm -rf libstdc++.so.6 
ln -s libstdc++.so.6.0.29 libstdc++.so.6

4.默认动态库升级完成。重新运行以下命令检查动态库:
strings /usr/lib64/libstdc++.so.6 | grep 'CXXABI'

node18 记得要用22, 不然用30会报错

接着报错

/usr/local/node/node-v18.20.4-linux-x64/bin/node: error while loading shared libraries: libc.musl-x86_64.so.1: cannot open shared object file: No such file or directory

然后查询出来拷贝一下

find / -name "libc.musl-x86_64.so.1"
cp /dat/docker/overlay2/91d0f194e44dada6347afd7ab214a5eb3f758d94c227ae66cc9ec3399bd3a9f8/merged/lib/libc.musl-x86_64.so.1 /usr/lib64

然后接着报错

/lib64/libstdc++.so.6: no version information available

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部