centos,nodejs升级+GLIBC升级

新版本node 报错

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)

处理报错信息: node: /lib64/libc.so.6: version `GLIBC_2.28’ not found (required by node)

​cd /usr/local/
wget https://mirror.bjtu.edu.cn/gnu/libc/glibc-2.28.tar.xz --no-check-certificate
tar -xf glibc-2.28.tar.xz
cd glibc-2.28/
mkdir build
cd build/
../configure --prefix=/usr/local/glibc-2.28

报错

configure: error: in `/data/pkg/glibc-2.28/build':
configure: error: no acceptable C compiler found in $PATH

需要安装gcc

yum install gcc

继续执行

../configure --prefix=/usr/local/glibc-2.28

报错

These critical programs are missing or too old: make bison compiler
Check the INSTALL file for required versions.

make bison compiler太过老旧
解决:
升级GCC编译器

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

升级make

wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
tar -xzvf make-4.2.tar.gz
cd make-4.2
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/bin/make
sudo cp ./make /usr/bin/
make -v

再次回到GLIBC目录(升级有风险,记得先备份)

cd /usr/local/glibc-2.28/build/
yum install -y bison
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make  //make 运行时间较长
make install

node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14’ not found (required by node)

# node -v
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.14' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.18' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by node)
node: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by node)

首先,检查动态库:

# strings /usr/lib64/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.4
GLIBC_2.3.2
GLIBCXX_FORCE_NEW
GLIBCXX_DEBUG_MESSAGE_LENGTH

发现最高只有 GLIBCXX_3.4.13,所以这里需要下载最新gcc库:

wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-9.5.0/gcc-9.5.0.tar.gz

gcc下载网址
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/

tar -zxvf gcc-9.5.0.tar.gz

编译配置

cd gcc-9.5.0/ 
./contrib/download_prerequisites
mkdir build
cd build   
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib

如果有报错参考下面报错处理方案

提前安装依赖

yum install  gmp  gmp-devel  mpfr  mpfr-devel  libmpc  libmpc-devel

报错1:

configure: error: in `/root/test/glibc-2.28/build’:
configure: error: no acceptable C compiler found in $PATH
yum install gcc

报错2:

These critical programs are missing or too old: make bison compiler
Check the INSTALL file for required versions.

解决:
升级GCC编译器

yum -y install centos-release-scl
yum -y install devtoolset-8-gcc devtoolset-8-gcc-c++ devtoolset-8-binutils
scl enable devtoolset-8 bash
echo "source /opt/rh/devtoolset-8/enable" >>/etc/profile

升级make

wget http://ftp.gnu.org/gnu/make/make-4.2.tar.gz
tar -xzvf make-4.2.tar.gz
cd make-4.2
sudo ./configure
sudo make
sudo make install
sudo rm -rf /usr/bin/make
sudo cp ./make /usr/bin/
make -v

报错3:

tar (child): lbzip2: Cannot exec: No such file or directory

yum安装bzip2

yum -y install bzip2

或源码安装

tar zxvf bzip2-1.0.6.tar.gz
cd bzip2-1.0.6/
#为编译做准备,创建libbz2.so动态链接库(这一步很重要,安装python的时候如果没有这一步,python安装不上bz2模块):
make -f Makefile-libbz2_so
make && make install

编译时间有点长

make && make install
cp /usr/local/lib64/libstdc++.so.6.0.28 /usr/lib64
cd /usr/lib64
rm -rf libstdc++.so.6
ln -s libstdc++.so.6.0.28 libstdc++.so.6
# strings /usr/lib64/libstdc++.so.6 | grep GLIBC
GLIBCXX_3.4
GLIBCXX_3.4.1
GLIBCXX_3.4.2
GLIBCXX_3.4.3
GLIBCXX_3.4.4
GLIBCXX_3.4.5
GLIBCXX_3.4.6
GLIBCXX_3.4.7
GLIBCXX_3.4.8
GLIBCXX_3.4.9
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13
GLIBCXX_3.4.14
GLIBCXX_3.4.15
GLIBCXX_3.4.16
GLIBCXX_3.4.17
GLIBCXX_3.4.18
GLIBCXX_3.4.19
GLIBCXX_3.4.20
GLIBCXX_3.4.21
GLIBCXX_3.4.22
GLIBCXX_3.4.23
GLIBCXX_3.4.24
GLIBCXX_3.4.25
GLIBCXX_3.4.26
GLIBCXX_3.4.27
GLIBCXX_3.4.28
GLIBC_2.2.5
GLIBC_2.3
GLIBC_2.14
GLIBC_2.6
GLIBC_2.4
GLIBC_2.18
GLIBC_2.16
GLIBC_2.17
GLIBC_2.3.2
GLIBCXX_DEBUG_MESSAGE_LENGTH

你可能感兴趣的:(前端,linux,centos,linux,运维,node.js)