您的位置:首页 > 产品设计 > UI/UE

Build and install gcc on FEDORA 14 X84_64

2012-05-15 22:21 405 查看
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

/article/8323071.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: