centos6.5 source installation gcc-4.8.5 (rpm)

1, download gcc-4.8.5.tar.bz2

2, tar-xvf gcc-4.8.5.tar.bz2 to extract as gcc-4.8.5

3, cd gcc-4.8.5 file into the directory

4,. / Contrib / download_prerequisites executed in gcc-4.8.5 directory of the command, which will be three new files in gcc-4.8.5 directory, which is dependent on the installation of the Big Three, the script will automatically download, decompression.

    It should be noted that the step operation is performed under gcc-4.8.5 directory, the result of the implementation is to create mpfr in gcc-4.8.5 directory, gmp, mpc three soft connection.

5, cd .. returns to the parent directory

6, mkdir gcc-build-4.8.5 and gcc-4.8.5 this file in the same directory

7, cd gcc-build-4.8.5 into the directory

8、../gcc-4.8.5/configure --prefix=/usr/local/gcc --enable-language=c,c++ --build=x86_64-linux

Create a new folder under the gcc / usr / local directory for storing files to compile the results.

9、make

make an error is encountered

/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
解决:yum install glibc-devel.i686 libstdc++-devel.i686或者--disable-multilib

 

If you do not put on a c compiler in advance, and then later uninstall

yum -y install gcc gcc-c++ gdb

 

10、make install

 

11, set the environment variable

cd back to normal user directory

you .bashrc

shift + G entered last line export PATH = / usr / local / gcc / bin: $ PATH

esc,: wq save and exit

source .bashrc

 

12, the test installation

g ++ -v

g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/local/gcc/libexec/gcc/x86_64-linux/4.8.5/lto-wrapper
Target: x86_64-linux
Configured with: ../gcc-4.8.5/configure --prefix=/usr/local/gcc --enable-language=c,c++ --build=x86_64-linux
Thread model: posix
gcc version 4.8.5 (GCC)


13, remove the old version

yum remove gcc
yum remove gcc-c++


14, add the man to help

vi /etc/man.config add the last line in the configuration file

Your MANPATH / usr / local / gcc / report this content share / man
----------------
Disclaimer: This article is the original article CSDN bloggers "zhuzitop", and follow CC 4.0 BY-SA copyright agreement , reproduced, please attach the original source link and this statement.
Original link: https: //blog.csdn.net/zhuzitop/article/details/80293965

 

Guess you like

Origin www.cnblogs.com/spruce/p/12092812.html