Installation steps:
1. First download the GCC 4.1.2 Source code package:
wget http://mirrors.ustc.edu.cn/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2
2. Decompression:
Bzcat gcc-4.1. 2. Tar Tar xvf-
3. Create Destdir:
mkdir /usr/local/gcc-4.1. 2 /usr/local/gcc-4.1. 2
4. Configuration:
$/home/esms/downloads/gcc-4.1. 2/configure--prefix=/usr/local/gcc-4.1. 2 --enable-threads=posix--disable-checking--enable--Long-long --host= I386-redhat-linux--with-system-zlib--enable-languages=c,c++,java
5. Compiling:
Make
This process will often encounter problems, the actual machine type, the environment is very different, can only see a solution one:
1)/USR/BIN/LD:BFD 2.14.90.0.4 20030523 Internal error, aborting at.. /.. /BFD/ELF32-I386.C Line 2377 in Elf_i386_relocate_section
Workaround: First look at this article http://gcc.gnu.org/ml/gcc-help/2006-07/msg00043.html, probably because the binutils version is too low, so I would like to upgrade the next binutils:
wget FTP://ftp.kernel.org/pub/linux/devel/binutils/binutils-2.16.91.0.3.tar.gz
See this article to learn how to install: http://www.linuxfromscratch.org/lfs/view/6.2/chapter06/binutils.html
mkdir -V. /binutils-build $ cd . /binutils-build $.. /binutils-2.16. 91.0. 3/configure--prefix=/usr--enable- make tooldir=/ make Make Install CP -v. /binutils-2.16. 91.0. 3
Then re-execute make.
6. Installation:
Make Install
7, modify the shortcut:
$ cd/usr/Bin $MV GCCgcc323 $LN-s/usr/local/GCC-4.1.2/bin/GCC GCC $ MVg++ g++323 $ LN-s/usr/local/GCC-4.1.2/bin/g++ g++ $ MVGCJ gcj323 $LN-s/usr/local/GCC-4.1.2/BIN/GCJ GCJ
8, complete.
References:
1, User CHUNCN's Chinese Installation Guide: http://www.cnblogs.com/chuncn/archive/2010/10/15/1851853.html
2, GCC Installation instructions for 4.1.2 after decompression (English): gcc-4.1.2/install/index.html