Reason for Chapter 5

Rob Thornton rob_t at shaw.ca
Wed Feb 4 16:11:26 PST 2009


I'm sure someone else may be able to give a more detailed explanation, 
but the "simple" answer:

GCC is used to build software. Correct. So, any software you compile on 
your own system will work just fine. However, you are in essence, 
compiling software on YOUR system (host) for ANOTHER system (target). 
When compiling software with the host's gcc, that software will be 
linked against the host's libraries. This pollutes the toolchain because 
many of these links are hard-wired and can't be changed. So, when you 
remove the host and move into the chroot'd environment or try to boot 
the new system, you will run into all kinds of issues. Just because 
something exists in /usr/lib on one system, namely yours, doesn't mean 
it won't be somewhere else on another's (ie, the one you're creating). 
Every distro does things differently. Files are located in different 
places and different configurations are used. They are NOT necessarily 
compatible.

Hence, you build a temporary CLEAN (read: completely virgin software 
untouched by the host system) toolchain which can be used to create a 
fully functioning and independent system.

For example, most distributions add their own patches to make software 
work for them. Ubuntu often releases their own bug-fixes that apply only 
do their distribution. Trying to compile a NEW system with these changes 
can lead to unpredictable, and undesirable, results.

Rob

armencho at gmail.com wrote:
> Hello all,
>
> In trying to make better sense of the principles of LFS, I caught
> myself in a brain dilemma: Why does one need to assemble the temporary
> tools that assemble the LFS? Why cannot LFS be built by host's
> toolchain itself, directly? I understand the need to isolate the
> variables that may affect the assembly of the final system, and thus
> setting up a clean shell for the 'lfs' user. But the code? After all,
> gcc is distributed for a reason - to compile software, and if we have
> to compile GCC everytime we want it to compile other software, why
> even keep a built copy of it around? In other words, can the final
> production GCC (built in chapter 6) be trusted to assemble another
> LFS, without it first compiling a temporary GCC? Not sure if I made my
> question across, but I am trying here...
>
> Thanks.
>   



More information about the lfs-support mailing list