Cannot configure gcc - mpfr not found
Asked Answered
I

6

14

I'm installing gcc 4.5.2 with mpc 0.8.2, mpfr 3.1.0, and gmp 5.0.2. I've copied each of the mpc, mpfr, and gmp directories into the gcc-4.5.2 directory (removing the version tags). GCC successfully configures. When I run make, however, I get:

checking for MPFR... no
configure: error: libmpfr not found or uses a different ABI.
make[1]: *** [configure-mpc] Error 1
make[1]: leaving directory cross/build/gcc
make: *** [all] Error 2

MPFR is located in cross/src/gcc-4.5.2/mpfr. MPFR already was built successfully. Anyone know why mpc is unable to configure?

I think the problem may partially have to do with the libs/headers for MPFR being in cross/src/gcc-4.5.2/mpfr/src and not in cross/src/gcc-4.5.2/mpfr. All I did was extract and copy though- this is the default directory structure.

Idiolect answered 15/2, 2012 at 17:12 Comment(0)
I
9

I found that if I ran export C_INCLUDE_PATH=/cross/gcc-4.5.2/mpfr/src then export LD_LIBRARY_PATH=/cross/build-gcc-4.5.2/mpfr/src/.libs and finally export LIBRARY_PATH=$LD_LIBRARY_PATH everything worked as expected.

The nagging question is why gcc's own configure scripts set the flags wrong. It should know that mpfr's libs are not in mpfr/.libs but in mpfr/src/.libs, however it passes the former to mpc/configure.

Idiolect answered 16/2, 2012 at 0:7 Comment(4)
I had (and am having) the same problem with building gcc on Windows with MinGW/msys. Exporting/setting these variables as suggested didn't help in my case. Is the correct time and order of setting them important, or is there anything else I could check?Devland
I don't know if LD_LIBRARY_PATH/LIBRARY_PATH/C_INCLUDE_PATH are checked on windows. You could try editing the makefile and adding in the -I and -L options to CFLAGS in there.Idiolect
This changed with MPFR 3.1 (the header location) which is why GCC uses the old version. THe newer version isn't strictly supported, the GCC infrastructure downloads page still has version 2.4.2 listed.Lothario
Thanks, that explains it @rubenvb. Though I'm surprised that they don't have some sort of autotools hack to get it to recognize the directory layout for MPFR 3.1. Seems like they're compatible with every version of every program written since the 90s, or else what are those gigantic configure scripts for :PIdiolect
T
29

I was having the same issue. But it seems this happens because latest version of MPFR (in your case 3.1.0) changed the directory hierarchy.

Instead, before configuring, run the following when you are inside gcc's source directory (may only work for gcc4.5.2 or later):

./contrib/download_prerequisites

It will download the necessary MPFR, GMP and MPC versions (but probably not the latest versions) and unpack those for gcc installation.

After that, you can continue with your configure, make and make install.

Hope this helps.

-Rakib

Totemism answered 26/4, 2012 at 19:9 Comment(5)
Awesome answer. This works great. I did not know that the libs could be downloaded automatically.Quan
If you're on a Mac replace the "wget" commands in the script with "curl -OL"Dar
great answer, however found no download_prerequisites script in gcc 4.4, so did it manuallyTawnytawnya
@Tawnytawnya Nice catch. Never tried to install gcc4.4 manually. Updated my answer. Thanks. How did you know which versions to download?Totemism
@rakib the configure script lists them as errors, when no gmp nor mpfr are foundTawnytawnya
I
9

I found that if I ran export C_INCLUDE_PATH=/cross/gcc-4.5.2/mpfr/src then export LD_LIBRARY_PATH=/cross/build-gcc-4.5.2/mpfr/src/.libs and finally export LIBRARY_PATH=$LD_LIBRARY_PATH everything worked as expected.

The nagging question is why gcc's own configure scripts set the flags wrong. It should know that mpfr's libs are not in mpfr/.libs but in mpfr/src/.libs, however it passes the former to mpc/configure.

Idiolect answered 16/2, 2012 at 0:7 Comment(4)
I had (and am having) the same problem with building gcc on Windows with MinGW/msys. Exporting/setting these variables as suggested didn't help in my case. Is the correct time and order of setting them important, or is there anything else I could check?Devland
I don't know if LD_LIBRARY_PATH/LIBRARY_PATH/C_INCLUDE_PATH are checked on windows. You could try editing the makefile and adding in the -I and -L options to CFLAGS in there.Idiolect
This changed with MPFR 3.1 (the header location) which is why GCC uses the old version. THe newer version isn't strictly supported, the GCC infrastructure downloads page still has version 2.4.2 listed.Lothario
Thanks, that explains it @rubenvb. Though I'm surprised that they don't have some sort of autotools hack to get it to recognize the directory layout for MPFR 3.1. Seems like they're compatible with every version of every program written since the 90s, or else what are those gigantic configure scripts for :PIdiolect
V
3

Try this while configuring:

./configure --prefix=<DIR YOU WANT TO INSTALL GCC> \
--with-gmp=<DIRECTORY YOU INSTALLED GMP> \
--with-mpc=<MPC DIR> --with-mpfr=<MPFR DIR>
Venesection answered 23/7, 2012 at 13:5 Comment(0)
T
3

I've had the same problem for a few hours, but I solved it in another other way.

I've deleted all old folders like gcc-4.* and gcc-build, because there was an old configuration inside. After that, I checked out again with version-check.sh if everything was in the right location.

I used Debian and it was missing bison and gnu awk! Why whatever. I installed the two again and started with installing gcc. Now everything is OK.

Perhapse you have a similar problam which can be solved in the same manner. I have to check every time when I start vbox and maybe it is a problem with my vbox-image, so when I start vbox I run a versions-check.

Tyrosine answered 1/10, 2012 at 9:30 Comment(0)
T
3

No need you can try like this:

./configure \
--with-gmp=/opt/install/local\
--with-mpfr=/opt/install/local \
--with-mpc=/opt/install/local \
--with-gmp-include=/opt/install/build/gmp-6.0.0 \
--with-mpfr-include=/opt/install/build/mpfr-3.1.2/src \
--with-mpc-include=/opt/install/build/mpc-1.0.2/src --enable-languages=c,c++
Tuppence answered 21/7, 2014 at 14:19 Comment(0)
F
2

instead of --with-mpfr=, I used --with-mpfr-lib=your-mprf-dir/lib(64?) --with-mpfr-include=your-mprf-dir/include.

This works for me. PS: mprf-3.1.0 gmp-5.0.2 mpc-0.9

Fimbriate answered 29/8, 2013 at 14:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.