libstdc++ "stage 3" is not rebuilt for the same reason as "stage 2"

I'm pretty sure "stage 2" libstdc++ (installed in ch6) is already fully
featured.  The reason to rebuild the stage 3 libstdc++ (or entire
stage 3 gcc) is same as the reason to rebuild every packages in multiple
chapters: to "settle down" it.

Merge the content of
https://www.linuxfromscratch.org/lfs/faq.html#rebuild-ch8 into the book
as an explanation.
This commit is contained in:
Xi Ruoyao 2022-09-30 17:03:08 +08:00
parent 77b46db0a8
commit 543c94cb9c
No known key found for this signature in database
GPG Key ID: ACAAD20E19E710E3
2 changed files with 20 additions and 2 deletions

View File

@ -123,6 +123,9 @@
<!ENTITY lfs-user "<systemitem class='username'>lfs</systemitem>"> <!ENTITY lfs-user "<systemitem class='username'>lfs</systemitem>">
<!ENTITY fstab "<filename>/etc/fstab</filename>"> <!ENTITY fstab "<filename>/etc/fstab</filename>">
<!ENTITY boot-dir "<filename class='directory'>/boot</filename>"> <!ENTITY boot-dir "<filename class='directory'>/boot</filename>">
<!ENTITY ch-final "<xref linkend='chapter-building-system'/>">
<!ENTITY ch-tmp-cross "<xref linkend='chapter-temporary-tools'/>">
<!ENTITY ch-tmp-chroot "<xref linkend='chapter-chroot-temporary-tools'/>">
<!ENTITY % packages-entities SYSTEM "packages.ent"> <!ENTITY % packages-entities SYSTEM "packages.ent">
%packages-entities; %packages-entities;

View File

@ -256,8 +256,23 @@
would be able to build those libraries, but (1) the build system of would be able to build those libraries, but (1) the build system of
gcc does not know that it is usable on pc, and (2) using it on pc gcc does not know that it is usable on pc, and (2) using it on pc
would create a risk of linking to the pc libraries, since cc-lfs is a native would create a risk of linking to the pc libraries, since cc-lfs is a native
compiler. So we have to re-build libstdc++ twice later on: as a part of compiler. So we have to re-build libstdc++ later as a part of
gcc stage 2, and then again in the chroot environment (gcc stage 3).</para> gcc stage 2.</para>
<para>In &ch-final; (or <quote>stage 3</quote>), all packages needed for
the LFS system are built. Even if a package is already installed into
the LFS system in a previous chapter, we still rebuild the package
unless we are completely sure it's unnecessary. The main reason for
rebuilding these packages is to settle them down: if we reinstall a LFS
package on a complete LFS system, the installed content of the package
should be same as the content of the same package installed in
&ch-final;. The temporary packages installed in &ch-tmp-cross; or
&ch-tmp-chroot; cannot satisify this expectation because some of them
are built without optional dependencies installed, and autoconf cannot
perform some feature checks in &ch-tmp-cross; because of cross
compilation, causing the temporary packages to lack optional features
or use suboptimal code routines. Additionally, a minor reason for
rebuilding the packages is allowing to run the testsuite.</para>
</sect2> </sect2>