Vladimir A. Pavlov wrote: > I wonder why gcc is built twice while "Constructing Cross-Compile > Tools". > > Why cannot we build final gcc just once before glibc? > > Building gcc twice in LFS (not Cross LFS) is proved to be necessary > because the "second" gcc is linked against the newly installed glibc > while the "first" one uses the host glibc. But in CLFS (as I > understand) both gcc are linked against the host glibc. > > The only guess I have is that it's done in that way for the final gcc > not to be built with the host compiler. But if that's true we also > should compile binutils twice as well since the binutils are built with > the _host_ compiler in "Constructing Cross-Compile Tools". > The first pass of binuntils is to provide the tools for your target architecture that build into /tools. The first pass of glibc is static so it does not go looking for the glibc startfiles (Which don't exist yet). Then you build glibc into /tools providing the startfiles, ld-linux.so.2, libc.so, and a bunch of other libs. Then you can build a gcc with --enable-shared so that you have a cross-compiler that creates dynamically linked executables against the glibc you built after the first pass of gcc. Binutils is only needed to be built once because you're not changing the search path at all. In LFS, You go from linking to the host to after adjusting the toolchain linking to /tools. In CLFS, you're toolchain is setup to link against /tools from the start. That is why there is no adjusting the toolchain cross-tools or tools.
_______________________________________________ Clfs-dev mailing list [email protected] http://lists.cross-lfs.org/cgi-bin/mailman/listinfo/clfs-dev
