[lfs-support] Error Compiling GCC pass 2

Ken Moffat zarniwhoop at ntlworld.com
Tue Apr 12 10:53:19 PDT 2016

On Tue, Apr 12, 2016 at 11:33:12AM -0400, Keith Howard wrote:
> Gosh, guys....I'm so confused!
> So, if I do a 'which ld' I get:
> /tools/bin/ld
> So, if I do a 'file -L /tools/bin/ld' , I get:
> /tools/bin/ld: **ELF 64-bit** LSB executable, x86-64, version 1 (SYSV),
> dynamically linked, interpreter /tools/lib64/ld-linux-x86-64.so.2, for
> GNU/Linux 2.6.32, not stripped
> It's 64 bit.....
> So, where did the 32 bit version come from and how's come it's being used
> instead of the one I get from 'which'?
> Sorry.....very newb!
> Thanks!
> Keith

The 32-bit version came from the defaults on your host system.  I am
not sure if knoppix includes a 6-bit compiler ?  If it does, using
-m64 might allow you to build 64-bit binaries.  From memory, knoppix
is slimmed down - I see from the cheat codes
that knoppix64 boots a 64-bit kernel, but it says nothing about
whether userspace is also 64-bit.

In the past, on multilib systems, exec'ing 'linux32' or 'linux64'
(as root) would change the environment [ I used to use that to build
32-bit ppc on a ppc64 ], but that will only work if everything is
present. In particular, you need the 64-bit libraries.  Those might
be in /lib64, or they might be in /lib with the 32-bit in /lib32.

I find it odd that an x86 system which reports it is x86_64 would
default to building 32-bit programs, but apparently it does.

The /tools/bin/ld binary comes from pass 2 ad looks good.  But
building on an x86_64 host system which defaults to 32-bit binaries
is an unexplored situation.

You did not mention how the other files look.  If glibc is 64-bit
then I suppose you could try adding -m64 to your CFLAGS when you
compile.  But I do not know if that will work (as always you need
freshly extracted source), and if it does I don't know if you will
be able to complete chapter 5 doing that.

This email was written using 100% recycled letters.

More information about the lfs-support mailing list