我试图在运行OS X 10.7.4的MacBook Pro上构建GCC-4.7.0 . 但是,我仍然遇到同样的错误:
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
运行以下行后发生此错误:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
为了摆脱这个错误,我尝试了以下操作:
- 使用自制软件我下载了gmp-5.0.4,mpc-0.21和mpfr-3.1.0 . 此时我尝试使用以下命令指向gmp,mpc和mpfr所在的位置:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/ --with-mpfr=/usr/local/Cellar/ --with-mpc=/usr/local/Cellar/
但是,这导致了同样的错误 . 所以,我尝试将gcc指向Cellar目录周围的不同位置:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/ --with-mpfr=/usr/local/Cellar/mpfr --with-mpc=/usr/local/Cellar/mpc/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/ --with-mpc=/usr/local/Cellar/mpc/0.21/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/Cellar/gmp/5.0.4/include/ --with-mpfr=/usr/local/Cellar/mpfr/3.1.0/include/ --with-mpc=/usr/local/Cellar/mpc/0.21/share/
最后这些都产生了同样的错误 . 然后我从gcc错误消息(在这里找到:ftp://gcc.gnu.org/pub/gcc/infrastructure/)下载了gmp,mpc和mpfr链接的版本 . 从源代码构建这些并运行所有相同的配置后,我留下了同样的问题 . 我尝试使用此安装的配置是:
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/ --with-mpfr=/usr/local/ --with-mpc=/usr/local/
./configure --prefix=/Users/jreese/Documents/school/edinburgh/project/local/ --with-gmp=/usr/local/include/ --with-mpfr=/usr/local/include/ --with-mpc=/usr/local/include/
然后我在某处读到如果我没有明确地将配置设置为在64位模式下运行可能会出现问题 . 所以,我再次使用'CC = gcc -m64'的设置尝试了所有这些配置 . 但这并没有改变任何事情 . 如果有人有任何想法我会非常感激 .
3 回答
如果您不知道如何构建并正确地将GCC的配置指向库,您可以将它们放在GCC自身的源代码树中:
/ some / dir / source / gcc / [libstdc | libgomp | gcc | libiberty | ....] / some / dir / source / gcc / gmp / [configure | ...] / some / dir / source / gcc / mpfr / [configure | ...] / some / dir / source / gcc / mpc / [configure | ...]
所以没有附加版本号 . 然后只运行GCC configure,不带任何与GMP / MPC / MPFR相关的参数 .
我遇到了同样的问题,通过安装相应的开发包很容易解决:gmp-devel,mpfr-devel和libmpc-devel
EasyBuild(一种使构建软件更容易的工具)可以在这里提供帮助 . 它附带一个小的easyconfig文件,用于指定要构建的GCC版本以及要启用的功能(请参阅例如https://github.com/hpcugent/easybuild/blob/master/easybuild/easyconfigs/g/GCC/GCC-4.7.0.eb) .
下载EasyBuild并对其进行配置后,即可运行
将EBHOME设置为解压缩EasyBuild的位置,将myGCC.eb设置为示例GCC easyconfig的副本,您可以根据需要进行修改 .
此命令将为您下载GCC源代码tarball,并在对任何依赖项(例如GMP,MPFR和MPC)执行相同操作后构建/安装它,从而为您节省很多麻烦 .
有关EasyBuild的更多信息,请参阅https://github.com/hpcugent/easybuild/wiki .