source: chapter05/gcc-pass1.xml@ efcb393

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since efcb393 was efcb393, checked in by Pierre Labastie <pieere@…>, 4 years ago

Make the new book

git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/cross-chap5@11831 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 7.9 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
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
8<sect1 id="ch-tools-gcc-pass1" role="wrap" xreflabel="gcc-pass1">
9 <?dbhtml filename="gcc-pass1.html"?>
10
11 <sect1info condition="script">
12 <productname>gcc-pass1</productname>
13 <productnumber>&gcc-version;</productnumber>
14 <address>&gcc-url;</address>
15 </sect1info>
16
17 <title>GCC-&gcc-version; - Pass 1</title>
18
19 <indexterm zone="ch-tools-gcc-pass1">
20 <primary sortas="a-GCC">GCC</primary>
21 <secondary>tools, pass 1</secondary>
22 </indexterm>
23
24 <sect2 role="package">
25 <title/>
26
27 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
28 href="../chapter06/gcc.xml"
29 xpointer="xpointer(/sect1/sect2[1]/para[1])"/>
30
31 <segmentedlist>
32 <segtitle>&buildtime;</segtitle>
33 <segtitle>&diskspace;</segtitle>
34
35 <seglistitem>
36 <seg>&gcc-ch5p1-sbu;</seg>
37 <seg>&gcc-ch5p1-du;</seg>
38 </seglistitem>
39 </segmentedlist>
40
41 </sect2>
42
43 <sect2 role="installation">
44 <title>Installation of Cross GCC</title>
45
46 <para>GCC requires the GMP, MPFR and MPC packages. As these packages may
47 not be included in your host distribution, they will be built with
48 GCC. Unpack each package into the GCC source directory and rename the
49 resulting directories so the GCC build procedures will automatically
50 use them:</para>
51
52 <note><para>There are frequent misunderstandings about this chapter. The
53 procedures are the same as every other chapter as explained earlier (<xref
54 linkend='buildinstr'/>). First extract the gcc tarball from the sources
55 directory and then change to the directory created. Only then should you
56 proceed with the instructions below.</para></note>
57
58<screen><userinput remap="pre">tar -xf ../mpfr-&mpfr-version;.tar.xz
59mv -v mpfr-&mpfr-version; mpfr
60tar -xf ../gmp-&gmp-version;.tar.xz
61mv -v gmp-&gmp-version; gmp
62tar -xf ../mpc-&mpc-version;.tar.gz
63mv -v mpc-&mpc-version; mpc</userinput></screen>
64
65 <para>On x86_64 hosts, set the default directory name for
66 64-bit libraries to <quote>lib</quote>:</para>
67
68<screen><userinput remap="pre">case $(uname -m) in
69 x86_64)
70 sed -e '/m64=/s/lib64/lib/' \
71 -i.orig gcc/config/i386/t-linux64
72 ;;
73esac</userinput></screen>
74
75 <para>The GCC documentation recommends building GCC
76 in a dedicated build directory:</para>
77
78<screen><userinput remap="pre">mkdir -v build
79cd build</userinput></screen>
80
81 <para>Prepare GCC for compilation:</para>
82
83<screen><userinput remap="configure">../configure \
84 --target=$LFS_TGT \
85 --prefix=$LFS/tools \
86 --with-glibc-version=2.11 \
87 --with-sysroot=$LFS \
88 --with-newlib \
89 --without-headers \
90 --enable-initfini-array \
91 --disable-nls \
92 --disable-shared \
93 --disable-multilib \
94 --disable-decimal-float \
95 --disable-threads \
96 --disable-libatomic \
97 --disable-libgomp \
98 --disable-libquadmath \
99 --disable-libssp \
100 --disable-libvtv \
101 --disable-libstdcxx \
102 --enable-languages=c,c++</userinput></screen>
103 <variablelist>
104 <title>The meaning of the configure options:</title>
105
106 <varlistentry>
107 <term><parameter>--with-glibc-version=2.11</parameter></term>
108 <listitem>
109 <para>This option ensures the package will be compatible with the host's
110 version of glibc. It is set to the minimum glibc requirement
111 specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
112 </listitem>
113 </varlistentry>
114
115 <varlistentry>
116 <term><parameter>--with-newlib</parameter></term>
117 <listitem>
118 <para>Since a working C library is not yet available, this ensures
119 that the inhibit_libc constant is defined when building libgcc. This prevents
120 the compiling of any code that requires libc support.</para>
121 </listitem>
122 </varlistentry>
123
124 <varlistentry>
125 <term><parameter>--without-headers</parameter></term>
126 <listitem>
127 <para>When creating a complete cross-compiler, GCC requires
128 standard headers compatible with the target system. For our
129 purposes these headers will not be needed. This switch prevents
130 GCC from looking for them.</para>
131 </listitem>
132 </varlistentry>
133
134 <varlistentry>
135 <term><parameter>--disable-shared</parameter></term>
136 <listitem>
137 <para>This switch forces GCC to link its internal libraries
138 statically. We need this because the shared libraries require glibc,
139 which is not yet installed on the target system.</para>
140 </listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><parameter>--disable-decimal-float, --disable-threads,
145 --disable-libatomic, --disable-libgomp, <!--- -disable-libmpx,-->
146 --disable-libquadmath, --disable-libssp, --disable-libvtv,
147 --disable-libstdcxx</parameter></term>
148 <listitem>
149 <para>These switches disable support for the decimal floating point
150 extension, threading, libatomic, libgomp, <!--libmpx, --> libquadmath, libssp,
151 libvtv, and the C++ standard library respectively. These features
152 will fail to compile when building a cross-compiler and are not
153 necessary for the task of cross-compiling the temporary libc.</para>
154 </listitem>
155 </varlistentry>
156
157 <varlistentry>
158 <term><parameter>--disable-multilib</parameter></term>
159 <listitem>
160 <para>On x86_64, LFS does not yet support a multilib configuration.
161 This switch is harmless for x86.</para>
162 </listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term><parameter>--enable-languages=c,c++</parameter></term>
167 <listitem>
168 <para>This option ensures that only the C and C++ compilers are built.
169 These are the only languages needed now.</para>
170 </listitem>
171 </varlistentry>
172
173 </variablelist>
174
175 <para>Compile GCC by running:</para>
176
177<screen><userinput remap="make">make</userinput></screen>
178
179 <para>Install the package:</para>
180
181 <screen><userinput remap="install">make install</userinput></screen>
182
183 <para>This build of GCC has installed a couple of internal system
184 headers. Normally one of them, <filename>limits.h</filename>, would in turn
185 include the corresponding system <filename>limits.h</filename> header, in
186 this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
187 time of this build of gcc <filename>$LFS/usr/include/limits.h</filename>
188 does not exist, so the internal header that has just been installed is a
189 partial, self-contained file and does not include the extended features of
190 the system header. This is adequate for building glibc, but the full
191 internal header will be needed later. Create a full version of the internal
192 header using a command that is identical to what the GCC build system does
193 in normal circumstances:</para>
194
195<screen><userinput remap="install">cd ..
196cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
197 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
198 </sect2>
199
200 <sect2 role="content">
201 <title/>
202
203 <para>Details on this package are located in
204 <xref linkend="contents-gcc" role="."/></para>
205
206 </sect2>
207
208</sect1>
Note: See TracBrowser for help on using the repository browser.