source: clfs-embedded/BOOK/cross-tools/common/gcc-static.xml@ 466a568

Last change on this file since 466a568 was 94e2400, checked in by Andrew Bradford <andrew@…>, 11 years ago

Use ${CLFS}/cross-tools/${CLFS_TARGET} as sysroot dir

BUG: This uses ${CLFS_TARGET} before it is exported within materials
chapter for creating the sysroot directory!

  • Property mode set to 100644
File size: 9.2 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<!-- Common GCC-Static -->
9
10<sect1 id="ch-cross-tools-gcc-static" role="wrap">
11 <?dbhtml filename="gcc-static.html"?>
12
13 <title>Cross GCC-&gcc-version; - Static</title>
14
15 <indexterm zone="ch-cross-tools-gcc-static">
16 <primary sortas="a-GCC">GCC</primary>
17 <secondary>cross tools, static</secondary>
18 </indexterm>
19
20 <sect2 role="package">
21 <title/>
22
23 <para>The GCC package contains the GNU compiler collection, which includes
24 the C compiler.</para>
25
26 </sect2>
27
28 <sect2 role="installation">
29 <title os="a">Installation of Cross GCC Compiler with Static libgcc
30 and no Threads</title>
31
32 <para os="aa">In order to work with musl-libc, GCC needs to be patched:</para>
33
34<screen os="ab"><userinput>patch -Np1 -i ../&gcc-musl-patch;</userinput></screen>
35
36 <para os="b">GCC requires the GMP, MPFR, and MPC packages to either be
37 present on the host or to be present in source form within the gcc source
38 tree. Unpack these into the GCC directory after unpacking GCC:</para>
39
40<screen os="ba"><userinput>tar xf ../mpfr-&mpfr-version;.tar.bz2
41mv -v mpfr-&mpfr-version; mpfr
42tar xf ../gmp-&gmp-version;.tar.bz2
43mv -v gmp-&gmp-version; gmp
44tar xf ../mpc-&mpc-version;.tar.gz
45mv -v mpc-&mpc-version; mpc</userinput></screen>
46
47 <para os="c">The GCC documentation recommends building GCC outside of the source
48 directory in a dedicated build directory:</para>
49
50<screen os="d"><userinput>mkdir -v ../gcc-build
51cd ../gcc-build</userinput></screen>
52
53 <para os="e">Prepare GCC for compilation:</para>
54
55<!-- This is the common configure line for GCC-Static. -->
56<!-- It's not actually used by any arch but is here for reference. -->
57<screen os="ae"><userinput>../gcc-&gcc-version;/configure \
58 --prefix=${CLFS}/cross-tools \
59 --build=${CLFS_HOST} \
60 --host=${CLFS_HOST} \
61 --target=${CLFS_TARGET} \
62 --with-sysroot=${CLFS}/cross-tools/${CLFS_TARGET} \
63 --disable-nls \
64 --disable-shared \
65 --without-headers \
66 --with-newlib \
67 --disable-decimal-float \
68 --disable-libgomp \
69 --disable-libmudflap \
70 --disable-libssp \
71 --disable-libatomic \
72 --disable-libquadmath \
73 --disable-threads \
74 --enable-languages=c \
75 --disable-multilib \
76 --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \
77 --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen>
78
79 <variablelist os="af">
80 <title>The meaning of the configure options:</title>
81
82 <varlistentry os="af1">
83 <term><parameter>--prefix=${CLFS}/cross-tools</parameter></term>
84 <listitem>
85 <para>This tells the configure script to prepare to install the
86 package in the <filename class="directory">${CLFS}/cross-tools</filename>
87 directory.</para>
88 </listitem>
89 </varlistentry>
90
91 <varlistentry os="af2">
92 <term><parameter>--build=${CLFS_HOST}</parameter></term>
93 <listitem>
94 <para>This tells the configure script the triplet to use to build GCC.
95 It will use ${CLFS_HOST} as that's where it's being built.</para>
96 </listitem>
97 </varlistentry>
98
99 <varlistentry os="af3">
100 <term><parameter>--host=${CLFS_HOST}</parameter></term>
101 <listitem>
102 <para>This tells the configure script the triplet of the machine GCC
103 will be executed on when actually cross compiling. It will use
104 ${CLFS_HOST} as that's where GCC will execute when cross compiling
105 software later.</para>
106 </listitem>
107 </varlistentry>
108
109 <varlistentry os="af4">
110 <term><parameter>--target=${CLFS_TARGET}</parameter></term>
111 <listitem>
112 <para>This tells the configure script the triplet of the machine GCC
113 will build executables for. It will use ${CLFS_TARGET} so that software
114 compiled with this version of GCC can be executed on the embedded machine
115 target.</para>
116 </listitem>
117 </varlistentry>
118
119 <varlistentry os="af5">
120 <term><parameter>--with-sysroot=${CLFS}/cross-tools/${CLFS_TARGET}</parameter></term>
121 <listitem>
122 <para>This tells configure that ${CLFS}/cross-tools/${CLFS_TARGET} is going
123 to be the temporary root of our system. It will now use the specified
124 sysroot as a prefix of the default search paths.</para>
125 </listitem>
126 </varlistentry>
127
128 <varlistentry os="af6">
129 <term><parameter>--disable-nls</parameter></term>
130 <listitem>
131 <para>This disables internationalization as i18n is not needed for the
132 cross-compile tools.</para>
133 </listitem>
134 </varlistentry>
135
136 <varlistentry os="af7">
137 <term><parameter>--disable-shared</parameter></term>
138 <listitem>
139 <para>Disables the creation of the shared libraries.</para>
140 </listitem>
141 </varlistentry>
142
143 <varlistentry os="af11">
144 <term><parameter>--without-headers</parameter></term>
145 <listitem>
146 <para>Tells configure to not use any headers from any C libraries.
147 This is needed as we haven't yet built the C library and to prevent
148 influence from the host environment.</para>
149 </listitem>
150 </varlistentry>
151
152 <varlistentry os="af12">
153 <term><parameter>--with-newlib</parameter></term>
154 <listitem>
155 <para>Tells configure to build libgcc without needing any C
156 libraries.</para>
157 </listitem>
158 </varlistentry>
159
160 <varlistentry os="af13">
161 <term><parameter>--disable-decimal-float</parameter></term>
162 <listitem>
163 <para>Tells configure to disable IEEE 754-2008 decimal floating
164 point support. Decimal floating point support isn't needed yet.</para>
165 </listitem>
166 </varlistentry>
167
168 <varlistentry os="af14">
169 <term><parameter>--disable-libgomp</parameter></term>
170 <listitem>
171 <para>Tells configure to not build the GOMP run-time libraries.
172 GOMP is the GNU implementation of OpenMP, a API for shared-memory
173 parallel programming.</para>
174 </listitem>
175 </varlistentry>
176
177 <varlistentry os="af15">
178 <term><parameter>--disable-libmudflap</parameter></term>
179 <listitem>
180 <para>Tells configure to not build libmudflap. Mudflap is a
181 library that can be used to help check for proper pointer usage.</para>
182 </listitem>
183 </varlistentry>
184
185 <varlistentry os="af16">
186 <term><parameter>--disable-libssp</parameter></term>
187 <listitem>
188 <para>Tells configure not to build run-time libraries for stack
189 smashing detection.</para>
190 </listitem>
191 </varlistentry>
192
193 <varlistentry os="af17">
194 <term><parameter>--disable-libatomic</parameter></term>
195 <listitem>
196 <para>Tells configure not to build atomic operations.</para>
197 </listitem>
198 </varlistentry>
199
200 <varlistentry os="af18">
201 <term><parameter>--disable-libquadmath</parameter></term>
202 <listitem>
203 <para>Tells configure not to build quad math operations.</para>
204 </listitem>
205 </varlistentry>
206
207 <varlistentry os="af19">
208 <term><parameter>--disable-threads</parameter></term>
209 <listitem>
210 <para>This will prevent GCC from looking for the multi-thread
211 include files, since they haven't been created for this architecture
212 yet. GCC will be able to find the multi-thread information after
213 the glib headers are created.</para>
214 </listitem>
215 </varlistentry>
216
217 <varlistentry os="af20">
218 <term><parameter>--enable-languages=c</parameter></term>
219 <listitem>
220 <para>This option ensures that only the C compiler is built.</para>
221 </listitem>
222 </varlistentry>
223
224 <varlistentry os="af21">
225 <term><parameter>--disable-multilib</parameter></term>
226 <listitem>
227 <para>This option specifies that multiple target libraries should
228 not be built.</para>
229 </listitem>
230 </varlistentry>
231
232 <varlistentry os="af22">
233 <term><parameter>--with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src</parameter></term>
234 <listitem>
235 <para>Tells configure how to find the mpfr headers.</para>
236 </listitem>
237 </varlistentry>
238
239 <varlistentry os="af23">
240 <term><parameter>--with-mpfr-lib=$(pwd)/mpfr/src/.libs</parameter></term>
241 <listitem>
242 <para>Tells configure to use the mpfr libraries built within the GCC
243 build directory. This happens automatically but is needed to
244 prevent GCC from searching the host's normal library paths.</para>
245 </listitem>
246 </varlistentry>
247
248 </variablelist>
249
250 <para os="ah">Continue with compiling the package:</para>
251
252<screen os="ai"><userinput>make all-gcc all-target-libgcc</userinput></screen>
253
254 <para os="aj">Install the package:</para>
255
256<screen os="ak"><userinput>make install-gcc install-target-libgcc</userinput></screen>
257
258 </sect2>
259
260 <sect2 role="content">
261 <title/>
262
263 <para>Details on this package are located in <xref
264 linkend="contents-gcc" role="."/></para>
265
266 </sect2>
267
268</sect1>
Note: See TracBrowser for help on using the repository browser.