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

systemd
Last change on this file since 24c892d was fcb8b8e3, checked in by Chris Staub <chris@…>, 7 years ago

Spelling fix

  • Property mode set to 100644
File size: 8.4 KB
RevLine 
[3f8be484]1<?xml version="1.0" encoding="ISO-8859-1"?>
[aa18ac0]2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
[3f8be484]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
[dabbced]18 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[cf66ceae]19 href="../../final-system/common/gcc.xml"
20 xpointer="xpointer(//*[@role='package'])"/>
[3f8be484]21
22 <sect2 role="installation">
23 <title>Installation of Cross GCC Compiler with Static libgcc
24 and no Threads</title>
25
[9e0069f]26 <para os="e">Here we will compile GCC, as a cross-compiler that will create
[87d6725]27 executables for our target architecture, statically so that it will not
[9e0069f]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
[c4ebdab]36<!--GCC Branch Update Area
[cc858ed]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'])"/>
[c4ebdab]44-->
[cc858ed]45
[78baed3]46 <para os="aa">Make a couple of essential adjustments to GCC's specs
47 to ensure GCC uses our build environment:</para>
[3f8be484]48
49<screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
50
[24b004c]51 <para os="ag">Change the StartFile Spec so that GCC looks in
[4dbd276]52<filename class="directory">/tools</filename>:</para>
[d04ed61]53
[fcc84cc]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>
[d04ed61]56
[3cf4292]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>
[562a0ae]59
[3309623]60<screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
[562a0ae]61
[dabbced]62 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]63 href="../../final-system/common/gcc.xml"
64 xpointer="xpointer(//*[@os='f'])"/>
65
[dabbced]66 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]67 href="../../final-system/common/gcc.xml"
68 xpointer="xpointer(//*[@os='g'])"/>
69
[dabbced]70 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]71 href="../../final-system/common/gcc.xml"
72 xpointer="xpointer(//*[@os='h'])"/>
73
[7cd7f99]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 \
[f6853e3]83 --with-native-system-header-dir=/tools/include \
[7cd7f99]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 --enable-languages=c \
[f6853e3]104 --with-glibc-version=&glibc-version;</userinput></screen>
[3f8be484]105
[d55f00bc]106 <variablelist os="am">
[d755bc7]107 <title>The meaning of the new configure options:</title>
[26b5617]108
[8f9c1a8]109 <varlistentry>
[81e2591]110 <term><parameter>--build=${CLFS_HOST}</parameter></term>
[8f9c1a8]111 <listitem>
112 <para>This specifies the system on which the cross-compiler is being
113 built.</para>
114 </listitem>
115 </varlistentry>
116
117 <varlistentry>
[3f8be484]118 <term><parameter>--with-local-prefix=/tools</parameter></term>
119 <listitem>
120 <para>The purpose of this switch is to remove <filename
121 class="directory">/usr/local/include</filename> from
122 <command>gcc</command>'s include search path. This is not
123 absolutely essential, however, it helps to minimize the
124 influence of the host system.</para>
125 </listitem>
126 </varlistentry>
127
[4dbd276]128 <varlistentry>
129 <term><parameter>--with-native-system-headers-dir=/tools/include</parameter></term>
130 <listitem>
131 <para>This switch ensures that GCC will search for the system headers
132 in <filename class="directory">/tools/include</filename> and that
133 host system headers will not be searched.</para>
134 </listitem>
135 </varlistentry>
136
[852824db]137 <varlistentry>
138 <term><parameter>--disable-shared</parameter></term>
139 <listitem>
140 <para>This tells GCC not to create a shared library.</para>
141 </listitem>
142 </varlistentry>
143
[26b5617]144 <varlistentry>
145 <term><parameter>--without-headers</parameter></term>
146 <listitem>
147 <para>Disables GCC from using the target's Libc when cross compiling.</para>
148 </listitem>
149 </varlistentry>
150
151 <varlistentry>
152 <term><parameter>--with-newlib</parameter></term>
153 <listitem>
[389c29d]154 <para>This causes GCC to enable the <envar>inhibit_libc</envar> flag,
155 which prevents <filename class="libraryfile">libgcc</filename>
156 from building code that uses libc support.</para>
[26b5617]157 </listitem>
158 </varlistentry>
159
160 <varlistentry>
161 <term><parameter>--disable-decimal-float</parameter></term>
162 <listitem>
163 <para>Disables support for the C decimal floating point extension.</para>
164 </listitem>
165 </varlistentry>
166
167 <varlistentry>
[a43ce31]168 <term><parameter>--disable-lib*</parameter></term>
[26b5617]169 <listitem>
[a43ce31]170 <para>These options prevent GCC from building a number of libraries
171 that are not needed at this time.</para>
[26b5617]172 </listitem>
173 </varlistentry>
174
[3f8be484]175 <varlistentry>
176 <term><parameter>--disable-threads</parameter></term>
177 <listitem>
[193315c]178 <para>This will prevent GCC from looking for the multi-thread
[6d4c909]179 include files, since they haven't been created for this architecture
180 yet. GCC will be able to find the multi-thread information after
181 the Glibc headers are created.</para>
[3f8be484]182 </listitem>
183 </varlistentry>
184
[4dbd276]185 <varlistentry>
[a43ce31]186 <term><parameter>--with-system-zlib</parameter></term>
[4dbd276]187 <listitem>
[a43ce31]188 <para>This tells GCC to link to the system-installed zlib instead
189 of the one in its source tree.</para>
[4dbd276]190 </listitem>
191 </varlistentry>
192
[3f8be484]193 <varlistentry>
194 <term><parameter>--enable-languages=c</parameter></term>
195 <listitem>
196 <para>This option ensures that only the C compiler is built.</para>
197 </listitem>
198 </varlistentry>
199
[4dbd276]200 <varlistentry>
[f6853e3]201 <term><parameter>--with-glibc-version=&glibc-version;</parameter></term>
[4dbd276]202 <listitem>
[f6853e3]203 <para>Needed when bootstrapping a cross toolchain without the header
[fcb8b8e3]204 files available for building the initial bootstrap compiler.</para>
[4dbd276]205 </listitem>
206 </varlistentry>
207
[3f8be484]208 </variablelist>
209
[d55f00bc]210 <para os="an">Continue with compiling the package:</para>
[3f8be484]211
[4651341]212<screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
[3f8be484]213
[d755bc7]214 <variablelist os="ap">
215 <title>The meaning of the new make options:</title>
216
217 <varlistentry>
218 <term><parameter>all-gcc all-target-libgcc</parameter></term>
219 <listitem>
220 <para>Compiles only the parts of GCC that are needed at this time,
221 rather than the full package.</para>
222 </listitem>
223 </varlistentry>
224
225 </variablelist>
226
227 <para os="aq">Install the package:</para>
[3f8be484]228
[d755bc7]229<screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
[3f8be484]230
231 </sect2>
232
233 <sect2 role="content">
234 <title/>
235
236 <para>Details on this package are located in <xref
237 linkend="contents-gcc" role="."/></para>
238
239 </sect2>
240
241</sect1>
Note: See TracBrowser for help on using the repository browser.