GCC 8.2编译

apt-get install gcc g++ gcc-multilib

cd /opt/
wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-8.2.0/gcc-8.2.0.tar.xz
tar xvf gcc-8.2.0.tar.xz
cd gcc-8.2.0/

./contrib/download_prerequisites
apt install texinfo bison flex

====
直接编译会报错:
In file included from ../../../../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc:193:
../../../../libsanitizer/sanitizer_common/sanitizer_internal_defs.h:317:72: error: size of array ‘assertion_failed__1152’ is negative
     typedef char IMPL_PASTE(assertion_failed_##_, line)[2*(int)(pred)-1]
                                                                        ^
解决方法:
vi ../libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
Line 1152:
//CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
====

mkdir build
cd build
../configure --prefix=/usr/local/gcc --enable-languages=c,c++ --enable-multilib
make -j8
make install

/usr/local/gcc/bin/gcc -v
/usr/local/gcc/bin/g++ -v

update-alternatives --install /usr/bin/gcc gcc /usr/local/gcc/bin/gcc 50 --slave /usr/bin/g++ g++ /usr/local/gcc/bin/g++
update-alternatives --config gcc