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

Last change on this file since f8ce9f5 was c72b980, checked in by Andrew Bradford <andrew@…>, 8 years ago

Update gcc to version 6.2

This removes the need to patch gcc due to musl as gcc6 supports musl by
simply calling out a musl-based triplet for the target.

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