Compile source

  1. [root@liqiang.io]# wget https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz
  2. [root@liqiang.io]# tar zxf gcc-9.2.0.tar.gz && cd gcc-9.2.0
  3. [root@liqiang.io]# ./contrib/download_prerequisites
  4. [root@liqiang.io]# ./configure --disable-multilib # Important,Ignore 32 bit process
  5. [root@liqiang.io]# make -j 8 # It will take long time, I don't how long actually, just put it aside
  6. [root@liqiang.io]# make install

Rm old version

  1. [root@liqiang.io]# rm -f /usr/bin/gcc
  2. [root@liqiang.io]# rm -f /usr/bin/g++
  3. [root@liqiang.io]# unlink /usr/lib64/libstdc++.so.6
  1. [root@liqiang.io]# ln -s /usr/local/gcc9/bin/gcc /usr/bin/gcc
  2. [root@liqiang.io]# ln -s /usr/local/gcc9/bin/g++ /usr/bin/g++
  3. [root@liqiang.io]# ln -s /usr/local/lib64/libstdc++.so.6.0.27 /usr/lib64/libstdc++.so.6

Ref