source: BOOK/cross-tools/common/gcc-static.xml@ f9e40f7

sysvinit
Last change on this file since f9e40f7 was b27081c4, checked in by Chris Staub <chris@…>, 9 years ago

Put one configure option per line

  • 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 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
19 href="../../final-system/common/gcc.xml"
20 xpointer="xpointer(//*[@role='package'])"/>
21
22 <sect2 role="installation">
23 <title>Installation of Cross GCC Compiler with Static libgcc
24 and no Threads</title>
25
26 <para os="e">Here we will compile GCC, as a cross-compiler that will create
27 executables for our target architecture, statically so that it will not
28 need to look for Glibc's startfiles, which do not yet exist in
29 <filename class="directory">/tools</filename>. We will use this
30 cross-compiler, plus the cross-linker we have just installed with Binutils,
31 to compile Glibc. After Glibc is installed into
32 <filename class="directory">/tools</filename>, we can rebuild GCC
33 so that it will then be able to build executables that link against the
34 libraries in <filename class="directory">/tools</filename>.</para>
35
36 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
37 href="../../final-system/common/gcc.xml"
38 xpointer="xpointer(//*[@os='p1'])"/>
39
40 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
41 href="../../final-system/common/gcc.xml"
42 xpointer="xpointer(//*[@os='p2'])"/>
43
44 <para os="aa">Make a couple of essential adjustments to GCC's specs
45 to ensure GCC uses our build environment:</para>
46
47<screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
48
49 <para os="ag">Change the StartFile Spec so that GCC looks in
50<filename class="directory">/tools</filename>:</para>
51
52<screen os="ah"><userinput>echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' &gt;&gt; gcc/config/linux.h
53echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' &gt;&gt; gcc/config/linux.h</userinput></screen>
54
55 <para os="t1">We will create a dummy <filename>limits.h</filename> so
56 the build will not use the one provided by the host distro:</para>
57
58<screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
59
60 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
61 href="../../final-system/common/gcc.xml"
62 xpointer="xpointer(//*[@os='f'])"/>
63
64 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
65 href="../../final-system/common/gcc.xml"
66 xpointer="xpointer(//*[@os='g'])"/>
67
68 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
69 href="../../final-system/common/gcc.xml"
70 xpointer="xpointer(//*[@os='h'])"/>
71
72<screen os="al"><userinput>AR=ar \
73LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
74../gcc-&gcc-version;/configure \
75 --prefix=/cross-tools \
76 --build=${CLFS_HOST} \
77 --host=${CLFS_HOST} \
78 --target=${CLFS_TARGET} \
79 --with-sysroot=${CLFS} \
80 --with-local-prefix=/tools \
81 --with-native-system-header-dir=/tools/include \
82 --disable-shared \
83 --with-mpfr=/cross-tools \
84 --with-gmp=/cross-tools \
85 --with-isl=/cross-tools \
86 --with-mpc=/cross-tools \
87 --without-headers \
88 --with-newlib \
89 --disable-decimal-float \
90 --disable-libgomp \
91 --disable-libssp \
92 --disable-libatomic \
93 --disable-libitm \
94 --disable-libsanitizer \
95 --disable-libquadmath \
96 --disable-libvtv \
97 --disable-libcilkrts \
98 --disable-libstdc++-v3 \
99 --disable-threads \
100 --disable-multilib \
101 --with-system-zlib \
102 --enable-languages=c \
103 --with-glibc-version=&glibc-version;</userinput></screen>
104
105 <variablelist os="am">
106 <title>The meaning of the new configure options:</title>
107
108 <varlistentry>
109 <term><parameter>--build=${CLFS_HOST}</parameter></term>
110 <listitem>
111 <para>This specifies the system on which the cross-compiler is being
112 built.</para>
113 </listitem>
114 </varlistentry>
115
116 <varlistentry>
117 <term><parameter>--with-local-prefix=/tools</parameter></term>
118 <listitem>
119 <para>The purpose of this switch is to remove <filename
120 class="directory">/usr/local/include</filename> from
121 <command>gcc</command>'s include search path. This is not
122 absolutely essential, however, it helps to minimize the
123 influence of the host system.</para>
124 </listitem>
125 </varlistentry>
126
127 <varlistentry>
128 <term><parameter>--with-native-system-headers-dir=/tools/include</parameter></term>
129 <listitem>
130 <para>This switch ensures that GCC will search for the system headers
131 in <filename class="directory">/tools/include</filename> and that
132 host system headers will not be searched.</para>
133 </listitem>
134 </varlistentry>
135
136 <varlistentry>
137 <term><parameter>--disable-shared</parameter></term>
138 <listitem>
139 <para>This tells GCC not to create a shared library.</para>
140 </listitem>
141 </varlistentry>
142
143 <varlistentry>
144 <term><parameter>--without-headers</parameter></term>
145 <listitem>
146 <para>Disables GCC from using the target's Libc when cross compiling.</para>
147 </listitem>
148 </varlistentry>
149
150 <varlistentry>
151 <term><parameter>--with-newlib</parameter></term>
152 <listitem>
153 <para>This causes GCC to enable the <envar>inhibit_libc</envar> flag,
154 which prevents <filename class="libraryfile">libgcc</filename>
155 from building code that uses libc support.</para>
156 </listitem>
157 </varlistentry>
158
159 <varlistentry>
160 <term><parameter>--disable-decimal-float</parameter></term>
161 <listitem>
162 <para>Disables support for the C decimal floating point extension.</para>
163 </listitem>
164 </varlistentry>
165
166 <varlistentry>
167 <term><parameter>--disable-lib*</parameter></term>
168 <listitem>
169 <para>These options prevent GCC from building a number of libraries
170 that are not needed at this time.</para>
171 </listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><parameter>--disable-threads</parameter></term>
176 <listitem>
177 <para>This will prevent GCC from looking for the multi-thread
178 include files, since they haven't been created for this architecture
179 yet. GCC will be able to find the multi-thread information after
180 the Glibc headers are created.</para>
181 </listitem>
182 </varlistentry>
183
184 <varlistentry>
185 <term><parameter>--with-system-zlib</parameter></term>
186 <listitem>
187 <para>This tells GCC to link to the system-installed zlib instead
188 of the one in its source tree.</para>
189 </listitem>
190 </varlistentry>
191
192 <varlistentry>
193 <term><parameter>--enable-languages=c</parameter></term>
194 <listitem>
195 <para>This option ensures that only the C compiler is built.</para>
196 </listitem>
197 </varlistentry>
198
199 <varlistentry>
200 <term><parameter>--with-glibc-version=&glibc-version;</parameter></term>
201 <listitem>
202 <para>Needed when bootstrapping a cross toolchain without the header
203 files avilable for building the initial bootstrap compiler.</para>
204 </listitem>
205 </varlistentry>
206
207 </variablelist>
208
209 <para os="an">Continue with compiling the package:</para>
210
211<screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
212
213 <variablelist os="ap">
214 <title>The meaning of the new make options:</title>
215
216 <varlistentry>
217 <term><parameter>all-gcc all-target-libgcc</parameter></term>
218 <listitem>
219 <para>Compiles only the parts of GCC that are needed at this time,
220 rather than the full package.</para>
221 </listitem>
222 </varlistentry>
223
224 </variablelist>
225
226 <para os="aq">Install the package:</para>
227
228<screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
229
230 </sect2>
231
232 <sect2 role="content">
233 <title/>
234
235 <para>Details on this package are located in <xref
236 linkend="contents-gcc" role="."/></para>
237
238 </sect2>
239
240</sect1>
Note: See TracBrowser for help on using the repository browser.