| [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 |  | 
|---|
| [cf66ceae] | 18 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 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 |  | 
|---|
| [5ec7db05] | 26 | <!-- | 
|---|
| [4883ef5] | 27 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 28 | href="../../final-system/common/gcc.xml" | 
|---|
|  | 29 | xpointer="xpointer(//*[@os='p1'])"/> | 
|---|
|  | 30 |  | 
|---|
|  | 31 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 32 | href="../../final-system/common/gcc.xml" | 
|---|
|  | 33 | xpointer="xpointer(//*[@os='p2'])"/> | 
|---|
| [5ec7db05] | 34 | --> | 
|---|
| [4883ef5] | 35 |  | 
|---|
| [5d9d2e5] | 36 | <para os="aa">Make a couple of essential adjustments to the specs file | 
|---|
| [fac77fb] | 37 | to ensure GCC uses our build environment:</para> | 
|---|
| [3f8be484] | 38 |  | 
|---|
|  | 39 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> | 
|---|
|  | 40 |  | 
|---|
| [6d4c909] | 41 | <para os="ac">To make sure that a couple of tools use the proper syntax, | 
|---|
|  | 42 | apply the following patch:</para> | 
|---|
| [3f8be484] | 43 |  | 
|---|
|  | 44 | <screen os="ad"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen> | 
|---|
|  | 45 |  | 
|---|
| [e53465ee] | 46 | <para os="ag">Change the StartFile Spec and Standard Include Dir so that | 
|---|
|  | 47 | GCC looks in <filename class="directory">/tools</filename>:</para> | 
|---|
| [d04ed61] | 48 |  | 
|---|
| [1e16d91] | 49 | <screen os="ah"><userinput>echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h | 
|---|
|  | 50 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h | 
|---|
| [c1832da] | 51 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h</userinput></screen> | 
|---|
| [d04ed61] | 52 |  | 
|---|
| [121c48a] | 53 | <para os="ai">Now alter <command>gcc</command>'s c preprocessor's default | 
|---|
| [12d030c] | 54 | include search path to use <filename class="directory">/tools</filename> only:</para> | 
|---|
| [3f8be484] | 55 |  | 
|---|
| [0b637f1] | 56 | <screen os="aj"><userinput>cp -v gcc/Makefile.in{,.orig} | 
|---|
| [bc2e3fa] | 57 | sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ | 
|---|
| [1b274255] | 58 | gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen> | 
|---|
| [3f8be484] | 59 |  | 
|---|
| [562a0ae] | 60 | <para os="t1">We will create a dummy limits.h so the build will not use the one | 
|---|
|  | 61 | provided by the host distro:</para> | 
|---|
|  | 62 |  | 
|---|
| [3309623] | 63 | <screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen> | 
|---|
| [562a0ae] | 64 |  | 
|---|
| [3f8be484] | 65 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 66 | href="../../final-system/common/gcc.xml" | 
|---|
|  | 67 | xpointer="xpointer(//*[@os='f'])"/> | 
|---|
|  | 68 |  | 
|---|
|  | 69 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 70 | href="../../final-system/common/gcc.xml" | 
|---|
|  | 71 | xpointer="xpointer(//*[@os='g'])"/> | 
|---|
|  | 72 |  | 
|---|
|  | 73 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
|  | 74 | href="../../final-system/common/gcc.xml" | 
|---|
|  | 75 | xpointer="xpointer(//*[@os='h'])"/> | 
|---|
|  | 76 |  | 
|---|
| [88958a8] | 77 | <screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ | 
|---|
| [c1832da] | 78 | ../gcc-&gcc-version;/configure --prefix=/cross-tools \ | 
|---|
|  | 79 | --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ | 
|---|
|  | 80 | --with-sysroot=${CLFS} --with-local-prefix=/tools --disable-nls \ | 
|---|
|  | 81 | --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \ | 
|---|
|  | 82 | --without-headers --with-newlib --disable-decimal-float \ | 
|---|
|  | 83 | --disable-libgomp --disable-libmudflap --disable-libssp \ | 
|---|
|  | 84 | --disable-threads --enable-languages=c --disable-multilib</userinput></screen> | 
|---|
| [3f8be484] | 85 |  | 
|---|
| [d55f00bc] | 86 | <variablelist os="am"> | 
|---|
| [3f8be484] | 87 | <title>The meaning of the configure options:</title> | 
|---|
|  | 88 |  | 
|---|
|  | 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 |  | 
|---|
|  | 100 | <varlistentry> | 
|---|
|  | 101 | <term><parameter>--disable-shared</parameter></term> | 
|---|
|  | 102 | <listitem> | 
|---|
|  | 103 | <para>Disables the creation of the shared libraries.</para> | 
|---|
|  | 104 | </listitem> | 
|---|
|  | 105 | </varlistentry> | 
|---|
|  | 106 |  | 
|---|
|  | 107 | <varlistentry> | 
|---|
|  | 108 | <term><parameter>--disable-threads</parameter></term> | 
|---|
|  | 109 | <listitem> | 
|---|
| [193315c] | 110 | <para>This will prevent GCC from looking for the multi-thread | 
|---|
| [6d4c909] | 111 | include files, since they haven't been created for this architecture | 
|---|
|  | 112 | yet. GCC will be able to find the multi-thread information after | 
|---|
|  | 113 | the Glibc headers are created.</para> | 
|---|
| [3f8be484] | 114 | </listitem> | 
|---|
|  | 115 | </varlistentry> | 
|---|
|  | 116 |  | 
|---|
|  | 117 | <varlistentry> | 
|---|
|  | 118 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
|  | 119 | <listitem> | 
|---|
|  | 120 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
|  | 121 | </listitem> | 
|---|
|  | 122 | </varlistentry> | 
|---|
|  | 123 |  | 
|---|
|  | 124 | </variablelist> | 
|---|
|  | 125 |  | 
|---|
| [d55f00bc] | 126 | <para os="an">Continue with compiling the package:</para> | 
|---|
| [3f8be484] | 127 |  | 
|---|
| [6a043e2] | 128 | <screen os="ao"><userinput>make</userinput></screen> | 
|---|
| [3f8be484] | 129 |  | 
|---|
| [d55f00bc] | 130 | <para os="ap">Install the package:</para> | 
|---|
| [3f8be484] | 131 |  | 
|---|
| [6a043e2] | 132 | <screen os="aq"><userinput>make install</userinput></screen> | 
|---|
| [3f8be484] | 133 |  | 
|---|
|  | 134 | </sect2> | 
|---|
|  | 135 |  | 
|---|
|  | 136 | <sect2 role="content"> | 
|---|
|  | 137 | <title/> | 
|---|
|  | 138 |  | 
|---|
|  | 139 | <para>Details on this package are located in <xref | 
|---|
|  | 140 | linkend="contents-gcc" role="."/></para> | 
|---|
|  | 141 |  | 
|---|
|  | 142 | </sect2> | 
|---|
|  | 143 |  | 
|---|
|  | 144 | </sect1> | 
|---|