# Tl;dr install gcc-9.3.0、make4.3、glibc-2.31 on centos7. # dependencies ```bash docker run -it centos:7 bash ``` ```bash cat /etc/redhat-release ``` ```bash CentOS Linux release 7.8.2003 (Core) ``` ```bash /bin/cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup \ && sed -i "s@#baseurl@baseurl@g" /etc/yum.repos.d/CentOS-Base.repo \ && sed -i "s@mirrorlist=http@#mirrorlist=http@g" /etc/yum.repos.d/CentOS-Base.repo \ && sed -i "s@baseurl=.*/centos@baseurl=https://mirrors.huaweicloud.com/centos@g" /etc/yum.repos.d/CentOS-Base.repo \ && yum clean all \ && yum makecache \ && yum update -y \ && yum groupinstall "Development Tools" -y \ && yum install glibc-static libstdc++-static -y \ && yum install python3 python3-devel wget -y \ && gcc -v; \ ls -ltr /usr/lib64 |grep -E 'libc-|libstdc++' ## wget config proxy cat > ~/.wgetrc < 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:120: install] Error 1 make[1]: Leaving directory '/glibc-2.31' make: *** [Makefile:12: install] Error 2 # https://garlicspace.com/2020/07/18/centos7-%E5%8D%87%E7%BA%A7-glibc-gcc/ ``` # centos-release-scl-rh ```bash yum update; yum install centos-release-scl-rh -y; yum update; yum install devtoolset-9-toolchain -y yum install devtoolset-8-toolchain -y scl enable devtoolset-9 bash # or scl enable devtoolset-8 bash ``` # debian10-gcc ```bash docker run -it --rm debian:10 sed -i "s|deb.debian.org|mirrors.huaweicloud.com|g" /etc/apt/sources.list && \ sed -i "s|security.debian.org|mirrors.huaweicloud.com|g" /etc/apt/sources.list && \ apt-get clean && \ apt-get update && \ apt-get -y upgrade && \ apt-get install build-essential wget curl python3 python3-dev python3-distutils -yq gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/8/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 8.3.0-6' --with-bugurl=file:///usr/share/doc/gcc-8/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-8 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 8.3.0 (Debian 8.3.0-6) ls -ltr /usr/lib/x86_64-linux-gnu/ |grep -E 'libstdc++' -rw-r--r-- 1 root root 1570256 Apr 6 2019 libstdc++.so.6.0.25 lrwxrwxrwx 1 root root 19 Apr 6 2019 libstdc++.so.6 -> libstdc++.so.6.0.25 ls -ltr /lib/x86_64-linux-gnu/ |grep -E 'libc-|libstdc++' lrwxrwxrwx 1 root root 12 May 1 2019 libc.so.6 -> libc-2.28.so -rwxr-xr-x 1 root root 1824496 May 1 2019 libc-2.28.so ``` # ref * [Index of /gnu/gcc/](https://mirrors.aliyun.com/gnu/gcc/) * [Index of /gnu/make/](https://mirrors.aliyun.com/gnu/make/) * [Index of /gnu/glibc/](https://mirrors.aliyun.com/gnu/glibc/) * [Index of /gnu/gdb/](https://mirrors.ustc.edu.cn/gnu/gdb/) * [Index of /gnu/gcc/gcc-10.2.0/](https://mirrors.ustc.edu.cn/gnu/gcc/gcc-10.2.0/) * [Centos 7 升级gcc - 简书](https://www.jianshu.com/p/36f5d3524240) * [centos7 升级 glibc && gcc](https://garlicspace.com/2020/07/18/centos7-%E5%8D%87%E7%BA%A7-glibc-gcc/) * [解决 Linux “GLIBCXX_* not found” 问题 | Wangriyu’s Blog](https://blog.wangriyu.wang/2018/08-Linux_libc.html) * [CentOS7下升级GLIBC2.31](https://mp.weixin.qq.com/s/hMur4vY4pTK494EluPe9cA) * [centos7升级glibc | 哈特中尉's Blog](https://www.pengyan.top/2017/09/08/centos7-glibc-update/)