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

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

Add musl patches for gcc and binutils

  • Property mode set to 100644
File size: 8.4 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 and C++ compilers.</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/sysroot \
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</userinput></screen>
76
77 <variablelist os="af">
78 <title>The meaning of the configure options:</title>
79
80 <varlistentry os="af1">
81 <term><parameter>--prefix=${CLFS}/cross-tools</parameter></term>
82 <listitem>
83 <para>This tells the configure script to prepare to install the
84 package in the <filename class="directory">${CLFS}/cross-tools</filename>
85 directory.</para>
86 </listitem>
87 </varlistentry>
88
89 <varlistentry os="af2">
90 <term><parameter>--build=${CLFS_HOST}</parameter></term>
91 <listitem>
92 <para>This tells the configure script the triplet to use to build GCC.
93 It will use ${CLFS_HOST} as that's where it's being built.</para>
94 </listitem>
95 </varlistentry>
96
97 <varlistentry os="af3">
98 <term><parameter>--host=${CLFS_HOST}</parameter></term>
99 <listitem>
100 <para>This tells the configure script the triplet of the machine GCC
101 will be executed on when actually cross compiling. It will use
102 ${CLFS_HOST} as that's where GCC will execute when cross compiling
103 software later.</para>
104 </listitem>
105 </varlistentry>
106
107 <varlistentry os="af4">
108 <term><parameter>--target=${CLFS_TARGET}</parameter></term>
109 <listitem>
110 <para>This tells the configure script the triplet of the machine GCC
111 will build executables for. It will use ${CLFS_TARGET} so that software
112 compiled with this version of GCC can be executed on the embedded machine
113 target.</para>
114 </listitem>
115 </varlistentry>
116
117 <varlistentry os="af5">
118 <term><parameter>--with-sysroot=${CLFS}/cross-tools/sysroot</parameter></term>
119 <listitem>
120 <para>This tells configure that ${CLFS}/cross-tools/sysroot is going
121 to be the temporary root of our system. It will now use the specified
122 sysroot as a prefix of the default search paths.</para>
123 </listitem>
124 </varlistentry>
125
126 <varlistentry os="af6">
127 <term><parameter>--disable-nls</parameter></term>
128 <listitem>
129 <para>This disables internationalization as i18n is not needed for the
130 cross-compile tools.</para>
131 </listitem>
132 </varlistentry>
133
134 <varlistentry os="af7">
135 <term><parameter>--disable-shared</parameter></term>
136 <listitem>
137 <para>Disables the creation of the shared libraries.</para>
138 </listitem>
139 </varlistentry>
140
141 <varlistentry os="af11">
142 <term><parameter>--without-headers</parameter></term>
143 <listitem>
144 <para>Tells configure to not use any headers from any C libraries.
145 This is needed as we haven't yet built the C library and to prevent
146 influence from the host environment.</para>
147 </listitem>
148 </varlistentry>
149
150 <varlistentry os="af12">
151 <term><parameter>--with-newlib</parameter></term>
152 <listitem>
153 <para>Tells configure to build libgcc without needing any C
154 libraries.</para>
155 </listitem>
156 </varlistentry>
157
158 <varlistentry os="af13">
159 <term><parameter>--disable-decimal-float</parameter></term>
160 <listitem>
161 <para>Tells configure to disable IEEE 754-2008 decimal floating
162 point support. Decimal floating point support isn't needed yet.</para>
163 </listitem>
164 </varlistentry>
165
166 <varlistentry os="af14">
167 <term><parameter>--disable-libgomp</parameter></term>
168 <listitem>
169 <para>Tells configure to not build the GOMP run-time libraries.
170 GOMP is the GNU implementation of OpenMP, a API for shared-memory
171 parallel programming.</para>
172 </listitem>
173 </varlistentry>
174
175 <varlistentry os="af15">
176 <term><parameter>--disable-libmudflap</parameter></term>
177 <listitem>
178 <para>Tells configure to not build libmudflap. Mudflap is a
179 library that can be used to help check for proper pointer usage.</para>
180 </listitem>
181 </varlistentry>
182
183 <varlistentry os="af16">
184 <term><parameter>--disable-libssp</parameter></term>
185 <listitem>
186 <para>Tells configure not to build run-time libraries for stack
187 smashing detection.</para>
188 </listitem>
189 </varlistentry>
190
191 <varlistentry os="af17">
192 <term><parameter>--disable-libatomic</parameter></term>
193 <listitem>
194 <para>Tells configure not to build atomic operations.</para>
195 </listitem>
196 </varlistentry>
197
198 <varlistentry os="af18">
199 <term><parameter>--disable-libquadmath</parameter></term>
200 <listitem>
201 <para>Tells configure not to build quad math operations.</para>
202 </listitem>
203 </varlistentry>
204
205 <varlistentry os="af19">
206 <term><parameter>--disable-threads</parameter></term>
207 <listitem>
208 <para>This will prevent GCC from looking for the multi-thread
209 include files, since they haven't been created for this architecture
210 yet. GCC will be able to find the multi-thread information after
211 the glib headers are created.</para>
212 </listitem>
213 </varlistentry>
214
215 <varlistentry os="af20">
216 <term><parameter>--enable-languages=c</parameter></term>
217 <listitem>
218 <para>This option ensures that only the C compiler is built.</para>
219 </listitem>
220 </varlistentry>
221
222 <varlistentry os="af21">
223 <term><parameter>--disable-multilib</parameter></term>
224 <listitem>
225 <para>This option specifies that multiple target libraries should
226 not be built.</para>
227 </listitem>
228 </varlistentry>
229
230 </variablelist>
231
232 <para os="ah">Continue with compiling the package:</para>
233
234<screen os="ai"><userinput>make all-gcc all-target-libgcc</userinput></screen>
235
236 <para os="aj">Install the package:</para>
237
238<screen os="ak"><userinput>make install-gcc install-target-libgcc</userinput></screen>
239
240 </sect2>
241
242 <sect2 role="content">
243 <title/>
244
245 <para>Details on this package are located in <xref
246 linkend="contents-gcc" role="."/></para>
247
248 </sect2>
249
250</sect1>
Note: See TracBrowser for help on using the repository browser.