| 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="aa">Make a couple of essential adjustments to the
 | 
|---|
| 27 |     <filename>specs</filename> file to ensure GCC uses our build
 | 
|---|
| 28 |     environment:</para>
 | 
|---|
| 29 | 
 | 
|---|
| 30 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen>
 | 
|---|
| 31 | 
 | 
|---|
| 32 |     <para os="ag">Change the StartFile Spec so that GCC looks in 
 | 
|---|
| 33 | <filename class="directory">/tools</filename>:</para>
 | 
|---|
| 34 | 
 | 
|---|
| 35 | <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
 | 
|---|
| 36 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h</userinput></screen>
 | 
|---|
| 37 | 
 | 
|---|
| 38 |     <para os="t1">We will create a dummy <filename>limits.h</filename> so
 | 
|---|
| 39 |     the build will not use the one provided by the host distro:</para>
 | 
|---|
| 40 | 
 | 
|---|
| 41 | <screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen>
 | 
|---|
| 42 | 
 | 
|---|
| 43 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 44 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 45 |     xpointer="xpointer(//*[@os='f'])"/>
 | 
|---|
| 46 | 
 | 
|---|
| 47 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 48 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 49 |     xpointer="xpointer(//*[@os='g'])"/>
 | 
|---|
| 50 | 
 | 
|---|
| 51 |     <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
 | 
|---|
| 52 |     href="../../final-system/common/gcc.xml"
 | 
|---|
| 53 |     xpointer="xpointer(//*[@os='h'])"/>
 | 
|---|
| 54 | 
 | 
|---|
| 55 | <screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \
 | 
|---|
| 56 |   ../gcc-&gcc-version;/configure --prefix=/cross-tools \
 | 
|---|
| 57 |   --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \
 | 
|---|
| 58 |   --with-sysroot=${CLFS} --with-local-prefix=/tools \
 | 
|---|
| 59 |   --with-native-system-header-dir=/tools/include --disable-nls \
 | 
|---|
| 60 |   --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \
 | 
|---|
| 61 |   --with-cloog=/cross-tools --with-mpc=/cross-tools --without-headers \
 | 
|---|
| 62 |   --with-newlib --disable-decimal-float --disable-libgomp --disable-libmudflap \
 | 
|---|
| 63 |   --disable-libssp --disable-threads --disable-multilib --disable-libatomic \
 | 
|---|
| 64 |   --disable-libitm --disable-libsanitizer --disable-libquadmath \
 | 
|---|
| 65 |   --disable-target-libiberty --disable-target-zlib --with-system-zlib \
 | 
|---|
| 66 |   --enable-cloog-backend=isl --disable-cloog-version-check \
 | 
|---|
| 67 |   --enable-languages=c --enable-checking=release</userinput></screen>
 | 
|---|
| 68 | 
 | 
|---|
| 69 |     <variablelist os="am">
 | 
|---|
| 70 |       <title>The meaning of the new configure options:</title>
 | 
|---|
| 71 | 
 | 
|---|
| 72 |       <varlistentry>
 | 
|---|
| 73 |         <term><parameter>--with-sysroot=${CLFS}</parameter></term>
 | 
|---|
| 74 |         <listitem>
 | 
|---|
| 75 |           <para>Tells GCC to consider ${CLFS} as the root file system.</para>
 | 
|---|
| 76 |         </listitem>
 | 
|---|
| 77 |       </varlistentry>
 | 
|---|
| 78 | 
 | 
|---|
| 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 | 
 | 
|---|
| 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 | 
 | 
|---|
| 100 |       <varlistentry>
 | 
|---|
| 101 |         <term><parameter>--disable-nls</parameter></term>
 | 
|---|
| 102 |         <listitem>
 | 
|---|
| 103 |           <para>This disables internationalization as i18n is not needed for the
 | 
|---|
| 104 |           cross-compile tools.</para>
 | 
|---|
| 105 |         </listitem>
 | 
|---|
| 106 |       </varlistentry>
 | 
|---|
| 107 | 
 | 
|---|
| 108 |       <varlistentry>
 | 
|---|
| 109 |         <term><parameter>--without-headers</parameter></term>
 | 
|---|
| 110 |         <listitem>
 | 
|---|
| 111 |           <para>Disables GCC from using the target's Libc when cross compiling.</para>
 | 
|---|
| 112 |         </listitem>
 | 
|---|
| 113 |       </varlistentry>
 | 
|---|
| 114 | 
 | 
|---|
| 115 |       <varlistentry>
 | 
|---|
| 116 |         <term><parameter>--with-newlib</parameter></term>
 | 
|---|
| 117 |         <listitem>
 | 
|---|
| 118 |           <para>Tells GCC that the target libc will use 'newlib'.</para>
 | 
|---|
| 119 |         </listitem>
 | 
|---|
| 120 |       </varlistentry>
 | 
|---|
| 121 | 
 | 
|---|
| 122 |       <varlistentry>
 | 
|---|
| 123 |         <term><parameter>--disable-decimal-float</parameter></term>
 | 
|---|
| 124 |         <listitem>
 | 
|---|
| 125 |           <para>Disables support for the C decimal floating point extension.</para>
 | 
|---|
| 126 |         </listitem>
 | 
|---|
| 127 |       </varlistentry>
 | 
|---|
| 128 | 
 | 
|---|
| 129 |       <varlistentry>
 | 
|---|
| 130 |         <term><parameter>--disable-libgomp</parameter></term>
 | 
|---|
| 131 |         <listitem>
 | 
|---|
| 132 |           <para>Disables the creation of runtime libraries used by GOMP.</para>
 | 
|---|
| 133 |         </listitem>
 | 
|---|
| 134 |       </varlistentry>
 | 
|---|
| 135 | 
 | 
|---|
| 136 |       <varlistentry>
 | 
|---|
| 137 |         <term><parameter>--disable-libmudflap</parameter></term>
 | 
|---|
| 138 |         <listitem>
 | 
|---|
| 139 |           <para>Disables the creation of runtime libaries used by libmudflap.</para>
 | 
|---|
| 140 |         </listitem>
 | 
|---|
| 141 |       </varlistentry>
 | 
|---|
| 142 | 
 | 
|---|
| 143 |       <varlistentry>
 | 
|---|
| 144 |         <term><parameter>--disable-libssp</parameter></term>
 | 
|---|
| 145 |         <listitem>
 | 
|---|
| 146 |           <para>Disables the use of Stack Smashing Protection for runtime libraries.</para>
 | 
|---|
| 147 |         </listitem>
 | 
|---|
| 148 |       </varlistentry>
 | 
|---|
| 149 | 
 | 
|---|
| 150 |       <varlistentry>
 | 
|---|
| 151 |         <term><parameter>--disable-threads</parameter></term>
 | 
|---|
| 152 |         <listitem>
 | 
|---|
| 153 |           <para>This will prevent GCC from looking for the multi-thread
 | 
|---|
| 154 |           include files, since they haven't been created for this architecture
 | 
|---|
| 155 |           yet. GCC will be able to find the multi-thread information after
 | 
|---|
| 156 |           the Glibc headers are created.</para>
 | 
|---|
| 157 |         </listitem>
 | 
|---|
| 158 |       </varlistentry>
 | 
|---|
| 159 | 
 | 
|---|
| 160 |       <varlistentry>
 | 
|---|
| 161 |         <term><parameter>--disable-libatomic</parameter></term>
 | 
|---|
| 162 |         <listitem>
 | 
|---|
| 163 |           <para>The atomic library isn't needed at this time.</para>
 | 
|---|
| 164 |         </listitem>
 | 
|---|
| 165 |       </varlistentry>
 | 
|---|
| 166 | 
 | 
|---|
| 167 |       <varlistentry>
 | 
|---|
| 168 |         <term><parameter>--disable-libitm</parameter></term>
 | 
|---|
| 169 |         <listitem>
 | 
|---|
| 170 |           <para>The itm library isn't neeeded at this tiem.</para>
 | 
|---|
| 171 |         </listitem>
 | 
|---|
| 172 |       </varlistentry>
 | 
|---|
| 173 | 
 | 
|---|
| 174 |       <varlistentry>
 | 
|---|
| 175 |         <term><parameter>--disable-libsanitizer</parameter></term>
 | 
|---|
| 176 |         <listitem>
 | 
|---|
| 177 |           <para>The sanitizer library isn't needed at this time.</para>
 | 
|---|
| 178 |         </listitem>
 | 
|---|
| 179 |       </varlistentry>
 | 
|---|
| 180 | 
 | 
|---|
| 181 |       <varlistentry>
 | 
|---|
| 182 |         <term><parameter>--disable-libquadmath</parameter></term>
 | 
|---|
| 183 |         <listitem>
 | 
|---|
| 184 |           <para>The quadmath library isn't needed at this time.</para>
 | 
|---|
| 185 |         </listitem>
 | 
|---|
| 186 |       </varlistentry>
 | 
|---|
| 187 | 
 | 
|---|
| 188 |       <varlistentry>
 | 
|---|
| 189 |         <term><parameter>--enable-languages=c</parameter></term>
 | 
|---|
| 190 |         <listitem>
 | 
|---|
| 191 |           <para>This option ensures that only the C compiler is built.</para>
 | 
|---|
| 192 |         </listitem>
 | 
|---|
| 193 |       </varlistentry>
 | 
|---|
| 194 | 
 | 
|---|
| 195 |       <varlistentry>
 | 
|---|
| 196 |         <term><parameter>--enable-checking=release</parameter></term>
 | 
|---|
| 197 |         <listitem>
 | 
|---|
| 198 |           <para>This option selects the complexity of the internal consistency checks and adds error checking within the compiler.</para>
 | 
|---|
| 199 |         </listitem>
 | 
|---|
| 200 |       </varlistentry>
 | 
|---|
| 201 | 
 | 
|---|
| 202 |     </variablelist>
 | 
|---|
| 203 | 
 | 
|---|
| 204 |     <para os="an">Continue with compiling the package:</para>
 | 
|---|
| 205 | 
 | 
|---|
| 206 | <screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen>
 | 
|---|
| 207 | 
 | 
|---|
| 208 |     <variablelist os="ap">
 | 
|---|
| 209 |       <title>The meaning of the new make options:</title>
 | 
|---|
| 210 | 
 | 
|---|
| 211 |       <varlistentry>
 | 
|---|
| 212 |         <term><parameter>all-gcc all-target-libgcc</parameter></term>
 | 
|---|
| 213 |         <listitem>
 | 
|---|
| 214 |           <para>Compiles only the parts of GCC that are needed at this time,
 | 
|---|
| 215 |           rather than the full package.</para>
 | 
|---|
| 216 |         </listitem>
 | 
|---|
| 217 |       </varlistentry>
 | 
|---|
| 218 | 
 | 
|---|
| 219 |     </variablelist>
 | 
|---|
| 220 | 
 | 
|---|
| 221 |     <para os="aq">Install the package:</para>
 | 
|---|
| 222 | 
 | 
|---|
| 223 | <screen os="ar"><userinput>make install-gcc install-target-libgcc</userinput></screen>
 | 
|---|
| 224 | 
 | 
|---|
| 225 |   </sect2>
 | 
|---|
| 226 | 
 | 
|---|
| 227 |   <sect2 role="content">
 | 
|---|
| 228 |     <title/>
 | 
|---|
| 229 | 
 | 
|---|
| 230 |     <para>Details on this package are located in <xref
 | 
|---|
| 231 |     linkend="contents-gcc" role="."/></para>
 | 
|---|
| 232 | 
 | 
|---|
| 233 |   </sect2>
 | 
|---|
| 234 | 
 | 
|---|
| 235 | </sect1>
 | 
|---|