【建站】解决nodejs18+下lib库问题

相关文章

解决nodejs18+下lib库问题


系统环境

  • 操作系统:CentOS 7.9 64位
  • nodejs:v18.17.0

一、目标问题

1
2
3
4
5
6
7
[root@Jeffrey ai]# npm start
node: /lib64/libm.so.6: version `GLIBC_2.27' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.25' not found (required by node)
node: /lib64/libc.so.6: version `GLIBC_2.28' not found (required by node)
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)

二、处理 version `GLIBC_2.2X’ not found

更新glibc

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

可能遇到错误

1
2
3
configure: error: 
*** These critical programs are missing or too old: make bison compiler
*** Check the INSTALL file for required versions.

升级gcc与make

升级GCC(默认为4 升级为8)

1
2
3
4
5
6
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)

1
2
3
4
5
6
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

再次验证

cd /root/glibc-2.28/build
../configure –prefix=/usr –disable-profile –enable-add-ons –with-headers=/usr/include –with-binutils=/usr/bin

可能遇到错误

1
2
3
configure: error: 
*** These critical programs are missing or too old: bison
*** Check the INSTALL file for required versions.

查看并安装

1
# bison -v

没安装,就安装一下

1
# yum install -y bison

再次验证

1
2
# cd /root/glibc-2.28/build
# ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

没啥问题了,开始安装

时间有点久,半小时左右,可以去喝杯茶~

1
# make && make install

三、处理 version `CXXABI_1.3.9’ not found

1
2
3
4
5
6
7
8
9
cd /usr/local
wget http://ftp.de.debian.org/debian/pool/main/g/gcc-8/libstdc++6_8.3.0-6_amd64.deb
ar -x libstdc++6_8.3.0-6_amd64.deb
tar -xvf data.tar.xz
cp usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25 /usr/lib64/
find / -name "libstdc++*"
rm /usr/lib64/libstdc++.so.6
ll /usr/lib64/libstd*
ln -s /usr/lib64/libstdc++.so.6.0.25 /usr/lib64/libstdc++.so.6

喜欢这篇文章?打赏一下支持一下作者吧!
【建站】解决nodejs18+下lib库问题
https://www.cccccl.com/20230610/建站/解决nodejs18+下lib库问题/
作者
Jeffrey
发布于
2023年6月10日
许可协议