CentOS7 installation of high gcc version

CentOS7 installation of high gcc version

download

Download Source Package gcc hust from mirror sites.

http://mirror.hust.edu.cn/gnu/gcc/

I chose gcc-8.3.0.tar.gz.

cd 
mkdir software
cd software
wget http://mirror.hust.edu.cn/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz
tar zxvf gcc-8.3.0.tar.gz
cd gcc-8.3.0

Download dependencies:

./contrib/download_prerequisites

Configuration

mkdir build
cd build
../configure --prefix=/usr/local/gcc-8.3.0/ --enable-checking=release --enable-languages=c,c++ --disable-multilib

configure is an executable script that has a lot of options, use the command ./configure -help output a detailed list of options in the source directory to be installed. Which --prefix option is to configure the installation path.

If you do not configure --prefix option after installation:

Executable files on the default /usr /local/bin,

The default library file in /usr/local/lib,

The default configuration file is placed /usr/local/etc,

Other resources are placed/usr /local/share

Detailed configure the parameters:

--prefix=/usr/local/gcc-8.3.0/: All the resource files are placed in the path.

--enable-checking=release: The compiler generates do additional checks during compilation.

--enable-languages=c,c++: Let gcc supports c, c ++.

--disable-multilib: Not generate executable code compiled for other platforms cross compiler.

Compile

make

installation

make install

This process takes a long time.

Guess you like

Origin www.cnblogs.com/liutongqing/p/11277306.html