作者:じ☆ve宝贝
发布时间:2024-09-09T10:55:50
由于jenkins服务器是centos7.5的系统,在使用nodejs 20版本打包时,提示node: /lib64/libm.so.6: version 'GLIBC_2.27' not found, 这是因为Node v18开始,需要GLIBC_2.27支持。
strings /lib64/libc.so.6 |grep GLIBC_
# 输出结果
GLIBC_2.2.5
……
GLIBC_2.16
GLIBC_2.17
# 备份旧的源
cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum clean all
sudo yum makecache
# 升级GCC(默认为4 升级为8)
yum install -y centos-release-scl
# 此处需要注意,可能centos-release-scl会安装失败导致提示无法找到devtoolset-8-gcc
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++
cd /etc/yum.repos.d
vi CentOS-SCLo-rh.repo
# 添加一下内容
[centos-sclo-rh]
name=CentOS-7 - SCLo rh
baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
# 添加内容结束
# 执行yum clean 和 重建缓存
sudo yum clean all
sudo yum makecache
# 执行完成以上步骤 再次执行 yum install -y devtoolset-8-gcc* 即可
# 执行一下make -v 判断一下当前make版本,如果不是4版本则升级
make -v
# 升级make
cd /data/soft
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
# 下载 glibc2.28
cd /data/soft
wget http://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.gz
tar -zxvf glibc-2.28.tar.gz
cd glibc-2.28/ && mkdir build && cd build
# 如果已经编译过了,但是报错了,要重新执行的话,需要先清空build目录,这个目录自己创建的清空没事,编译目录要保持为空
../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make && make install
##
# 结果
LD_SO=ld-linux-x86-64.so.2 CC="gcc -B/usr/bin/" /usr/bin/perl scripts/test-installation.pl /opt/module/mysql-lib/glibc-2.28/build/
/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 '/opt/module/mysql-lib/glibc-2.28'
make: *** [Makefile:12: install] Error 2
这上面的问题可以忽略
strings /lib64/libc.so.6 |grep GLIBC_
cd /data/soft
# 更新lib libstdc++.so.6.0.26
wget https://cdn.frostbelt.cn/software/libstdc%2B%2B.so.6.0.26
# 替换系统中的/usr/lib64
cp libstdc++.so.6.0.26 /usr/lib64/
cd /usr/lib64/
ln -snf ./libstdc++.so.6.0.26 libstdc++.so.6