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

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

gcc: Remove AR=ar and LDFLAGS from gcc builds

They aren't needed with gmp, mpfr, and mpc in tree and there are no host
libs built for embedded.

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