# 安装依赖的东东
yum install -y gcc gcc-c++ glibc-devel openssl-devel openssl-static zlib-devel lzma tk-devel xz-devel bison bzip2 bzip2-devel ncurses-devel gdbm-devel readline-devel sqlite-devel libffi-devel texinfo libmpc-devel
# 安装make
cd /chz/install/make
wget http://ftp.gnu.org/pub/gnu/make/make-4.4.1.tar.gz
tar zxvf make-4.4.1.tar.gz
cd /chz/install/make/make-4.4.1
mkdir build
cd build
cd /chz/install/make/make-4.4.1/build
../configure --prefix=/usr/
bash build.sh
make install
# 安装gcc
yum erase gcc-4.8.5-44.el7.x86_64
yum install centos-release-scl
yum install -y devtoolset-8-gcc devtoolset-8-gcc-c++
scl enable devtoolset-8 bash
# 看下gcc的版本
gcc -v
# 找出gcc的位置
which gcc
<<<< 位置如下:
/opt/rh/devtoolset-8/root/usr/bin/gcc
>>>>
vim /etc/profile
<<<< 添加内容:
export PATH=/opt/rh/devtoolset-8/root/usr/bin:$PATH
>>>>
# 安装python3
wget https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tgz
tar -zxf Python-3.8.0.tgz
cd Python-3.8.0
mkdir build
cd build
mkdir /usr/local/python3
../configure --prefix=/usr/local/python3
make -j4
make install
vim /etc/profile
<<<< 添加以下内容
export PYTHON3_HOME=/usr/local/python3
export PATH=$PYTHON3_HOME/bin:$PATH
>>>>
ls -s /usr/local/python3/bin/python3 /usr/bin/python3
# 安装glibc
wget https://ftp.gnu.org/gnu/glibc/glibc-2.36.tar.gz
tar zxvf glibc-2.36.tar.gz
cd glibc-2.36
mkdir build
cd build
cd /chz/install/glibc/glibc-2.36/build
../configure --prefix=/usr
make -j4
make install
在【make install】的时候如果报错:
gcc: relocation error: /lib64/libc.so.6: symbol __tunable_get_val, version GLIBC_PRIVATE not defined in file ld-linux-x86-64.so.2 with link time reference
make[1]: *** [Makerules:1033: /chz/install/glibc/glibc-2.36/build/format.lds] Error 127
make[1]: Leaving directory '/chz/install/glibc/glibc-2.36'
make: *** [Makefile:12: install] Error 2
解决方案如下:
先运行:
LD_PRELOAD=/lib64/libc-2.17.so sln /chz/install/glibc/glibc-2.36/build/libc.so.6 /lib64/libc.so.6
LD_PRELOAD=/lib64/libc-2.17.so sln /chz/install/glibc/glibc-2.36/build/dlfcn/libdl.so.2 /lib64/libdl.so.2
LD_PRELOAD=/lib64/libc-2.17.so sln /chz/install/glibc/glibc-2.36/build/nptl/libpthread.so.0 /lib64/libpthread.so.0
LD_PRELOAD=/lib64/libc-2.17.so sln /chz/install/glibc/glibc-2.36/build/elf/ld-linux-x86-64.so.2 /usr/lib64/ld-linux-x86-64.so.2
注意上面的【/lib64/libc-2.17.so】是我机器上的版本号,要换成自己的版本号
注意上面的【/chz/install/glibc/glibc-2.36/build】是我编译glibc的目录,要换成自己的目标
然后再次执行
make install
执行一下【strings /lib64/libc.so.6 | grep GLIBC】试试,这时候应该正常了
# 以下是对我有帮助的两篇文章
https://roy.wang/centos7-upgrade-glibc/
https://liuchunjie.top/?id=453