source: chapter05/gcc-pass1.xml@ 0ebda11

ml-11.0 multilib
Last change on this file since 0ebda11 was 0ebda11, checked in by Thomas Trepl (Moody) <thomas@…>, 3 years ago

Remove entities for multilib pathes
Add usage of libc_cv_rtlddir

  • Property mode set to 100644
File size: 10.3 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="../chapter08/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-tmpp1-sbu;</seg>
37 <seg>&gcc-tmpp1-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>
64<userinput remap="pre" arch="ml_32,ml_x32,ml_all">tar -xf ../isl-&isl-version;.tar.xz
65mv -v isl-&isl-version; isl</userinput></screen>
66
67 <para arch="default">On x86_64 hosts, set the default directory name for
68 64-bit libraries to <quote>lib</quote>:</para>
69
70<screen arch="default"><userinput remap="pre">case $(uname -m) in
71 x86_64)
72 sed -e '/m64=/s/lib64/lib/' \
73 -i.orig gcc/config/i386/t-linux64
74 ;;
75esac</userinput></screen>
76
77 <para arch="ml_32,ml_x32,ml_all">Change the default directory name for
78 libraries:</para>
79
80<screen arch="ml_32,ml_x32,ml_all"><userinput remap="pre">sed -e '/m64=/s/lib64/lib/' \
81 -e '/m32=/s/m32=.*/m32=..\/lib32$(call if_multiarch,:i386-linux-gnu)/' \
82 -i.orig gcc/config/i386/t-linux64
83</userinput></screen>
84
85 <para>The GCC documentation recommends building GCC
86 in a dedicated build directory:</para>
87
88<screen><userinput remap="pre">mkdir -v build
89cd build</userinput></screen>
90
91 <para>Prepare GCC for compilation:</para>
92
93<screen arch="default"><userinput remap="configure">../configure \
94 --target=$LFS_TGT \
95 --prefix=$LFS/tools \
96 --with-glibc-version=2.11 \
97 --with-sysroot=$LFS \
98 --with-newlib \
99 --without-headers \
100 --enable-initfini-array \
101 --disable-nls \
102 --disable-shared \
103 --disable-multilib \
104 --disable-decimal-float \
105 --disable-threads \
106 --disable-libatomic \
107 --disable-libgomp \
108 --disable-libquadmath \
109 --disable-libssp \
110 --disable-libvtv \
111 --disable-libstdcxx \
112 --enable-languages=c,c++</userinput></screen>
113<screen arch="ml_32,ml_x32,ml_all"><userinput remap="configure"
114 arch="ml_32">mlist=m64,m32</userinput><userinput remap="configure"
115 arch="ml_x32">mlist=m64,mx32</userinput><userinput remap="configure"
116 arch="ml_all">mlist=m64,m32,mx32</userinput>
117<userinput remap="configure">../configure \
118 --target=$LFS_TGT \
119 --prefix=$LFS/tools \
120 --with-glibc-version=2.11 \
121 --with-sysroot=$LFS \
122 --with-newlib \
123 --without-headers \
124 --enable-initfini-array \
125 --disable-nls \
126 --disable-shared \
127 --enable-multilib --with-multilib-list=$mlist \
128 --disable-decimal-float \
129 --disable-threads \
130 --disable-libatomic \
131 --disable-libgomp \
132 --disable-libquadmath \
133 --disable-libssp \
134 --disable-libvtv \
135 --disable-libstdcxx \
136 --enable-languages=c,c++</userinput></screen>
137
138 <variablelist>
139 <title>The meaning of the configure options:</title>
140
141 <varlistentry>
142 <term><parameter>--with-glibc-version=2.11</parameter></term>
143 <listitem>
144 <para>This option ensures the package will be compatible with the host's
145 version of glibc. It is set to the minimum glibc requirement
146 specified in the <xref linkend="ch-partitioning-hostreqs"/>.</para>
147 </listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><parameter>--with-newlib</parameter></term>
152 <listitem>
153 <para>Since a working C library is not yet available, this ensures
154 that the inhibit_libc constant is defined when building libgcc. This prevents
155 the compiling of any code that requires libc support.</para>
156 </listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><parameter>--without-headers</parameter></term>
161 <listitem>
162 <para>When creating a complete cross-compiler, GCC requires
163 standard headers compatible with the target system. For our
164 purposes these headers will not be needed. This switch prevents
165 GCC from looking for them.</para>
166 </listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><parameter>--enable-initfini-array</parameter></term>
171 <listitem>
172 <para>This switch forces the use of some internal data structures
173 that are needed but cannot be detected when building a cross
174 compiler.</para>
175 </listitem>
176 </varlistentry>
177
178 <varlistentry>
179 <term><parameter>--disable-shared</parameter></term>
180 <listitem>
181 <para>This switch forces GCC to link its internal libraries
182 statically. We need this because the shared libraries require glibc,
183 which is not yet installed on the target system.</para>
184 </listitem>
185 </varlistentry>
186
187 <varlistentry arch="default">
188 <term><parameter>--disable-multilib</parameter></term>
189 <listitem>
190 <para>On x86_64, LFS does not support a multilib configuration.
191 This switch is harmless for x86.</para>
192 </listitem>
193 </varlistentry>
194 <varlistentry arch="ml_32,ml_x32,ml_all">
195 <term><parameter>--enable-multilib --with-multilib-list=...</parameter></term>
196 <listitem>
197 <para>LFS canbe used to support multilib. Which they are is
198 specified in the multilib list.</para>
199 </listitem>
200 </varlistentry>
201
202 <varlistentry>
203 <term><parameter>--disable-decimal-float, --disable-threads,
204 --disable-libatomic, --disable-libgomp,
205 --disable-libquadmath, --disable-libssp, --disable-libvtv,
206 --disable-libstdcxx</parameter></term>
207 <listitem>
208 <para>These switches disable support for the decimal floating point
209 extension, threading, libatomic, libgomp, libquadmath, libssp,
210 libvtv, and the C++ standard library respectively. These features
211 will fail to compile when building a cross-compiler and are not
212 necessary for the task of cross-compiling the temporary libc.</para>
213 </listitem>
214 </varlistentry>
215
216 <varlistentry>
217 <term><parameter>--enable-languages=c,c++</parameter></term>
218 <listitem>
219 <para>This option ensures that only the C and C++ compilers are built.
220 These are the only languages needed now.</para>
221 </listitem>
222 </varlistentry>
223
224 </variablelist>
225
226 <para>Compile GCC by running:</para>
227
228<screen><userinput remap="make">make</userinput></screen>
229
230 <para>Install the package:</para>
231
232 <screen><userinput remap="install">make install</userinput></screen>
233
234 <para>This build of GCC has installed a couple of internal system
235 headers. Normally one of them, <filename>limits.h</filename>, would in turn
236 include the corresponding system <filename>limits.h</filename> header, in
237 this case, <filename>$LFS/usr/include/limits.h</filename>. However, at the
238 time of this build of GCC <filename>$LFS/usr/include/limits.h</filename>
239 does not exist, so the internal header that has just been installed is a
240 partial, self-contained file and does not include the extended features of
241 the system header. This is adequate for building glibc, but the full
242 internal header will be needed later. Create a full version of the internal
243 header using a command that is identical to what the GCC build system does
244 in normal circumstances:</para>
245
246<screen><userinput remap="install">cd ..
247cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
248 `dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h</userinput></screen>
249 </sect2>
250
251 <sect2 role="content">
252 <title/>
253
254 <para>Details on this package are located in
255 <xref linkend="contents-gcc" role="."/></para>
256
257 </sect2>
258
259</sect1>
Note: See TracBrowser for help on using the repository browser.