Bug 51935 - Configure fails on included mpc/mpfr
Summary: Configure fails on included mpc/mpfr
Status: RESOLVED DUPLICATE of bug 50461
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.6.2
: P3 major
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-21 17:29 UTC by Paul Smith
Modified: 2012-01-21 23:24 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments
Add /src to mpfr directories in configure.ac (443 bytes, patch)
2012-01-21 17:29 UTC, Paul Smith
Details | Diff
Handle both old and new MPFR dir layouts (488 bytes, patch)
2012-01-21 18:15 UTC, Paul Smith
Details | Diff
Fix typo (519 bytes, patch)
2012-01-21 23:24 UTC, Paul Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Smith 2012-01-21 17:29:54 UTC
Created attachment 26404 [details]
Add /src to mpfr directories in configure.ac

I was trying to follow the advice of various people by including GMP/MPC/MPFR into the GCC source tree (GCC 4.6.2 / GMP 5.0.2 / MPFR 3.1.0 / MPC 0.9), however this failed during configure:

    checking whether time.h and sys/time.h may both be included... yes
    checking for creal in -lm... yes
    checking for __gmpz_init in -lgmp... yes
    checking for MPFR... yes
    checking for recent GMP... yes
    checking for recent MPFR... no
    configure: error: MPFR version >= 2.4.2 required
    make[4]: *** [configure-stage1-mpc] Error 1
    make[4]: Leaving directory `/usr/src/gcc/obj-stage1/gcc'
    make[3]: *** [stage1-bubble] Error 2
    make[3]: Leaving directory `/usr/src/gcc/obj-stage1/gcc'
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `/usr/src/gcc/obj-stage1/gcc'
    make[1]: *** [/usr/src/gcc/.stamp/stage1.install] Error 2

Investigating, I found the configure was using the wrong path to location mpfr headers and libraries; for example mpc/config.log says:

    configure:11278: checking for recent MPFR
    configure:11290: gcc -c -g -fkeep-inline-functions -I/usr/src/gcc/obj-stage1/gcc
    /./gmp -I/usr/src/gcc/gcc-4.6.2/mpfr  conftest.c >&5
    conftest.c:34:3: error: #error "Minimal MPFR version is 2.4.2"
    conftest.c:35: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of
     input
    configure:11290: $? = 1

This is due to the configure script assuming that MPFR headers are in the root MPFR directory, but they're not: they live the "src" subdirectory in MPFR.  If you fix the headers then it will fail during link because it's looking for libmpfr.a in the wrong place, too.

I have an MPFR installed natively on the system, but it's version 2.2.1.  My suspicion is that most people who test this already have a "new enough" MPFR installed in /usr/include so they don't notice that this path is wrong, since configure finds the one in /usr/include and is happy with it.

The attached patch to configure.ac that fixes things.
Comment 1 Paul Smith 2012-01-21 18:15:24 UTC
Created attachment 26406 [details]
Handle both old and new MPFR dir layouts

Added a new patch that works with both old and new layouts.
Comment 2 Paul Smith 2012-01-21 18:17:23 UTC
BTW, this is a duplicate of bug #50461
Comment 3 Andrew Pinski 2012-01-21 18:23:20 UTC
Dup of bug 50461 so closing.

*** This bug has been marked as a duplicate of bug 50461 ***
Comment 4 Jonathan Wakely 2012-01-21 18:27:18 UTC
The prerequisites page says:
"While any sufficiently new version of required tools usually work, library requirements are generally stricter. Newer versions may work in some cases, but it's safer to use the exact versions documented."

The contrib/download_prerequisites script gets the exact versions documented.
Comment 5 Paul Smith 2012-01-21 18:54:37 UTC
It's fine to close this bug as a dup as it's later than the other, but note I've attached a fix to this bug (there's no fix attached to the other) so please don't lose the patch.

Cheers!
Comment 6 Paul Smith 2012-01-21 23:24:18 UTC
Created attachment 26407 [details]
Fix typo