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