Hi,

gcc 4.8.0 release has been out for a couple of days. I have built current lfs with it, using the method 2) described in my message of January 10. The nice thing is that now libstdc++ can be built standalone, so that you do not need to keep the gcc build tree around.

Let me recall how it works:

  - Build binutils-pass1 as in the book.
  - Build gcc-pass1 with --enable-languages=c,c++
and --disable-stdc++-v3. Thus we have a C++ compiler, and no library.
  - Build glibc as per book instructions. It uses only the C compiler and
the static libgcc as usual
  - Build libstdc++-v3: build in an out of source directory:
change to that dir, run ../gcc-<version>/libstdc++-v3 configure (see options in attached patch
then make and make install, "et voila".
  - Finish with binutils-pass2 and gcc-pass2 (adding CXX=$LFS_TGT-g++)

Building glibc first does not work on a lot of distros, so I forgot about it.

The tests in chapter 6 are very clean (no errors in glibc except the ignored ones), only one in gcc libmudflap.

Building libstdc++ does not take much time (0.5 SBU), but of course the gcc tests take longer (upstream keeps adding them) and the chapter 6 gcc needs more than 2G on the disk.

If somebody wants to try the patch with jhalfs, it needs a patch:

Index: LFS/master.sh
===================================================================
--- LFS/master.sh       (révision 3678)
+++ LFS/master.sh       (copie de travail)
@@ -102,7 +102,9 @@

# Grab the name of the target (minus the -pass1 or -pass2 in the case of gcc
     # and binutils in chapter 5)
- name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' -e 's@-pass[0-9]\{1\}@@'`
+    name=`echo ${this_script} | sed -e 's@[0-9]\{3\}-@@' \
+                                    -e 's@-pass[0-9]\{1\}@@' \
+                                    -e 's@-libstdc++@@'`

     # Set the dependency for the first target.
     if [ -z $PREV ] ; then PREV=022-settingenvironment ; fi


Eventually, having to use C++ for gcc build does not change things so much...

Regards
Pierre


diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/binutils-pass1.xml lfs-cxx-gcc1st/chapter05/binutils-pass1.xml
--- lfsbook/chapter05/binutils-pass1.xml	2013-02-26 22:23:30.000000000 +0100
+++ lfs-cxx-gcc1st/chapter05/binutils-pass1.xml	2013-03-20 23:14:55.000000000 +0100
@@ -77,8 +77,7 @@
     --with-sysroot=$LFS        \
     --with-lib-path=/tools/lib \
     --target=$LFS_TGT          \
-    --disable-nls              \
-    --disable-werror</userinput></screen>
+    --disable-nls</userinput></screen>
 
     <variablelist>
       <title>The meaning of the configure options:</title>
@@ -96,7 +95,7 @@
         <term><parameter>--with-sysroot=$LFS</parameter></term>
         <listitem>
           <para>For cross compilation, this tells the build system to look in
-          $LFS for the target system libraries as needed.</para>
+          <envar>$LFS</envar> for the target system libraries as needed.</para>
         </listitem>
       </varlistentry>
 
@@ -109,7 +108,7 @@
       </varlistentry>
 
       <varlistentry>
-        <term><envar>--target=$LFS_TGT</envar></term>
+        <term><parameter>--target=$LFS_TGT</parameter></term>
         <listitem>
           <para>Because the machine description in the <envar>LFS_TGT</envar>
           variable is slightly different than the value returned by the
@@ -127,14 +126,6 @@
         </listitem>
       </varlistentry>
 
-      <varlistentry>
-        <term><parameter>--disable-werror</parameter></term>
-        <listitem>
-          <para>This prevents the build from stopping in the event that there
-          are warnings from the host's compiler.</para>
-        </listitem>
-      </varlistentry>
-
     </variablelist>
 
     <para>Continue with compiling the package:</para>
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/binutils-pass2.xml lfs-cxx-gcc1st/chapter05/binutils-pass2.xml
--- lfsbook/chapter05/binutils-pass2.xml	2013-03-13 21:51:58.000000000 +0100
+++ lfs-cxx-gcc1st/chapter05/binutils-pass2.xml	2013-03-13 21:55:48.000000000 +0100
@@ -56,6 +56,7 @@
 ../binutils-&binutils-version;/configure \
     --prefix=/tools        \
     --disable-nls          \
+    --disable-werror       \
     --with-lib-path=/tools/lib \
     --with-sysroot</userinput></screen>
 
@@ -71,6 +72,15 @@
         </listitem>
       </varlistentry>
 
+      <varlistentry>
+        <term><parameter>--disable-werror</parameter></term>
+        <listitem>
+          <para>Since GCC-4.8 is more picky about the correctness of the code,
+          it may give warnings, which stop the build if this switch is not
+          present.</para>
+        </listitem>
+      </varlistentry>
+
       <varlistentry>
         <term><parameter>--with-lib-path=/tools/lib</parameter></term>
         <listitem>
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/chapter05.xml lfs-cxx-gcc1st/chapter05/chapter05.xml
--- lfsbook/chapter05/chapter05.xml	2012-04-25 21:45:02.000000000 +0200
+++ lfs-cxx-gcc1st/chapter05/chapter05.xml	2013-01-12 19:17:29.000000000 +0100
@@ -18,6 +18,7 @@
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="gcc-pass1.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="linux-headers.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="glibc.xml"/>
+  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="libstdc++.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="binutils-pass2.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="gcc-pass2.xml"/>
   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"; href="tcl.xml"/>
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/gcc-pass1.xml lfs-cxx-gcc1st/chapter05/gcc-pass1.xml
--- lfsbook/chapter05/gcc-pass1.xml	2013-02-26 22:23:30.000000000 +0100
+++ lfs-cxx-gcc1st/chapter05/gcc-pass1.xml	2013-03-23 15:09:50.000000000 +0100
@@ -105,8 +105,7 @@
 
 <screen><userinput remap="pre">sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure</userinput></screen>
 
-    <para>Do not build the .info files.  They are not needed here and 
-    are broken with the current version of <command>makeinfo</command>.</para>
+    <para>Do not build the .info files.  They are not needed here.</para>
 
 <screen><userinput remap="pre">sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure</userinput></screen>
 
@@ -135,8 +134,13 @@
     --disable-libssp           \
     --disable-libgomp          \
     --disable-libquadmath      \
-    --enable-languages=c       \
-    --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
+    --disable-libatomic        \
+    --disable-libsanitizer     \
+    --disable-libitm           \
+    --disable-libstdc++-v3     \
+    --enable-languages=c,c++   \
+<!--    - -enable-build-with-cxx    \
+-->    --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
     --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
 
     <variablelist>
@@ -193,13 +197,13 @@
       </varlistentry>
 
       <varlistentry>
-        <term><parameter>--disable-decimal-float, --disable-threads, --disable-libmudflap, --disable-libssp, --disable-libgomp, --disable-libquadmath</parameter></term>
+        <term><parameter>--disable-decimal-float, --disable-threads, --disable-libmudflap, --disable-libssp, --disable-libgomp, --disable-libquadmath, --disable-libatomic, --disable-libsanitizer</parameter></term>
         <listitem>
           <para>These switches disable support for the decimal floating point
-          extension, threading, libmudflap, libssp and libgomp and libquadmath
-          respectively. These features will fail to compile when building a
-          cross-compiler and are not necessary for the task of cross-compiling
-          the temporary libc.</para>
+          extension, threading, libmudflap, libssp, libgomp, libquadmath,
+          libatomic and libsanitizer respectively. These features will fail
+          to compile when building a cross-compiler and are not necessary
+          for the task of cross-compiling the temporary libc.</para>
         </listitem>
       </varlistentry>
 
@@ -212,10 +216,30 @@
       </varlistentry>
 
       <varlistentry>
-        <term><parameter>--enable-languages=c</parameter></term>
+        <term><parameter>--enable-languages=c,c++</parameter></term>
         <listitem>
-          <para>This option ensures that only the C compiler is built.
-          This is the only language needed now.</para>
+          <para>This option ensures that the C and C++ compilers are built.
+          The C++ compiler won't be fully functional yet, because it needs
+          the additional libstdc++ library, which cannot be built without
+          glibc support.</para>
+        </listitem>
+      </varlistentry>
+
+<!--      <varlistentry>
+        <term><parameter>- -enable-build-with-cxx</parameter></term>
+        <listitem>
+          <para>This option allows the compilation of GCC with the C++
+          compiler. Starting with 4.8, it will be the only possibility.</para>
+        </listitem>
+      </varlistentry>
+-->
+      <varlistentry>
+        <term><parameter>--disable-libstdc++-v3, --disable-libitm</parameter></term>
+        <listitem>
+          <para>These switches disable the building of the standard C++
+          library and the libitm library, which require glibc support,
+          not available yet. The standard C++ library will be built
+          after glibc since it is needed for the C++ compiler.</para>
         </listitem>
       </varlistentry>
 
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/gcc-pass2.xml lfs-cxx-gcc1st/chapter05/gcc-pass2.xml
--- lfsbook/chapter05/gcc-pass2.xml	2013-02-26 22:23:30.000000000 +0100
+++ lfs-cxx-gcc1st/chapter05/gcc-pass2.xml	2013-03-23 15:11:01.000000000 +0100
@@ -97,8 +97,7 @@
 tar -zxf ../mpc-&mpc-version;.tar.gz
 mv -v mpc-&mpc-version; mpc</userinput></screen>
 
-    <para>Again, do not build the .info files.  They are not needed here and
-    are broken with the current version of <command>makeinfo</command>.</para>
+    <para>Again, do not build the .info files. They are not needed here.</para>
 
     <screen><userinput remap="pre">sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure</userinput></screen>
 
@@ -112,7 +111,8 @@
 
     <para>Now prepare GCC for compilation:</para>
 
-<screen><userinput remap="configure">CC=$LFS_TGT-gcc \
+<screen><userinput remap="configure">CC=$LFS_TGT-gcc                 \
+CXX=$LFS_TGT-g++                \
 AR=$LFS_TGT-ar                  \
 RANLIB=$LFS_TGT-ranlib          \
 ../gcc-&gcc-version;/configure          \
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter05/libstdc++.xml lfs-cxx-gcc1st/chapter05/libstdc++.xml
--- lfsbook/chapter05/libstdc++.xml	1970-01-01 01:00:00.000000000 +0100
+++ lfs-cxx-gcc1st/chapter05/libstdc++.xml	2013-03-23 08:31:35.000000000 +0100
@@ -0,0 +1,126 @@
+<?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" role="wrap">
+  <?dbhtml filename="gcc-libstdc++.html"?>
+
+  <sect1info condition="script">
+    <productname>libstdc++</productname>
+    <productnumber>&gcc-version;</productnumber>
+    <address>&gcc-url;</address>
+  </sect1info>
+
+  <title>Libstdc++-&gcc-version;</title>
+
+  <indexterm zone="ch-tools-libstdcpp">
+    <primary sortas="a-GCC">GCC</primary>
+    <secondary>tools, libstdc++</secondary>
+  </indexterm>
+
+  <sect2 role="package">
+    <title/>
+
+    <para>Libstdc++ is the standard C++ library. It is needed for the correct
+    operation of the g++ compiler.</para>
+
+    <segmentedlist>
+      <segtitle>&buildtime;</segtitle>
+      <segtitle>&diskspace;</segtitle>
+
+      <seglistitem>
+        <seg>&libstdcpp-ch5-sbu;</seg>
+        <seg>&libstdcpp-ch5-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 directory for Libstdc++ and enter it:</para>
+
+<screen><userinput remap="pre">mkdir -pv ../gcc-build
+cd ../gcc-build</userinput></screen>
+
+    <para>Prepare Libstdc++ for compilation:</para>
+
+<screen><userinput remap="configure">../gcc-&gcc-version;/libstdc++-v3/configure \
+    --host=$LFS_TGT                      \
+    --prefix=/tools                      \
+    --disable-multilib                   \
+    --disable-shared                     \
+    --disable-nls                        \
+    --disable-libstdcxx-threads          \
+    --disable-libstdcxx-pch              \
+    --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
+
+    <variablelist>
+      <title>The meaning of the configure options:</title>
+
+      <varlistentry>
+        <term><parameter>--host=...</parameter></term>
+        <listitem>
+          <para>Indicates to use the cross compiler we have just built
+          instead of the one in <filename>/usr/bin</filename>.</para>
+        </listitem>
+      </varlistentry>
+
+      <varlistentry>
+        <term><parameter>--disable-libstdcxx-threads</parameter></term>
+        <listitem>
+          <para>Since we have not built the thread C library, the C++
+          one cannot be built as well.</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>
+
+      <varlistentry>
+        <term><parameter>--with-gxx-include-dir=/tools/include/c++/&gcc-version;</parameter></term>
+        <listitem>
+          <para>This is the location where the standard include files are
+          searched by the C++ compiler. In a normal build, this information
+          is automatically passed to the Libstdc++ <command>configure</command>
+          options from the toplevel directory. In our case, this information
+          must be explicitely given.</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>
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter06/binutils.xml lfs-cxx-gcc1st/chapter06/binutils.xml
--- lfsbook/chapter06/binutils.xml	2013-01-11 22:52:31.000000000 +0100
+++ lfs-cxx-gcc1st/chapter06/binutils.xml	2013-01-19 12:52:39.000000000 +0100
@@ -76,7 +76,7 @@
 
     <para>Prepare Binutils for compilation:</para>
 
-<screen><userinput remap="configure">../binutils-&binutils-version;/configure --prefix=/usr --enable-shared</userinput></screen>
+<screen><userinput remap="configure">../binutils-&binutils-version;/configure --prefix=/usr --enable-shared --disable-werror</userinput></screen>
 
     <note><para>There is an optional argument to <command>configure</command>,
     <option>--enable-lto</option>, that can be used to allow the
diff -aNur -x .svn -x patches -x .pc lfsbook/chapter06/gcc.xml lfs-cxx-gcc1st/chapter06/gcc.xml
--- lfsbook/chapter06/gcc.xml	2013-03-04 22:00:44.000000000 +0100
+++ lfs-cxx-gcc1st/chapter06/gcc.xml	2013-03-23 19:30:52.000000000 +0100
@@ -48,13 +48,12 @@
 
 <screen><userinput remap="pre">sed -i 's/install_to_$(INSTALL_DEST) //' libiberty/Makefile.in</userinput></screen>
 
-    <para>Again, do not build the .info files. They are broken with the current
+<!--<para>Again, do not build the .info files. They are broken with the current
     version of <command>makeinfo</command>.</para>
 
     <screen><userinput remap="pre">sed -i 's/BUILD_INFO=info/BUILD_INFO=/' gcc/configure</userinput></screen>
 
-
-
+-->
     <para>As in <xref linkend="ch-tools-gcc-pass2"/>, apply the following
     <command>sed</command> to force the build to use the
     <option>-fomit-frame-pointer</option> compiler flag in order to ensure
diff -aNur -x .svn -x patches -x .pc lfsbook/packages.ent lfs-cxx-gcc1st/packages.ent
--- lfsbook/packages.ent	2013-03-20 23:14:11.000000000 +0100
+++ lfs-cxx-gcc1st/packages.ent	2013-03-23 08:27:46.000000000 +0100
@@ -166,17 +166,19 @@
 <!ENTITY gawk-ch6-du "30 MB">
 <!ENTITY gawk-ch6-sbu "0.2 SBU">
 
-<!ENTITY gcc-version "4.7.2">
-<!ENTITY gcc-size "80,942 KB">
+<!ENTITY gcc-version "4.8.0">
+<!ENTITY gcc-size "84,633 KB">
 <!ENTITY gcc-url "&gnu;gcc/gcc-&gcc-version;/gcc-&gcc-version;.tar.bz2">
-<!ENTITY gcc-md5 "cc308a0891e778cfda7a151ab8a6e762">
+<!ENTITY gcc-md5 "e6040024eb9e761c3bea348d1fa5abb0">
 <!ENTITY gcc-home "http://gcc.gnu.org/";>
-<!ENTITY gcc-ch5p1-du "1.4 GB">
-<!ENTITY gcc-ch5p1-sbu "5.5 SBU">
-<!ENTITY gcc-ch5p2-du "1.8 GB">
-<!ENTITY gcc-ch5p2-sbu "7.1 SBU">
-<!ENTITY gcc-ch6-du "2.0 GB">
-<!ENTITY gcc-ch6-sbu "53.5 SBU">
+<!ENTITY gcc-ch5p1-du "1.73 GB">
+<!ENTITY gcc-ch5p1-sbu "5.9 SBU">
+<!ENTITY libstdcpp-ch5-du "734 MB">
+<!ENTITY libstdcpp-ch5-sbu "0.4 SBU">
+<!ENTITY gcc-ch5p2-du "1.9 GB">
+<!ENTITY gcc-ch5p2-sbu "8.1 SBU">
+<!ENTITY gcc-ch6-du "2.26 G">
+<!ENTITY gcc-ch6-sbu "64.6 SBU">
 
 <!ENTITY gdbm-version "1.10">
 <!ENTITY gdbm-size "640 KB">
@@ -203,10 +205,10 @@
 <!ENTITY glibc-url "&gnu;glibc/glibc-&glibc-version;.tar.xz">
 <!ENTITY glibc-md5 "87bf675c8ee523ebda4803e8e1cec638">
 <!ENTITY glibc-home "&gnu-software;libc/">
-<!ENTITY glibc-ch5-du "554 MB">
-<!ENTITY glibc-ch5-sbu "5.4 SBU">
-<!ENTITY glibc-ch6-du "852 MB">
-<!ENTITY glibc-ch6-sbu "17.6 SBU">
+<!ENTITY glibc-ch5-du "562 MB">
+<!ENTITY glibc-ch5-sbu "5.1 SBU">
+<!ENTITY glibc-ch6-du "944 MB">
+<!ENTITY glibc-ch6-sbu "19.3 SBU">
 
 <!ENTITY gmp-version "5.1.1">
 <!ENTITY gmp-size "1,771 KB">
-- 
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page

Reply via email to