Current Environment: Centos6.5_64-minimal
First install GCC and gcc-c++
[Email protected] ~]# Rpm-qa | grep gcclibgcc-4.4.7-11.el6.x86_64[[email protected] ~]# yum install-y gcc gcc-c++ #安装gcc, gcc-c++ can be compiled and installed behind the later version of GCC [Email protected] ~]# Rpm-qa | grep gcclibgcc-4.4.7-11.el6.x86_64gcc-4.4.7-11.el6.x86_64gcc-c++-4.4.7-11.el6.x86_64
1. Download the source package
wget http://ftp.gnu.org/gnu/gcc/gcc-4.8.2/gcc-4.8.2.tar.bz2 Decompression: TAR-JXVF gcc-4.8.2.tar.bz2
2. Download the required libraries for compilation
CD gcc-4.8.2./contrib/download_prerequisites CD.
3. Build the compiled output directory
mkdir gcc-build-4.8.2
4. Enter this directory and execute the following command to generate the makefile file
CD gcc-build-4.8.2. /gcc-4.8.2/configure--enable-checking=release--enable-languages=c,c++--disable-multilib
5. Compiling
make -j4 #j4选项是make对多核处理器的优化,如果不成功请使用 make
If the compilation succeeds, then the time is relatively long, half an hour or so, so if you look at it has been in the output did not immediately stop, should be very happy!
6. Installation
Make install
7. Switch GCC to the new versiondetermine the path of the newly installed GCC, the general default is under/usr/local/bin.add a new gcc to the optional, the last third is the name, the penultimate parameter is the new GCC path, the final parameter 40 is the priority, and the new version is automatically used after setting a larger one.
Update-alternatives--INSTALL/USR/BIN/GCC gcc/usr/local/bin/x86_64-unknown-linux-gnu-gcc-4.8.2 40
8. Verify that the current version has been switched to the new
Gcc-v
Upgrade GCC to 4.8.2