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

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

gcc-static: Do mpfr, gmp, and mpc, too

Remove MPFR, GMP, and MPC steps. Place each into GCC static build
directory as that's an alternate method and reduces the number of steps.

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