Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-28 17:24:01

In the directory where I have those libraries installed (/usr/gnu64/lib), I also have a libgmp.la file (and libmpc.la and libmpfr.la files), which contain readable text. The SO version information is in there, but that is not quite the same as the 'product version'. It tells about link compatibility instead.

I was trying to investigate which version I had, and the weird solution I came up with was to run the GCC (4.6.1) that I built with the -v option. In part, it said:

GNU C (GCC) version 4.6.1 (x86_64-apple-darwin11.1.0)
    compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.0, MPC version 0.8.2
warning: GMP header version 5.0.1 differs from library version 5.0.2.
warning: MPFR header version 3.0.0 differs from library version 3.1.0.
warning: MPC header version 0.8.2 differs from library version 0.9.

So, it appears that I have GMP 5.0.2 installed (but I built GCC with 5.0.1), and MPFR 3.1.0 (but I built GCC with 3.0.0) and MPC 0.9 (but I built GCC with 0.8.2). The mismatch comes about because I tried to compile and install GCC 4.6.2 and it presumably needed the newer versions. (I didn't succeed, but that's a different story.)

I install my custom-built libraries in /usr/gnu64/lib, and then tell GCC that's where to find them with the configure options --with-mpfr=/usr/gnu64/lib, --with-gmp=/usr/gnu64/lib, --with-mpc=/usr/gnu/64/lib. These paths are hard-wired into GCC and it works from there.

Inside the gcc directory, do this command:

./contrib/download_prerequisites

After that script, GMP, MPFR, and MPC will be ready to use. Continue with ./configure.

Damico

I had the same problem trying to install/compile GCC 4.8.1. Here is how I solved:

In Debian, just run this two commands:

apt-get install libmpc-dev
./configure

I had the same problem compiling GCC 4.9 branch.

For Red Hat and Fedora based systems, run the following command:

sudo yum install gmp gmp-devel mpfr mpfr-devel libmpc libmpc-devel

This will install the GNU multiple-precision (MP) libraries for integer, floating point, and complex numbers.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!