|||
先下载最新版的GCC
http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.2.0/gcc-7.2.0.tar.xz
解压:
tar --xz -xvf gcc-7.2.0.tar.xz
cd gcc-7.2.0
新手最多的问题是安装包的依赖问题,如下所示:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.4.0+ 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.
而按照这些软件包,费事,配置还麻烦;其实GCC已经替我们想好了,只是大家不知道,
直接运行:
./contrib/download_prerequisites
所有相关的软件就按照好了!!!
然后就可以方便的编译了。
nohup ./configure --disable-multilib --prefix=$PWD/../gcc 1>log 2>err &
nohup make -j 3 1>m.log 2>m.err &
make install
然后大功告成!!
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-12-22 00:14
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社