Build and install gcc on FEDORA 14 X84_64

This is a summary from the network.

1) Download gcc source code tarball gcc-4.7.0.tar.bz2 and mpfr source code tarball mpfr-3.1.0.tar.bz2 from ftp://gcc.gnu.org/pub/gcc/ and then unpack them.
2) Enter the gcc-4.7.0 directory, create a new build dir, say "mkdir build".
3) Enter "build" dir, configure gcc as below (errors are expected, we need install mpfr and gmp first):

[root@localhost build]#  ../configure --with-pkgversion=4.7.0 --prefix=/opt/gcc-4.7.0/ --program-suffix=47 --enable-threads=posix --disable-checking --enable-languages=c,c++
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
...
...
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries can be found at
their respective hosting sites as well as at
ftp://gcc.gnu.org/pub/gcc/infrastructure/.  See also
http://gcc.gnu.org/install/prerequisites.html for additional info.  If
you obtained GMP, MPFR and/or MPC from a vendor distribution package,
make sure that you have installed both the libraries and the header
files.  They may be located in separate packages.

4) Enter unpacked mpfr dir, configure mpfr as below (error is expected, mpfr depends on gmp package installed):

[nasadmin@localhost mpfr-3.1.0]$ ./configure
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
...

checking for TLS support... yes
checking for gmp.h... no
configure: error: gmp.h can't be found, or is unusable.


5) yum install "gmp-devel.x86_64"

6) Configure mpfr again, and then build, install

[nasadmin@localhost mpfr-3.1.0]$ ./configure
...
[nasadmin@localhost mpfr-3.1.0]$make
...
su to root and then make install
[root@localhost mpfr-3.1.0]$make install

7) Clean mpfr, and move the source code to gcc dir.
[nasadmin@localhost mpfr-3.1.0]# make distclean
[nasadmin@localhost work]$ mv mpfr-3.1.0 gcc-4.7.0

8) Configure gcc again.
[root@localhost build]#../configure --with-pkgversion=4.7.0 --prefix=/opt/gcc-4.7.0/ --program-suffix=47 --enable-threads=posix --disable-checking --enable-languages=c,c++

9) Compile the source code.
[root@localhost build]#make
....
In file included from ../../gcc/builtins.c:29:0:
../../gcc/realmpfr.h:27:17: fatal error: mpc.h: No such file or directory

10) [root@localhost work]# yum install libmpc-devel.x86_64

11) root@localhost build]#make
....
gcc -c   -g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include -I/usr/share/doc/gmp-4.3.1/include -I/home/nasadmin/work/gcc-4.7.0/build/./mpfr -I/home/nasadmin/work/gcc-4.7.0/mpfr  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/bid -I../libdecnumber    ../../gcc/lto-compress.c -o lto-compress.o
../../gcc/lto-compress.c:28:18: fatal error: zlib.h: No such file or directory

12) [root@localhost work]# yum install zlib-devel.x86_64

13) root@localhost build]#make

14) Install new gcc.
[root@localhost build]#make install

http://www.linuxquestions.org/questions/linux-software-2/installing-gcc-4-4-2-on-fedora-8-a-780791/
http://www.mjmwired.net/resources/mjm-fedora-gcc.html
http://blog.csdn.net/bokee/article/details/5380044
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值