[lfs] branch trunk updated: ch05/libstdc++: set CXX=$LFS_TGT-gcc

git Owner ([email protected] via lfs-book Mailing List) <[email protected]> Sat, 18 Jul 2026 15:57:44 +0000
Newsgroups gmane.linux.lfs.book
Message-ID <178439026403.1845612.1755719835727809219@rivendell.linuxfromscratch.org>
This is a multi-part message in MIME format...

------------=_1784390266-1024790-4673
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch trunk
in repository lfs.

The following commit(s) were added to refs/heads/trunk by this push:
     new 2be87ced8 ch05/libstdc++: set CXX=$LFS_TGT-gcc
2be87ced8 is described below

commit 2be87ced88fc4a8acc55f456e396b316e9e6f410
Author: Xi Ruoyao <[email protected]>
AuthorDate: Sat Jul 18 23:48:36 2026 +0800

    ch05/libstdc++: set CXX=$LFS_TGT-gcc
    
    In a normal GCC build the top-level Makefile automatically sets the
    CXX=xgcc.  And without it the "checking for sin in -lm" probe will fail,
    and then GCC will believe the math functions (for example acosf) are not
    available and fail to build std.gcm (added since GCC 16) with about a
    dozen lines of error messages, which would likely disconcert the user if
    spotted.
---
 chapter05/libstdc++.xml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml
index c7020290d..916dfcbce 100644
--- a/chapter05/libstdc++.xml
+++ b/chapter05/libstdc++.xml
@@ -63,6 +63,7 @@ cd       build</userinput></screen>
 <screen><userinput remap="configure">../libstdc++-v3/configure      \
     --host=$LFS_TGT            \
     --build=$(../config.guess) \
+    CXX=$LFS_TGT-gcc           \
     --prefix=/usr              \
     --disable-multilib         \
     --disable-nls              \
@@ -81,6 +82,23 @@ cd       build</userinput></screen>
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><parameter>CXX=$LFS_TGT-gcc</parameter></term>
+        <listitem>
+          <para>Specifies to use <command>$LFS_TGT-gcc</command> to compile
+          the C++ code.  The default, <command>$LFS_TGT-g++</command>,
+          would automatically specify linking against
+          <systemitem class='library'>libstdc++</systemitem> when invoking
+          the linker, but in our case
+          <systemitem class='library'>libstdc++</systemitem> is not
+          installed yet so some checks in the <command>configure</command>
+          script would misbehave with <command>$LFS_TGT-g++</command>.  In a
+          normal build, this override is automatically passed to the
+          <command>configure</command> script from the top level directory.
+          Here we explicitly pass it.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--disable-libstdcxx-pch</parameter></term>
         <listitem>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

------------=_1784390266-1024790-4673
Content-Type: text/plain; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0

-- 
http://lists.linuxfromscratch.org/sympa/info/lfs-book
Unsubscribe: See the above information page

------------=_1784390266-1024790-4673--