aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chapter05/libstdc++.xml8
-rw-r--r--chapter06/gcc-pass2.xml26
-rw-r--r--chapter07/chapter07.xml1
-rw-r--r--chapter07/libstdc++-pass2.xml120
4 files changed, 18 insertions, 137 deletions
diff --git a/chapter05/libstdc++.xml b/chapter05/libstdc++.xml
index 5a70026ed..66f17fcd8 100644
--- a/chapter05/libstdc++.xml
+++ b/chapter05/libstdc++.xml
@@ -5,8 +5,8 @@
%general-entities;
]>
-<sect1 id="ch-tools-libstdcpp-pass1" role="wrap">
- <?dbhtml filename="gcc-libstdc++-pass1.html"?>
+<sect1 id="ch-tools-libstdcpp" role="wrap">
+ <?dbhtml filename="gcc-libstdc++.html"?>
<sect1info condition="script">
<productname>gcc-libstdc++</productname>
@@ -14,9 +14,9 @@
<address>&gcc-url;</address>
</sect1info>
- <title>Libstdc++ from GCC-&gcc-version;, Pass 1</title>
+ <title>Libstdc++ from GCC-&gcc-version;</title>
- <indexterm zone="ch-tools-libstdcpp-pass1">
+ <indexterm zone="ch-tools-libstdcpp">
<primary sortas="a-GCC">GCC</primary>
<secondary>tools, libstdc++ pass 1</secondary>
</indexterm>
diff --git a/chapter06/gcc-pass2.xml b/chapter06/gcc-pass2.xml
index bf3007848..6dd6f90a5 100644
--- a/chapter06/gcc-pass2.xml
+++ b/chapter06/gcc-pass2.xml
@@ -62,23 +62,24 @@ mv -v mpc-&mpc-version; mpc</userinput></screen>
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64
;;
esac</userinput></screen>
-<!--
- <para>Fix an issue with GCC-10.1 when building with a cross
- compiler:</para>
-<screen><userinput remap="pre">patch -Np1 -i ../&gcc-cross-patch;</userinput></screen>
--->
+ <!-- https://gcc.gnu.org/PR100017 -->
+ <para>Fix an issue causing failure cross-compiling libstdc++:</para>
+
+<screen><userinput remap="pre">sed 's/gnu++17/&amp; -nostdinc++/' \
+ -i libstdc++-v3/src/c++17/Makefile.in</userinput></screen>
+
+ <para>Override the building rule of 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
cd build</userinput></screen>
- <para>Create a symlink that allows libgcc to be built with posix threads
- support:</para>
-
-<screen><userinput remap="pre">mkdir -pv $LFS_TGT/libgcc
-ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></screen>
-
<para>Before starting to build GCC, remember to unset any environment
variables that override the default optimization flags.</para>
@@ -89,6 +90,8 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></s
--host=$LFS_TGT \
--prefix=/usr \
CC_FOR_TARGET=$LFS_TGT-gcc \
+ CXX_FOR_TARGET=$LFS_TGT-g++ \
+ LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \
--with-build-sysroot=$LFS \
--enable-initfini-array \
--disable-nls \
@@ -99,7 +102,6 @@ ln -s ../../../libgcc/gthr-posix.h $LFS_TGT/libgcc/gthr-default.h</userinput></s
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
- --disable-libstdcxx \
--enable-languages=c,c++</userinput></screen>
<variablelist>
diff --git a/chapter07/chapter07.xml b/chapter07/chapter07.xml
index 8c78f230a..362980dda 100644
--- a/chapter07/chapter07.xml
+++ b/chapter07/chapter07.xml
@@ -17,7 +17,6 @@
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="chroot.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="creatingdirs.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="createfiles.xml"/>
- <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="libstdc++-pass2.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="gettext.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bison.xml"/>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="perl.xml"/>
diff --git a/chapter07/libstdc++-pass2.xml b/chapter07/libstdc++-pass2.xml
deleted file mode 100644
index 35b5a8baf..000000000
--- a/chapter07/libstdc++-pass2.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
-]>
-
-<sect1 id="ch-tools-libstdcpp-pass2" role="wrap">
- <?dbhtml filename="gcc-libstdc++-pass2.html"?>
-
- <sect1info condition="script">
- <productname>gcc-libstdc++</productname>
- <productnumber>&gcc-version;</productnumber>
- <address>&gcc-url;</address>
- </sect1info>
-
- <title>Libstdc++ from GCC-&gcc-version;, Pass 2</title>
-
- <indexterm zone="ch-tools-libstdcpp-pass2">
- <primary sortas="a-GCC">GCC</primary>
- <secondary>tools, libstdc++ pass 2</secondary>
- </indexterm>
-
- <sect2 role="package">
- <title/>
-
- <para>When building <xref linkend="ch-tools-gcc-pass2"/> we had to defer
- the installation of the C++ standard library because no suitable compiler
- was available to compile it. We could not use the compiler built in that
- section because it is a native compiler and should not be used outside of
- chroot and risks polluting the libraries with some host components.</para>
-
- <segmentedlist>
- <segtitle>&buildtime;</segtitle>
- <segtitle>&diskspace;</segtitle>
-
- <seglistitem>
- <seg>&libstdcpp-tmpp2-sbu;</seg>
- <seg>&libstdcpp-tmpp2-du;</seg>
- </seglistitem>
- </segmentedlist>
-
- </sect2>
-
- <sect2 role="installation">
- <title>Installation of Target Libstdc++</title>
-
- <note>
- <para><application>Libstdc++</application> is part of the GCC sources.
- You should first unpack the GCC tarball and change to the
- <filename>gcc-&gcc-version;</filename> directory.</para>
- </note>
-
- <para>Create a link which exists when building libstdc++ in the gcc tree:</para>
-
-<screen><userinput remap="pre">ln -s gthr-posix.h libgcc/gthr-default.h</userinput></screen>
-
- <para>Create a separate build directory for libstdc++ and enter it:</para>
-
-<screen><userinput remap="pre">mkdir -v build
-cd build</userinput></screen>
-
- <para>Prepare libstdc++ for compilation:</para>
-
-<screen><userinput remap="configure">../libstdc++-v3/configure \
- CXXFLAGS="-g -O2 -D_GNU_SOURCE" \
- --prefix=/usr \
- --disable-multilib \
- --disable-nls \
- --host=$(uname -m)-lfs-linux-gnu \
- --disable-libstdcxx-pch</userinput></screen>
-
- <variablelist>
- <title>The meaning of the configure options:</title>
-
- <varlistentry>
- <term><parameter>CXXFLAGS="-g -O2 -D_GNU_SOURCE"</parameter></term>
- <listitem>
- <para>These flags are passed by the top level Makefile when doing
- a full build of GCC.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--host=$(uname -m)-lfs-linux-gnu</parameter></term>
- <listitem>
- <para>We have to mimic what would happen if this package were built
- as part of a full compiler build. This switch would be passed to
- configure by GCC's build machinery.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry>
- <term><parameter>--disable-libstdcxx-pch</parameter></term>
- <listitem>
- <para>This switch prevents the installation of precompiled
- include files, which are not needed at this stage.</para>
- </listitem>
- </varlistentry>
-
- </variablelist>
-
- <para>Compile libstdc++ by running:</para>
-
-<screen><userinput remap="make">make</userinput></screen>
-
- <para>Install the library:</para>
-
-<screen><userinput remap="install">make install</userinput></screen>
-
- </sect2>
-
- <sect2 role="content">
- <title/>
-
- <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para>
-
- </sect2>
-
-</sect1>