点赞,收藏,手有余香
https://linuxhostsupport.com/blog/how-to-install-gcc-on-centos-7/
不同版本GCC下载
http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/
wget http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/gcc-7.3.0/gcc-7.3.0.tar.gz
tar -xvf gcc-7.3.0.tar.gz
cd gcc-7.3.0
#下载GCC的依赖
./contrib/download_prerequisites
#配置
./configure --disable-multilib --enable-languages=c,c++
#编译
make -j 4
#指定安装路径
make install DESTDIR=$HOME/.local/gcc7.3
$ ~/.local/gcc7.3.0/usr/local/bin/gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
手动将gcc添加到环境变量PATH中,略.
export PATH=$HOME/.local/gcc7.3.0/usr/local/bin/:local$PATH
export LD_LIBRARY_PATH=$HOME/.local/gcc7.3.0/usr/local/lib/:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$HOME/.local/gcc7.3.0/usr/local/lib64/:$LD_LIBRARY_PATH
$gcc --version
gcc (GCC) 7.3.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
手动将gcc添加到环境变量PATH中,略.
其他GCC版本
http://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/releases/
网友评论