在centos7.9上安装node提示GLIB的错误
这里以安装GLIBC_2.28为例
1、升级glibc2.28前置条件
查看升级glibc2.28所需编译器的版本号
我们查看安装包内的文件INSTALL
显示如下:
Recommended Tools for Compilation
=================================
We recommend installing the following GNU tools before attempting to
build the GNU C Library:
* GNU 'make' 4.0 or newer
As of relase time, GNU 'make' 4.2.1 is the newest verified to work
to build the GNU C Library.
* GCC 4.9 or newer
GCC 4.9 or higher is required.
- 可知,需要make4.0以后的版本,最新验证过的make版本是4.2.1
- 可知,需要gcc4.9或者更新版本。
2、查看本机的gcc版本、make版本
[dev1@localhost build]$ gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
[dev1@localhost build]$
[dev1@localhost build]$ make -v
GNU Make 3.82
Built for x86_64-redhat-linux-gnu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[dev1@localhost build]$
gcc升级到4.9
wget https://mirrors.ustc.edu.cn/gnu/gcc/gcc-4.9.0/gcc-4.9.0.tar.bz2
tar -jxvf gcc-4.9.0.tar.bz2
cd gcc-4.9.0
./contrib/download_prerequisites
mkdir build && cd build
../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
../configure --prefix=/usr/local/gcc --enable-bootstrap --enable-checking=release --enable-languages=c,c++ --disable-multilib
make -j4 && sudo make install
如果make -j4是报如下错误:
在make -j4时出现下面错误 error: no usable dependency style found。
需要安装gcc ,g++:yum -y install gcc+ gcc-c++
checking how to run the C++ preprocessor... /lib/cpp
configure: error: in `/home/doc/gcc-4.9.4/gcc-build-4.9/gcc':
configure: WARNING: C++ preprocessor "/lib/cpp" fails sanity check
See `config.log' for more details.
checking for unordered_map... no
checking for tr1/unordered_map... no
checking for ext/hash_map... no
checking dependency style of g++... none
configure: error: no usable dependency style found
make[2]: *** [configure-stage1-gcc] Error 1
make[2]: Leaving directory `/home/doc/gcc-4.9.4/gcc-build-4.9'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/doc/gcc-4.9.4/gcc-build-4.9'
make: *** [all] Error 2
make升级
# 升级 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
参考:
https://blog.csdn.net/u012559967/article/details/136344204
https://www.cnblogs.com/astonc/p/16660685.html