Linux – LFS: What is the toolchain and why is it important

compilingglibclinux

I'm going through Linux from Scratch and I'm on the page that discusses the toolchain. Up until this point I've understood everything, but I don't understand the term "toolchain".

From what I've read the toolchain is a set of tools that will be used to compile tools on the new distribution. This is required so that software isn't compiled with the host compiler.

Am I correct in thinking that the hosts tools (I believe it's the compiler that's being built at this stage) have to be used to compile Glibc, Binutils etc? And then once that is done the newly compiled compiler is used to build other tools to create the OS?

This part is very sketchy, and Googling around isn't yielding may useful results. If anyone has any useful resources to share that will help me understand this better that would be great.

Best Answer

The toolchain is simply tools to build software (compiler, assembler, linker, libraries, and a few useful utilities).

In this case the important part is host-independent - that is independent of the tools downloaded.

There are several reasons why you might want to rebuild the tools:

  • It is harder to sneak in backdoors (though not impossible)
  • Compile parameters can be tweaked to fit your system and not just being a general binary.
  • You get the newest version of the tools.
Related Question