[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[89afa22] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
| 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
| 7 |
|
---|
[459d493] | 8 | <sect1 id="ch-tools-libstdcpp" role="wrap">
|
---|
| 9 | <?dbhtml filename="gcc-libstdc++.html"?>
|
---|
[89afa22] | 10 |
|
---|
| 11 | <sect1info condition="script">
|
---|
[714599f] | 12 | <productname>gcc-libstdc++</productname>
|
---|
[89afa22] | 13 | <productnumber>&gcc-version;</productnumber>
|
---|
| 14 | <address>&gcc-url;</address>
|
---|
| 15 | </sect1info>
|
---|
| 16 |
|
---|
[459d493] | 17 | <title>Libstdc++ from GCC-&gcc-version;</title>
|
---|
[89afa22] | 18 |
|
---|
[459d493] | 19 | <indexterm zone="ch-tools-libstdcpp">
|
---|
[89afa22] | 20 | <primary sortas="a-GCC">GCC</primary>
|
---|
[6dfcfecc] | 21 | <secondary>tools, libstdc++ pass 1</secondary>
|
---|
[89afa22] | 22 | </indexterm>
|
---|
| 23 |
|
---|
| 24 | <sect2 role="package">
|
---|
| 25 | <title/>
|
---|
| 26 |
|
---|
[a26f29f] | 27 | <para>Libstdc++ is the standard C++ library. It is needed
|
---|
[1067bac] | 28 | to compile C++ code
|
---|
| 29 | (part of GCC is written in C++), but we had to defer its installation
|
---|
| 30 | when we built <xref linkend="ch-tools-gcc-pass1"/>
|
---|
[f6820bb6] | 31 | because Libstdc++ depends on Glibc, which was not yet available in the target
|
---|
[6dfcfecc] | 32 | directory.
|
---|
[1067bac] | 33 | </para>
|
---|
[89afa22] | 34 |
|
---|
| 35 | <segmentedlist>
|
---|
| 36 | <segtitle>&buildtime;</segtitle>
|
---|
| 37 | <segtitle>&diskspace;</segtitle>
|
---|
| 38 |
|
---|
| 39 | <seglistitem>
|
---|
[6dfcfecc] | 40 | <seg>&libstdcpp-tmpp1-sbu;</seg>
|
---|
| 41 | <seg>&libstdcpp-tmpp1-du;</seg>
|
---|
[89afa22] | 42 | </seglistitem>
|
---|
| 43 | </segmentedlist>
|
---|
| 44 |
|
---|
| 45 | </sect2>
|
---|
| 46 |
|
---|
| 47 | <sect2 role="installation">
|
---|
| 48 | <title>Installation of Target Libstdc++</title>
|
---|
| 49 |
|
---|
| 50 | <note>
|
---|
| 51 | <para><application>Libstdc++</application> is part of the GCC sources.
|
---|
| 52 | You should first unpack the GCC tarball and change to the
|
---|
| 53 | <filename>gcc-&gcc-version;</filename> directory.</para>
|
---|
| 54 | </note>
|
---|
| 55 |
|
---|
[f6820bb6] | 56 | <para>Create a separate build directory for Libstdc++ and enter it:</para>
|
---|
[89afa22] | 57 |
|
---|
[f1dd547] | 58 | <screen><userinput remap="pre">mkdir -v build
|
---|
| 59 | cd build</userinput></screen>
|
---|
[89afa22] | 60 |
|
---|
[f6820bb6] | 61 | <para>Prepare Libstdc++ for compilation:</para>
|
---|
[89afa22] | 62 |
|
---|
[56f8a00] | 63 | <screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure">../libstdc++-v3/configure \
|
---|
[377270b] | 64 | --host=$LFS_TGT \
|
---|
| 65 | --build=$(../config.guess) \
|
---|
| 66 | --prefix=/usr \
|
---|
| 67 | --enable-multilib \
|
---|
| 68 | --disable-nls \
|
---|
| 69 | --disable-libstdcxx-pch \
|
---|
| 70 | --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
|
---|
| 71 | <screen arch="default"><userinput remap="configure">../libstdc++-v3/configure \
|
---|
[3dc9543] | 72 | --host=$LFS_TGT \
|
---|
[6dfcfecc] | 73 | --build=$(../config.guess) \
|
---|
| 74 | --prefix=/usr \
|
---|
[3dc9543] | 75 | --disable-multilib \
|
---|
[6dfcfecc] | 76 | --disable-nls \
|
---|
[3dc9543] | 77 | --disable-libstdcxx-pch \
|
---|
[89afa22] | 78 | --with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</userinput></screen>
|
---|
| 79 |
|
---|
| 80 | <variablelist>
|
---|
| 81 | <title>The meaning of the configure options:</title>
|
---|
| 82 |
|
---|
| 83 | <varlistentry>
|
---|
| 84 | <term><parameter>--host=...</parameter></term>
|
---|
| 85 | <listitem>
|
---|
[f6820bb6] | 86 | <para>Specifies that the cross-compiler we have just built
|
---|
[ceebda5] | 87 | should be used instead of the one in
|
---|
| 88 | <filename>/usr/bin</filename>.</para>
|
---|
[89afa22] | 89 | </listitem>
|
---|
| 90 | </varlistentry>
|
---|
[6dfcfecc] | 91 |
|
---|
| 92 | <varlistentry arch="ml_32,ml_x32,ml_all">
|
---|
[56f8a00] | 93 | <term><parameter>--enable-multilib</parameter></term>
|
---|
[89afa22] | 94 | <listitem>
|
---|
[56f8a00] | 95 | <para>Enable building multilib objects.</para>
|
---|
[89afa22] | 96 | </listitem>
|
---|
| 97 | </varlistentry>
|
---|
[6dfcfecc] | 98 |
|
---|
[89afa22] | 99 | <varlistentry>
|
---|
| 100 | <term><parameter>--disable-libstdcxx-pch</parameter></term>
|
---|
| 101 | <listitem>
|
---|
| 102 | <para>This switch prevents the installation of precompiled
|
---|
| 103 | include files, which are not needed at this stage.</para>
|
---|
| 104 | </listitem>
|
---|
| 105 | </varlistentry>
|
---|
| 106 |
|
---|
| 107 | <varlistentry>
|
---|
[c5be634] | 108 | <term><parameter>--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/&gcc-version;</parameter></term>
|
---|
[89afa22] | 109 | <listitem>
|
---|
[174d1bf] | 110 | <para>This specifies the installation directory for include files.
|
---|
[f6820bb6] | 111 | Because Libstdc++ is the standard C++ library for LFS, this
|
---|
[174d1bf] | 112 | directory should match the location where the C++ compiler
|
---|
| 113 | (<command>$LFS_TGT-g++</command>) would search for the
|
---|
| 114 | standard C++ include files. In a normal build, this information
|
---|
[f6820bb6] | 115 | is automatically passed to the Libstdc++ <command>configure</command>
|
---|
[edbeeb5] | 116 | options from the top level directory. In our case, this information
|
---|
[174d1bf] | 117 | must be explicitly given.
|
---|
| 118 | The C++ compiler will prepend the sysroot path
|
---|
[f6820bb6] | 119 | <filename class="directory">$LFS</filename> (specified when building
|
---|
| 120 | GCC-pass1) to the include file search path, so it will actually
|
---|
[174d1bf] | 121 | search in
|
---|
[2cf3c176] | 122 | <filename class="directory">$LFS/tools/$LFS_TGT/include/c++/&gcc-version;</filename>.
|
---|
| 123 | The combination of the <parameter>DESTDIR</parameter>
|
---|
[174d1bf] | 124 | variable (in the <command>make install</command> command below)
|
---|
[f6820bb6] | 125 | and this switch causes the headers to be installed there.</para>
|
---|
[89afa22] | 126 | </listitem>
|
---|
| 127 | </varlistentry>
|
---|
| 128 |
|
---|
| 129 | </variablelist>
|
---|
| 130 |
|
---|
[f6820bb6] | 131 | <para>Compile Libstdc++ by running:</para>
|
---|
[89afa22] | 132 |
|
---|
| 133 | <screen><userinput remap="make">make</userinput></screen>
|
---|
| 134 |
|
---|
| 135 | <para>Install the library:</para>
|
---|
| 136 |
|
---|
[6dfcfecc] | 137 | <screen><userinput remap="install">make DESTDIR=$LFS install</userinput></screen>
|
---|
[89afa22] | 138 |
|
---|
[6099a471] | 139 | <para>Remove the libtool archive files because they are harmful for
|
---|
[f6820bb6] | 140 | cross-compilation:</para>
|
---|
[6099a471] | 141 |
|
---|
[d269e20] | 142 | <screen><userinput remap="install">rm -v $LFS/usr/lib/lib{stdc++{,exp,fs},supc++}.la</userinput></screen>
|
---|
[6099a471] | 143 |
|
---|
[89afa22] | 144 | </sect2>
|
---|
| 145 |
|
---|
| 146 | <sect2 role="content">
|
---|
| 147 | <title/>
|
---|
| 148 |
|
---|
| 149 | <para>Details on this package are located in
|
---|
| 150 | <xref linkend="contents-gcc" role="."/></para>
|
---|
| 151 |
|
---|
| 152 | </sect2>
|
---|
| 153 |
|
---|
| 154 | </sect1>
|
---|