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

clfs-3.0.0-systemd systemd
Last change on this file since 7ac303bc was 87d6725, checked in by Chris Staub <chris@…>, 10 years ago

Text updates in cross-tools

  • 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
[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
[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
[3cf4292]44 <para os="aa">Make a couple of essential adjustments to the
45 <filename>specs</filename> file to ensure GCC uses our build
46 environment:</para>
[3f8be484]47
48<screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
49
[24b004c]50 <para os="ag">Change the StartFile Spec so that GCC looks in
[4dbd276]51<filename class="directory">/tools</filename>:</para>
[d04ed61]52
[4dbd276]53<screen os="ah"><userinput>echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h
[c1832da]54echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h</userinput></screen>
[d04ed61]55
[3cf4292]56 <para os="t1">We will create a dummy <filename>limits.h</filename> so
57 the build will not use the one provided by the host distro:</para>
[562a0ae]58
[3309623]59<screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
[562a0ae]60
[dabbced]61 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]62 href="../../final-system/common/gcc.xml"
63 xpointer="xpointer(//*[@os='f'])"/>
64
[dabbced]65 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]66 href="../../final-system/common/gcc.xml"
67 xpointer="xpointer(//*[@os='g'])"/>
68
[dabbced]69 <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
[3f8be484]70 href="../../final-system/common/gcc.xml"
71 xpointer="xpointer(//*[@os='h'])"/>
72
[88958a8]73<screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
[04c3a53]74 ../gcc-&gcc-version;/configure --prefix=/cross-tools \
75 --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
76 --with-sysroot=${CLFS} --with-local-prefix=/tools \
77 --with-native-system-header-dir=/tools/include --disable-nls \
78 --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \
79 --with-isl=/cross-tools --with-cloog=/cross-tools --with-mpc=/cross-tools \
80 --without-headers --with-newlib --disable-decimal-float --disable-libgomp \
81 --disable-libmudflap --disable-libssp --disable-libatomic --disable-libitm \
82 --disable-libsanitizer --disable-libquadmath --disable-threads \
83 --disable-multilib --disable-target-zlib --with-system-zlib \
84 --enable-languages=c --enable-checking=release</userinput></screen>
[3f8be484]85
[d55f00bc]86 <variablelist os="am">
[d755bc7]87 <title>The meaning of the new configure options:</title>
[26b5617]88
[3f8be484]89 <varlistentry>
90 <term><parameter>--with-local-prefix=/tools</parameter></term>
91 <listitem>
92 <para>The purpose of this switch is to remove <filename
93 class="directory">/usr/local/include</filename> from
94 <command>gcc</command>'s include search path. This is not
95 absolutely essential, however, it helps to minimize the
96 influence of the host system.</para>
97 </listitem>
98 </varlistentry>
99
[4dbd276]100 <varlistentry>
101 <term><parameter>--with-native-system-headers-dir=/tools/include</parameter></term>
102 <listitem>
103 <para>This switch ensures that GCC will search for the system headers
104 in <filename class="directory">/tools/include</filename> and that
105 host system headers will not be searched.</para>
106 </listitem>
107 </varlistentry>
108
[852824db]109 <varlistentry>
110 <term><parameter>--disable-shared</parameter></term>
111 <listitem>
112 <para>This tells GCC not to create a shared library.</para>
113 </listitem>
114 </varlistentry>
115
[26b5617]116 <varlistentry>
117 <term><parameter>--without-headers</parameter></term>
118 <listitem>
119 <para>Disables GCC from using the target's Libc when cross compiling.</para>
120 </listitem>
121 </varlistentry>
122
123 <varlistentry>
124 <term><parameter>--with-newlib</parameter></term>
125 <listitem>
126 <para>Tells GCC that the target libc will use 'newlib'.</para>
127 </listitem>
128 </varlistentry>
129
130 <varlistentry>
131 <term><parameter>--disable-decimal-float</parameter></term>
132 <listitem>
133 <para>Disables support for the C decimal floating point extension.</para>
134 </listitem>
135 </varlistentry>
136
137 <varlistentry>
[a43ce31]138 <term><parameter>--disable-lib*</parameter></term>
[26b5617]139 <listitem>
[a43ce31]140 <para>These options prevent GCC from building a number of libraries
141 that are not needed at this time.</para>
[26b5617]142 </listitem>
143 </varlistentry>
144
[3f8be484]145 <varlistentry>
146 <term><parameter>--disable-threads</parameter></term>
147 <listitem>
[193315c]148 <para>This will prevent GCC from looking for the multi-thread
[6d4c909]149 include files, since they haven't been created for this architecture
150 yet. GCC will be able to find the multi-thread information after
151 the Glibc headers are created.</para>
[3f8be484]152 </listitem>
153 </varlistentry>
154
[4dbd276]155 <varlistentry>
[a43ce31]156 <term><parameter>--disable-target-zlib</parameter></term>
[4dbd276]157 <listitem>
[a43ce31]158 <para>This tells GCC stuff.</para>
[4dbd276]159 </listitem>
160 </varlistentry>
161
162 <varlistentry>
[a43ce31]163 <term><parameter>--with-system-zlib</parameter></term>
[4dbd276]164 <listitem>
[a43ce31]165 <para>This tells GCC to link to the system-installed zlib instead
166 of the one in its source tree.</para>
[4dbd276]167 </listitem>
168 </varlistentry>
169
[3f8be484]170 <varlistentry>
171 <term><parameter>--enable-languages=c</parameter></term>
172 <listitem>
173 <para>This option ensures that only the C compiler is built.</para>
174 </listitem>
175 </varlistentry>
176
[4dbd276]177 <varlistentry>
178 <term><parameter>--enable-checking=release</parameter></term>
179 <listitem>
180 <para>This option selects the complexity of the internal consistency checks and adds error checking within the compiler.</para>
181 </listitem>
182 </varlistentry>
183
[3f8be484]184 </variablelist>
185
[d55f00bc]186 <para os="an">Continue with compiling the package:</para>
[3f8be484]187
[4651341]188<screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
[3f8be484]189
[d755bc7]190 <variablelist os="ap">
191 <title>The meaning of the new make options:</title>
192
193 <varlistentry>
194 <term><parameter>all-gcc all-target-libgcc</parameter></term>
195 <listitem>
196 <para>Compiles only the parts of GCC that are needed at this time,
197 rather than the full package.</para>
198 </listitem>
199 </varlistentry>
200
201 </variablelist>
202
203 <para os="aq">Install the package:</para>
[3f8be484]204
[d755bc7]205<screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
[3f8be484]206
[3d66e17]207 <para os="as">Copy <filename class="headerfile">libiberty.h</filename> to
208 <filename class="directory">/tools/include</filename> directory:</para>
209
210<screen os="at"><userinput>cp -v ../gcc-&gcc-version;/include/libiberty.h /tools/include</userinput></screen>
211
[3f8be484]212 </sect2>
213
214 <sect2 role="content">
215 <title/>
216
217 <para>Details on this package are located in <xref
218 linkend="contents-gcc" role="."/></para>
219
220 </sect2>
221
222</sect1>
Note: See TracBrowser for help on using the repository browser.