source: chapter05/gcc-pass1.xml@ 460f575

arm
Last change on this file since 460f575 was 460f575, checked in by William Harrington <kb0iic@…>, 2 years ago

Initial LFS-ARM book.

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