Ubuntu 14.04 LST安装GCC 4.1.2

1. 下载&解压源码

$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.1.2/gcc-4.1.2.tar.bz2
$ tar xvjf gcc-4.1.2.tar.bz2

2. 安装依赖库, 以及软件

$ sudo apt-get install libc6-dev libgmp-dev libmpfr-dev texinfo

3. 为头文件以及所需库添加链接
添加如下链接, 这取决于你的 Ubuntu 系统架构, 如果你使用的是64位的ubuntu系统应当使用x86_64-linux-gnu替代i386-linux-gnu

$ cd /usr/include
$ sudo ln -s i386-linux-gnu/bits bits $ sudo ln -s i386-linux-gnu/gnu gnu $ sudo ln -s i386-linux-gnu/sys sys $ sudo ln -s i386-linux-gnu/asm asm $ cd /usr/lib $ sudo ln -s i386-linux-gnu/crt1.o crt1.o $ sudo ln -s i386-linux-gnu/crti.o crti.o $ sudo ln -s i386-linux-gnu/crtn.o crtn.o 

4. 编译gcc

$ cd gcc-4.1.2 $ mkdir build $ cd build $ ../configure --prefix=/usr/local --program-prefix=sse- --libexecdir=/usr/local/lib --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --disable-multilib --enable-languages=c,c++ $ make bootstrap

如果出现了如下错误:

WARNING: `makeinfo’ is missing on your system. You should only need it
if you modified a `.texi’ or `.texinfo’ file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy `make’ (AIX,
DU, IRIX). You might want to install the `Texinfo’ package or
the `GNU make’ package. Grab either from any GNU archive site.

请使用以下命令编译:

$ make bootstrap MAKEINFO=makeinfo

5. 安装gcc

$ make install
$ cd /usr/local/bin $ ll *gcc*

看到类似以下几个文件, 安装就完成了

i686-pc-linux-gnu-gcc-4.1.2 i686-pc-linux-gnu-ssegcc ssegcc ssegccbug

GCC 的详细介绍请点这里

猜你喜欢

转载自www.linuxidc.com/Linux/2016-06/132040.htm