ubuntu20.04中编译安装gcc 9.2.0,步骤如下:
#install compile dependence libraries
1:$ sudo apt install libgmp-dev libisl-dev libmpc-dev libmpfr-dev
# install gcc 9.2.0
# download source code
2:$ wget http://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.xz
# uncompress
3:$ tar -xJvf gcc-9.2.0.tar.xz
4:$ cd gcc-9.2.0
5:$ mkdir build && cd build
# configure
6:$ ../configure -prefix=/usr/local/gcc-9.2 -enable-checking=release -enable-languages=c,c++ --disable-multilib --disable-libsanitizer
PS: 我电脑默认的编译配置是32位和64位,但是32位的dev lib不齐全,最好关掉32位,--disable-multilib
关闭 sanitizer模块,否则编译不过
# compile with multi thread
7:$ make -j4
# install
8:$ sudo make install