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

Last change on this file since d05636e was d05636e, checked in by Andrew Bradford <bradfa@…>, 13 years ago

Set ABI when compiling GCC

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