Page 1 of 1

MFPR doesn't install when building cross-compiler

Posted: Thu Apr 15, 2010 5:16 am
by garob
Hi I downloaded everything (gcc-4.4.3, binutils-2.9, gmp-5.0.1, mpfr-2.4.2) and and try to build with my script but it spits an error and stops.

This is my script which is basicly everything the tutorial says to do in one file.

Code: Select all

#!/bin/sh
echo building GMP
cd /usr/src
mkdir build-gmp
cd build-gmp
../gmp-5.0.1/configure --prefix=/usr/local
make all install
echo building MPFR
cd /usr/src
mkdir build-mpfr
cd build-mpfr
../mpfr-2.4.2/configure --prefix=/usr/local
make all install
export PREFIX=/usr/cross
export TARGET=i586-elf
cd /usr/src
mkdir build-binutils build-gcc
echo building binutils
cd /usr/src/build-binutils
../binutils-2.9/configure --target=$TARGET --prefix=$PREFIX --disable-nls
make all
make install
echo building gcc
cd /usr/src/build-gcc
export PATH=$PATH:$PREFIX/bin
../gcc-4.4.3/configure --target=$TARGET --prefix=$PREFIX --disable-nls \
    --enable-languages=c,c++ --without-headers
make all-gcc
make install-gcc
echo building libgcc
make all-target-libgcc
make install-target-libgcc
This is the error it stops with:

Code: Select all

checking for correct version of gmp.h... yes
checking for correct version of mpfr.h... no
configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.
make: *** No rule to make target `all-gcc'.  Stop.
make: *** No rule to make target `install-gcc'.  Stop.

when I look in the build-mpfr directory there is only one file, the config.log but nothing else. What can I do to get a working cross-compiler? I am using cygwin by the way.

Re: MFPR doesn't install when building cross-compiler

Posted: Thu Apr 15, 2010 5:19 am
by Combuster
Is that the topmost error? I guess not.

Re: MFPR doesn't install when building cross-compiler

Posted: Thu Apr 15, 2010 5:32 am
by garob
So I should go through the output for mfpr? Okay I'll do that tomorrow 'cos it's night time here but if anyone has had the same problem please help.

Re: MFPR doesn't install when building cross-compiler

Posted: Thu Apr 15, 2010 7:00 am
by xenos
IIRC, MPFR usually recommends to run "make check" before installing. Perhaps it just doesn't install because the script invokes "make install" before "make check". You could try this line instead when building MPFR:

Code: Select all

make all check install

Re: MFPR doesn't install when building cross-compiler

Posted: Fri Apr 16, 2010 5:55 am
by FlashBurn
Ops, I created a thread in os dev with the same problem (http://forum.osdev.org/viewtopic.php?f=1&t=21852). MPFR has a problem with the built gmp.

Edit::

Seems I found a solution, call configure with "--with-gmp=/usr/local" (this is the dir where gmp copies the include and lib files to, if you haven´t changed it).

Re: MFPR doesn't install when building cross-compiler

Posted: Fri Apr 16, 2010 10:04 am
by Solar
Two hints regarding this kind of error:
  • A shell script does not abort if one of the commands within fail. For example, the configure fails, but it still tries to run 'make' regardless. This can severely obfuscate error messages if you are unaware of this.
  • The output generated by a failed run of configure only tells half the story. Check the contents of the file ./config.log, looking for the error message you saw on the command line, and then stepping a few lines backwards to see what the test actually was, and how it failed exactly. This can give you some crucial additional information.

Re: MFPR doesn't install when building cross-compiler

Posted: Fri Apr 16, 2010 10:15 am
by FlashBurn
Solar wrote: The output generated by a failed run of configure only tells half the story. Check the contents of the file ./config.log, looking for the error message you saw on the command line, and then stepping a few lines backwards to see what the test actually was, and how it failed exactly. This can give you some crucial additional information.
This is exact what I´ve done and so I found out that MPFR´s configure script couldn´t find libgmp (which was there), because gcc´s search path for libraries hasn´t included "/usr/local" and it seems you also couldn´t add it w/o telling it as parameter for it. I had to use the same for building MPC and GCC. But as I needn´t this before, there has something to be what changed.