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

sysvinit
Last change on this file since 3a08b23 was cc49a21, checked in by William Harrington <kb0iic@…>, 9 years ago

Update GCC 5.2.0 from GCC 4.8.0.

  • Property mode set to 100644
File size: 8.3 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
[2d1be42]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
[cc858ed]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
[3d00fcbe]44 <para os="aa">Make a couple of essential adjustments to GCC's specs
45 to ensure GCC uses our build environment:</para>
[3f8be484]46
47<screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
48
[24b004c]49 <para os="ag">Change the StartFile Spec so that GCC looks in
[4dbd276]50<filename class="directory">/tools</filename>:</para>
[d04ed61]51
[d3a81ee]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>
[d04ed61]54
[3cf4292]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>
[562a0ae]57
[3309623]58<screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
[562a0ae]59
[dabbced]60 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]61 href="../../final-system/common/gcc.xml"
62 xpointer="xpointer(//*[@os='f'])"/>
63
[dabbced]64 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]65 href="../../final-system/common/gcc.xml"
66 xpointer="xpointer(//*[@os='g'])"/>
67
[dabbced]68 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]69 href="../../final-system/common/gcc.xml"
70 xpointer="xpointer(//*[@os='h'])"/>
71
[88958a8]72<screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
[04c3a53]73 ../gcc-&gcc-version;/configure --prefix=/cross-tools \
74 --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
75 --with-sysroot=${CLFS} --with-local-prefix=/tools \
[cc49a21]76 --with-native-system-header-dir=/tools/include \
[04c3a53]77 --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \
[cc49a21]78 --with-isl=/cross-tools --with-mpc=/cross-tools --without-headers \
79 --with-newlib --disable-decimal-float --disable-libgomp --disable-libssp \
80 --disable-libatomic --disable-libitm --disable-libsanitizer \
81 --disable-libquadmath --disable-libvtv --disable-libcilkrts \
82 --disable-libstdc++-v3 --disable-threads --disable-multilib \
83 --with-system-zlib --enable-languages=c --disable-boostrap \
84 --with-glibc-version=&glibc-version;</userinput></screen>
[3f8be484]85
[d55f00bc]86 <variablelist os="am">
[d755bc7]87 <title>The meaning of the new configure options:</title>
[26b5617]88
[22cf824]89 <varlistentry>
[c22300aa]90 <term><parameter>--build=${CLFS_HOST}</parameter></term>
[22cf824]91 <listitem>
92 <para>This specifies the system on which the cross-compiler is being
93 built.</para>
94 </listitem>
95 </varlistentry>
96
97 <varlistentry>
[3f8be484]98 <term><parameter>--with-local-prefix=/tools</parameter></term>
99 <listitem>
100 <para>The purpose of this switch is to remove <filename
101 class="directory">/usr/local/include</filename> from
102 <command>gcc</command>'s include search path. This is not
103 absolutely essential, however, it helps to minimize the
104 influence of the host system.</para>
105 </listitem>
106 </varlistentry>
107
[4dbd276]108 <varlistentry>
109 <term><parameter>--with-native-system-headers-dir=/tools/include</parameter></term>
110 <listitem>
111 <para>This switch ensures that GCC will search for the system headers
112 in <filename class="directory">/tools/include</filename> and that
113 host system headers will not be searched.</para>
114 </listitem>
115 </varlistentry>
116
[852824db]117 <varlistentry>
118 <term><parameter>--disable-shared</parameter></term>
119 <listitem>
120 <para>This tells GCC not to create a shared library.</para>
121 </listitem>
122 </varlistentry>
123
[26b5617]124 <varlistentry>
125 <term><parameter>--without-headers</parameter></term>
126 <listitem>
127 <para>Disables GCC from using the target's Libc when cross compiling.</para>
128 </listitem>
129 </varlistentry>
130
131 <varlistentry>
132 <term><parameter>--with-newlib</parameter></term>
133 <listitem>
[a882002]134 <para>This causes GCC to enable the <envar>inhibit_libc</envar> flag,
135 which prevents <filename class="libraryfile">libgcc</filename>
136 from building code that uses libc support.</para>
[26b5617]137 </listitem>
138 </varlistentry>
139
140 <varlistentry>
141 <term><parameter>--disable-decimal-float</parameter></term>
142 <listitem>
143 <para>Disables support for the C decimal floating point extension.</para>
144 </listitem>
145 </varlistentry>
146
147 <varlistentry>
[a43ce31]148 <term><parameter>--disable-lib*</parameter></term>
[26b5617]149 <listitem>
[a43ce31]150 <para>These options prevent GCC from building a number of libraries
151 that are not needed at this time.</para>
[26b5617]152 </listitem>
153 </varlistentry>
154
[3f8be484]155 <varlistentry>
156 <term><parameter>--disable-threads</parameter></term>
157 <listitem>
[193315c]158 <para>This will prevent GCC from looking for the multi-thread
[6d4c909]159 include files, since they haven't been created for this architecture
160 yet. GCC will be able to find the multi-thread information after
161 the Glibc headers are created.</para>
[3f8be484]162 </listitem>
163 </varlistentry>
164
[4dbd276]165 <varlistentry>
[a43ce31]166 <term><parameter>--with-system-zlib</parameter></term>
[4dbd276]167 <listitem>
[a43ce31]168 <para>This tells GCC to link to the system-installed zlib instead
169 of the one in its source tree.</para>
[4dbd276]170 </listitem>
171 </varlistentry>
172
[3f8be484]173 <varlistentry>
174 <term><parameter>--enable-languages=c</parameter></term>
175 <listitem>
176 <para>This option ensures that only the C compiler is built.</para>
177 </listitem>
178 </varlistentry>
179
[4dbd276]180 <varlistentry>
[cc49a21]181 <term><parameter>--with-glibc-version=&glibc-version;</parameter></term>
[4dbd276]182 <listitem>
[cc49a21]183 <para>Needed when bootstrapping a cross toolchain without the header
184 files avilable for building the initial bootstrap compiler.</para>
[4dbd276]185 </listitem>
186 </varlistentry>
187
[3f8be484]188 </variablelist>
189
[d55f00bc]190 <para os="an">Continue with compiling the package:</para>
[3f8be484]191
[4651341]192<screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
[3f8be484]193
[d755bc7]194 <variablelist os="ap">
195 <title>The meaning of the new make options:</title>
196
197 <varlistentry>
198 <term><parameter>all-gcc all-target-libgcc</parameter></term>
199 <listitem>
200 <para>Compiles only the parts of GCC that are needed at this time,
201 rather than the full package.</para>
202 </listitem>
203 </varlistentry>
204
205 </variablelist>
206
207 <para os="aq">Install the package:</para>
[3f8be484]208
[d755bc7]209<screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
[3f8be484]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.