Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I followed LFS doc.

I'm not quite understand why it needs 2 pass of compilation.

My guess:

We need target system's glibc, if we compile by host's gcc, it will not be able to separate with host anymore. So we need to build new system's binutils and gcc first to build target system's glibc let glibc connect with target's binutils and gcc. But first pass of binutils and gcc is using host's glibc, so we need second pass of compilation of target's binutils and gcc.

Are those right?

Is anything I'm missing or misunderstanding?

Thank you~

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Correct. As the Dragon Book explains, you must first build a host binary that builds for the target, and then you use that to build a target binary that builds for the target.

share|improve this answer
    
That isn't really only on LFS, that is the standard way GCC is built. The first round builds just the tools required to compile the second round. And for testing a third round is build and compared to the second one: This is the final GCC compiled with the final GCC, so they should be bit by bit identical (save timestamps). –  vonbrand Jan 28 '13 at 15:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.