[lfs] 02/03: gcc-pass2: use the build system machinery to enable thread instead of hacking it
"Git Owner" ([email protected] via lfs-book Mailing List) <[email protected]> Tue, 02 Jun 2026 11:25:35 +0000
| Newsgroups | gmane.linux.lfs.book |
|---|---|
| Message-ID | <[email protected]> |
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch trunk in repository lfs. commit de4fbf0adfff1cd5bdae2c5ec72bf628388e6ce6 Author: Xi Ruoyao <[email protected]> AuthorDate: Tue Jun 2 00:04:10 2026 +0800 gcc-pass2: use the build system machinery to enable thread instead of hacking it Also reorder the explanations to match the order of switches in the instruction. --- chapter06/gcc-pass2.xml | 54 +++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml index 89b2bc33e..98dd9c875 100644 --- a/chapter06/gcc-pass2.xml +++ b/chapter06/gcc-pass2.xml @@ -63,12 +63,6 @@ mv -v mpc-&mpc-version; mpc</userinput></screen> ;; esac</userinput></screen> - <para>Override the build rules of the libgcc and libstdc++ headers to - allow building these libraries with POSIX threads support:</para> - -<screen><userinput remap="pre">sed '/thread_header =/s/@.*@/gthr-posix.h/' \ - -i libgcc/Makefile.in libstdc++-v3/include/Makefile.in</userinput></screen> - <para>Create a separate build directory again:</para> <screen><userinput remap="pre">mkdir -v build @@ -96,11 +90,28 @@ cd build</userinput></screen> --disable-libssp \ --disable-libvtv \ --enable-languages=c,c++ \ - LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc</userinput></screen> + LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ + target_configargs=gcc_cv_target_thread_file=posix</userinput></screen> <variablelist> <title>The meaning of the new configure options:</title><!-- WIP --> + <varlistentry> + <term><parameter>--target=$LFS_TGT</parameter></term> + <listitem> + <para>We are cross-compiling GCC, so it's impossible to build + target libraries (<filename class="libraryfile">libgcc</filename> + and <filename class="libraryfile">libstdc++</filename>) with the + GCC binaries compiled in this pass—those binaries won't run + on the host. The GCC build system will attempt to use the host's + C and C++ compilers as a workaround by default. + Building the GCC target libraries with a different + version of GCC is not supported, so using the host's compilers may cause + the build to fail. This parameter ensures the libraries are built by GCC + pass 1.</para> + </listitem> + </varlistentry> + <varlistentry> <term><parameter>--with-build-sysroot=$LFS</parameter></term> <listitem> @@ -115,18 +126,13 @@ cd build</userinput></screen> </varlistentry> <varlistentry> - <term><parameter>--target=$LFS_TGT</parameter></term> + <term><parameter>--disable-libsanitizer</parameter></term> <listitem> - <para>We are cross-compiling GCC, so it's impossible to build - target libraries (<filename class="libraryfile">libgcc</filename> - and <filename class="libraryfile">libstdc++</filename>) with the - GCC binaries compiled in this pass—those binaries won't run - on the host. The GCC build system will attempt to use the host's - C and C++ compilers as a workaround by default. - Building the GCC target libraries with a different - version of GCC is not supported, so using the host's compilers may cause - the build to fail. This parameter ensures the libraries are built by GCC - pass 1.</para> + <para>Disable GCC sanitizer runtime libraries. They are not + needed for the temporary installation. In + <xref linkend='ch-tools-gcc-pass1'/> it was implied by + <parameter>--disable-libstdcxx</parameter>, and now we can + explicitly pass it.</para> </listitem> </varlistentry> @@ -143,13 +149,13 @@ cd build</userinput></screen> </varlistentry> <varlistentry> - <term><parameter>--disable-libsanitizer</parameter></term> + <term><parameter>target_configargs=gcc_cv_target_thread_file=posix</parameter></term> <listitem> - <para>Disable GCC sanitizer runtime libraries. They are not - needed for the temporary installation. In - <xref linkend='ch-tools-gcc-pass1'/> it was implied by - <parameter>--disable-libstdcxx</parameter>, and now we can - explicitly pass it.</para> + <para>Build the target libraries libgcc and libstdc++ with POSIX + thread support enabled. The default is following the + configuration of the compiler used for building the target library + (in this case, <xref linkend='ch-tools-gcc-pass1'/> which was + configured with none thread support).</para> </listitem> </varlistentry> -- To stop receiving notification emails like this one, please contact the administrator of this repository. -- http://lists.linuxfromscratch.org/sympa/info/lfs-book Unsubscribe: See the above information page