gcc-4.3.2 build fails

Jeremy Huntwork jhuntwork at linuxfromscratch.org
Sat Nov 1 10:22:35 PDT 2008

John Frankish wrote:
> Hi,
> I'm trying to build on a playstation 3 with yellow dog linux v6
> Although binutils-2.18 builds OK, gcc-4.3.2 fails after the first 
> bootstrap pass succeeds and then gcc tries to compile a second 
> version of itself. The failure is "gcc compiler cannot build 
> executables" - config.log does not give too many clues...
> Note that I'm obliged to build using 
> LDFLAGS=$CXXFLAGS=$CFLAGS='-m32'  otherwise gcc-4.2.2 tries to build 
> a 64-bit version of itself and fails looking for gnu/stubs-64.h - 
> glibc and the rest of the ydl system is 32-bit. The host gcc is 
> gcc-4.1.1 (I think).

-m32 only specifies what types of _binaries_ to produce. This means that 
  when you build gcc with -m32, it will produce a 32-bit binary gcc 
(provided  you have 32-bit libs, which you do), but the gcc you build 
will still be configured for a 64-bit machine and when you run it, it 
will attempt to build for that architecture. Because you don't have 
64-bit libs, it will fail.

You can't build 64-bit without first building a 64-bit libc, and you 
can't build 32-bit unless you modify your host settings.

If you want to build LFS as 32-bit, you _might_ get away with hacking 
the output of uname to trick the build system into thinking you're 
running on a 32-bit host, but a saner approach would be to build a 
32-bit only kernel.

If you want to build LFS as 64-bit, there is an approach that currently 
works pioneered by DIY-Linux which involves cross-compiling your first 
glibc and then building natively after that. I have some notes on that 
method and have started adapting it to LFS, but I haven't published 
anything yet.

Otherwise, as was already mentioned, CLFS should be able to help you in 
the right direction, too.


More information about the lfs-dev mailing list