LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   GCC 4.7.1 Pass 1 Errors when preparing for compilation (https://www.linuxquestions.org/questions/linux-from-scratch-13/gcc-4-7-1-pass-1-errors-when-preparing-for-compilation-4175420646/)

SirWhy 08-06-2012 09:26 AM

GCC 4.7.1 Pass 1 Errors when preparing for compilation
 
I've been following along fine with the LFS book until it's time to prepare GCC for compile.

I enter in this as the book says
Code:

../gcc-4.7.1/configure        \
    --target=$LFS_TGT          \
    --prefix=/tools            \
    --with-sysroot=$LFS        \
    --with-newlib              \
    --without-headers          \
    --with-local-prefix=/tools \
    --with-native-system-header-dir=/tools/include \
    --disable-nls              \
    --disable-shared          \
    --disable-multilib        \
    --disable-decimal-float    \
    --disable-threads          \
    --disable-libmudflap      \
    --disable-libssp          \
    --disable-libgomp          \
    --disable-libquadmath      \
    --enable-languages=c      \
    --with-mpfr-include=$(pwd)/../gcc-4.7.1/mpfr/src \
    --with-mpfr-lib=$(pwd)/mpfr/src/.libs

After I enter this I get a list of checks and then it fails

Entire output
Code:

checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking target system type... i686-lfs-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether ln works... yes
checking whether ln -s works... yes
checking for a sed that does not truncate output... /bin/sed
checking for gawk... no
checking for mawk... mawk
checking for libitm support... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for g++... no
checking for c++... no
checking for gpp... no
checking for aCC... no
checking for CC... no
checking for cxx... no
checking for cc++... no
checking for cl.exe... no
checking for FCC... no
checking for KCC... no
checking for RCC... no
checking for xlC_r... no
checking for xlC... no
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking for gnatbind... no
checking for gnatmake... no
checking whether compiler driver understands Ada... no
checking how to compare bootstrapped objects... cmp --ignore-initial=16 $$f1 $$f2
checking for objdir... .libs
checking for the correct version of gmp.h... no
configure: error: Building GCC requires GMP 4.2+, MPFR 2.3.1+ and MPC 0.8.0+.
Try the --with-gmp, --with-mpfr and/or --with-mpc options to specify
their locations.  Source code for these libraries 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, MPFR and/or MPC 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.

I have an idea of what it means, it can't find the required gmp, mpfr and mpc but I don't really know how to fix it.

Surely the code in the book can't be wrong and is missing something along the lines of
Code:

--with-gmp......
--with-mpc....

Any help is appreciated and may I say this is a fantastic community.

stoat 08-06-2012 09:40 AM

You're right, the book is not wrong. See the note in the yellow box on that page of the book. This happens all the time. The tarballs for GCC, GMP, MPFR and MPC all should be present in your /sources directory. Then untar only the GCC tarball and change directories to its build directory (the standard compiling steps described in section 5.3). Then start copying and pasting the book's commands into your terminal. It will work.

P.S.: To me, this misunderstanding is being caused by the wording of the first paragraph on that page (just above the yellow box with the note). It appears to be telling us to unpack the tarballs of GMP, MPFR and MPC in the GCC build directory and rename them, as though we should stop and do that before proceeding. However, that paragraph is merely describing what the next steps do (immediately following the yellow box).

SirWhy 08-06-2012 10:03 AM

Thank you.

So I should delete the ones I untarred (apart from gcc of course) and download the tarballs again and leave them packaged as is. Then go as the books says

stoat 08-06-2012 10:09 AM

That's right, but the tarballs should still be there. Nothing happens to those when you untar them. Just delete the three build directories created when you untarred GMP, MPFR and MPC. Then start again with those tar and mv commands on page 34.

If you deleted the tarballs, then download them again.

P.S.: I also would delete the build directory created by untarring GCC and just start over for GCC at the top of the page by untarring GCC again and changing directories to its build directory. Then go.

SirWhy 08-06-2012 10:21 AM

Well now it's compiling, hopefully without a problem but it will be a while until I find out (about 40 mins, older hardware). Will post again if all goes well

SirWhy 08-06-2012 11:08 AM

So I left it to compile and when I came back this was on the terminal
Code:

checking whether ln -s works... yes
checking for i686-lfs-linux-gnu-gcc... /mnt/LFS/sources/gcc-build/./gcc/xgcc -B/mnt/LFS/sources/gcc-build/./gcc/ -B/tools/i686-lfs-linux-gnu/bin/ -B/tools/i686-lfs-linux-gnu/lib/ -isystem /tools/i686-lfs-linux-gnu/include -isystem /tools/i686-lfs-linux-gnu/sys-include 
checking for suffix of object files... configure: error: in `/mnt/LFS/sources/gcc-build/i686-lfs-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[1]: *** [configure-target-libgcc] Error 1
make[1]: Leaving directory `/mnt/LFS/sources/gcc-build'
make: *** [all] Error 2

I know it said compile errors would happen. Are these it or has something gone wrong?

spiky0011 08-06-2012 01:43 PM

Hi. Can you post the output of Version check as I see it dosn,t find gawk. I expect there will be other softsare required. Also what host are you using.


All times are GMT -5. The time now is 01:56 PM.