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

sysvinit
Last change on this file since 76d02d9 was a55f9e7, checked in by William Harrington <kb0iic@…>, 9 years ago

Upgrade GCC from 5.2.0 to 5.3.0.

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