| 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/2003/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 specs file | 
|---|
| 27 | to ensure GCC uses our build environment:</para> | 
|---|
| 28 |  | 
|---|
| 29 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> | 
|---|
| 30 |  | 
|---|
| 31 | <para os="ac">To make sure that a couple of tools use the proper syntax, | 
|---|
| 32 | apply the following patch:</para> | 
|---|
| 33 |  | 
|---|
| 34 | <screen os="ad"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen> | 
|---|
| 35 |  | 
|---|
| 36 | <para os="ag">Change the StartFile Spec to point to the correct library | 
|---|
| 37 | location:</para> | 
|---|
| 38 |  | 
|---|
| 39 | <screen os="ah"><userinput>echo " | 
|---|
| 40 | #undef STARTFILE_PREFIX_SPEC | 
|---|
| 41 | #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/linux.h</userinput></screen> | 
|---|
| 42 |  | 
|---|
| 43 | <para os="ai">Now alter <command>gcc</command>'s c preprocessor's default | 
|---|
| 44 | include search path to use <filename class="directory">/tools</filename> only:</para> | 
|---|
| 45 |  | 
|---|
| 46 | <screen os="aj"><userinput>cp -v gcc/Makefile.in{,.orig} | 
|---|
| 47 | sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ | 
|---|
| 48 | gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen> | 
|---|
| 49 |  | 
|---|
| 50 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 51 | href="../../final-system/common/gcc.xml" | 
|---|
| 52 | xpointer="xpointer(//*[@os='f'])"/> | 
|---|
| 53 |  | 
|---|
| 54 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 55 | href="../../final-system/common/gcc.xml" | 
|---|
| 56 | xpointer="xpointer(//*[@os='g'])"/> | 
|---|
| 57 |  | 
|---|
| 58 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 59 | href="../../final-system/common/gcc.xml" | 
|---|
| 60 | xpointer="xpointer(//*[@os='h'])"/> | 
|---|
| 61 |  | 
|---|
| 62 | <screen os="al"><userinput>AR=ar ../gcc-&gcc-version;/configure --prefix=/cross-tools \ | 
|---|
| 63 | --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ | 
|---|
| 64 | --disable-multilib --with-local-prefix=/tools --disable-nls \ | 
|---|
| 65 | --without-headers --with-newlib --disable-decimal-float \ | 
|---|
| 66 | --disable-libgomp --disable-libmudflap --disable-libssp \ | 
|---|
| 67 | --disable-shared --disable-threads --enable-languages=c</userinput></screen> | 
|---|
| 68 |  | 
|---|
| 69 | <variablelist os="am"> | 
|---|
| 70 | <title>The meaning of the configure options:</title> | 
|---|
| 71 |  | 
|---|
| 72 | <varlistentry> | 
|---|
| 73 | <term><parameter>--with-local-prefix=/tools</parameter></term> | 
|---|
| 74 | <listitem> | 
|---|
| 75 | <para>The purpose of this switch is to remove <filename | 
|---|
| 76 | class="directory">/usr/local/include</filename> from | 
|---|
| 77 | <command>gcc</command>'s include search path. This is not | 
|---|
| 78 | absolutely essential, however, it helps to minimize the | 
|---|
| 79 | influence of the host system.</para> | 
|---|
| 80 | </listitem> | 
|---|
| 81 | </varlistentry> | 
|---|
| 82 |  | 
|---|
| 83 | <varlistentry> | 
|---|
| 84 | <term><parameter>--disable-shared</parameter></term> | 
|---|
| 85 | <listitem> | 
|---|
| 86 | <para>Disables the creation of the shared libraries.</para> | 
|---|
| 87 | </listitem> | 
|---|
| 88 | </varlistentry> | 
|---|
| 89 |  | 
|---|
| 90 | <varlistentry> | 
|---|
| 91 | <term><parameter>--disable-threads</parameter></term> | 
|---|
| 92 | <listitem> | 
|---|
| 93 | <para>This will prevent GCC from looking for the multi-thread | 
|---|
| 94 | include files, since they haven't been created for this architecture | 
|---|
| 95 | yet. GCC will be able to find the multi-thread information after | 
|---|
| 96 | the Glibc headers are created.</para> | 
|---|
| 97 | </listitem> | 
|---|
| 98 | </varlistentry> | 
|---|
| 99 |  | 
|---|
| 100 | <varlistentry> | 
|---|
| 101 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
| 102 | <listitem> | 
|---|
| 103 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
| 104 | </listitem> | 
|---|
| 105 | </varlistentry> | 
|---|
| 106 |  | 
|---|
| 107 | </variablelist> | 
|---|
| 108 |  | 
|---|
| 109 | <para os="an">Continue with compiling the package:</para> | 
|---|
| 110 |  | 
|---|
| 111 | <screen os="ao"><userinput>make</userinput></screen> | 
|---|
| 112 |  | 
|---|
| 113 | <para os="ap">Install the package:</para> | 
|---|
| 114 |  | 
|---|
| 115 | <screen os="aq"><userinput>make install</userinput></screen> | 
|---|
| 116 |  | 
|---|
| 117 | </sect2> | 
|---|
| 118 |  | 
|---|
| 119 | <sect2 role="content"> | 
|---|
| 120 | <title/> | 
|---|
| 121 |  | 
|---|
| 122 | <para>Details on this package are located in <xref | 
|---|
| 123 | linkend="contents-gcc" role="."/></para> | 
|---|
| 124 |  | 
|---|
| 125 | </sect2> | 
|---|
| 126 |  | 
|---|
| 127 | </sect1> | 
|---|