I have been struggling with this issue, and now that I have successfully built GCC I thought I would share my results. Hopefully it can help someone better versed in autotools to improve the build of GCC with GMP/MPFR.

For reference, a few older threads I've found:
<a href="http://gcc.gnu.org/ml/gcc/2006-01/msg00333.html";>http:// gcc.gnu.org/ml/gcc/2006-01/msg00333.html</a> <a href="http://gcc.gnu.org/ml/gcc-bugs/2006-03/ msg00723.html">http://gcc.gnu.org/ml/gcc-bugs/2006-03/msg00723.html</a>

The long and short of it: my builds of the latest versions of GMP and MPFR were perfectly fine, although not ideal for building GCC. However, the GCC 4.1.1 configure script incorrectly decided that it _had_ located useful copies of GMP and MPFR, while in fact the GFortran build fails 90 minutes later with the error message (as in the second thread above):

        "../.././libgfortran/mk-kinds-h.sh: Unknown type"

This was configuring GCC via:

../srcdir/configure --with-gmp=/usr/local/lib64 --with-mpfr=/usr/ local/lib64

I now understand that this is a mis-use of these options, however recall configure was successful (I still do not understand why), while configure failed with the 'correct' options '--with-gmp=/usr/ local --with-mpfr=/usr/local' (because *.h are in /usr/local/include, but *.a are in /usr/local/lib64).

I was finally successful by using the build-directories rather than the installed libraries via:

../srcdir/configure --with-gmp-dir=/usr/local/gmp --with-mpfr-dir=/ usr/local/mpfr

but only after I made the symlink:

        ln -s /usr/local/mpfr/.libs/libmpfr.a /usr/local/mpfr/libmpfr.a

One issue here is that '--with-mpfr=path' assumes that 'libmpfr.a' is in 'path/lib' (not true for how I installed it), while '--with-mpfr- dir=path' assumes that 'libmpfr.a' is in 'path', rather than 'path/.libs' (can this work for anyone?). Note that '--with-gmp- dir=path' does look in 'path/.libs'.

This is all on RHEL4 x86_64. Note I am new to x86_64 and multilibs -- this certainly added to my difficulties. The machine does have older versions of GMP and MPFR installed in /usr/lib and /usr/lib64, while I had installed the latest versions in /usr/local (with the libraries in /usr/local/lib64). I would also note that GMP unfortunately hard- codes the bitness of the libraries in gmp.h, and that the older system /usr/include/gmp.h identifies itself as 64-bit (there are no #define switches as I would have expected).


My comments:

1) It would have been very useful to have explicit configure options such as --with-gmp-lib=path and --with-gmp-include=path (etc) that explicitly locate the *.a and *.h directories, rather than (or in addition to) the existing "install directory" and "build directory" options.

2) Ideally IMHO the top-level configure (or at least the libgfortran configure) would test the execution of some or all of the required functions in GMP/MPFR. I vaguely recall that this is possible with autoconf, and should be more robust. Would it add too much complexity to the top-level configure?



 Thanks,
 - Matt

Reply via email to