sudo cd /usr/local/src
sudo wget http://ftp.gnu.org/gnu/gcc/gcc-7.1.0/gcc-7.1.0.tar.bz2
sudo tar -jxvf gcc-7.1.0.tar.bz2
sudo cd gcc-7.1.0
sudo ./contrib/download_prerequisites
sudo mkdir gcc-temp
sudo ./configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
sudo make -j4
sudo make install
mv /usr/bin/gcc /usr/bin/gcc.bak // 将原本的gcc重命名(删除亦可)
ln -s /usr/local/bin/x86_64-pc-linux-gnu-gcc /usr/bin/gcc
update-alternatives --install /usr/bin/gcc gcc /usr/local/bin/x86_64-pc-linux-gnu-gcc 40
备注
centos系列,编译之前先安装下开发工具,避免缺少什么而报错
yum groupinstall "Development Tools"
运行pyinstaller报错,根据提示安装
yum install python3-devel
编译gcc出现make[3]: Leaving directory 错误:
yum install glibc-headers
yum install gcc-c++