[lfs-support] 答复: lfs tool chain technique LFS-7.1

Hadi haiye1018 at 163.com
Fri Aug 24 01:45:32 PDT 2012

Hi Elly,

Thanks for your feedback.


The building of tool chain between Chapter 5 and Chapter 6 are different. In
Chapter 6, the tools can be effective immediately once being installed. But
in Chapter 5, for example, the binutils-2.22 pass 1, the tools are with
prefix $LFS_TGT- (in my virtual box is i686-lfs-linux-gnu-). If using these
tools, the configuration must be special, for example, in Chapter 5.10
(GCC-4.6.2-Pass 2):

CC="$LFS_TGT-gcc -B/tools/lib/" \


../gcc-4.6.2/configure --prefix=/tools ..

So I want to know that in Chapter 5 why the binutils-2.22-Pass1 is the pre
requisite for GCC-4.6.2-Pass1 since GCC-4.6.2-Pass1 still uses those of the
host. But in GCC-4.6.2-Pass1 I notice the following prints will come out:

checking for ar... /tools/i686-lfs-linux-gnu/bin/ar

checking for as... /tools/i686-lfs-linux-gnu/bin/as


So I guess maybe when cross-compiling the binutils/gcc/glibc will use those
already installed for the target host since the /tools directory is in the

I want to get more details about the tool chain technique. Anyone else can




> Hi,


> I am very confused about tool chain technique, especially when 

> digesting more details. In LFS-7.1 chapter 5 (constructing a temporary 

> system) the book says "Binutils is installed first because the 

> *configure *runs of both GCC and Glibc perform various feature tests 

> on the assembler and linker to determine which software features to 

> enable or disable.". But after "Binutils-2.22 - Pass 1" the binutils 

> (ld/as etc) are the host's. Or you can say that after binutils pass 1, 

> if compiling dummy.c, gcc still uses the host's binutils, not those 

> installed by binutils -- pass 1. On the other hand, when configuring 

> and compiling gcc-4.6.2-pass 2, the following print will come out:


> checking for ar... /tools/i686-lfs-linux-gnu/bin/ar


> checking for as... /tools/i686-lfs-linux-gnu/bin/as


> So I guess that when binutils/gcc/glibc know they are cross-compiling, 

> they will use the cross tools already installed instead if existing.


> Am I right? Or is there some tool chain mechanism, which is very 

> complicated?


> ----Hadi




The code doesn't necessarily know it's cross-compiling, it's reading the 

environment variables that have been set, after the shell has 

interpreted the command given. That's why the /tools folder is set in 

the PATH as the first place to check for the tools, then host folders 

are searched. Hashing is also turned off to ensure that the newly built 

tools are the tools being used once they exist. Though I'm sure that 

Bruce can explain even better... :)




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.linuxfromscratch.org/pipermail/lfs-support/attachments/20120824/312d2a79/attachment.html>

More information about the lfs-support mailing list