| 1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" | 
|---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ | 
|---|
| 4 | <!ENTITY % general-entities SYSTEM "../../general.ent"> | 
|---|
| 5 | <!ENTITY % patches-entities SYSTEM "../../patches.ent"> | 
|---|
| 6 | %general-entities; | 
|---|
| 7 | %patches-entities; | 
|---|
| 8 | ]> | 
|---|
| 9 |  | 
|---|
| 10 | <sect1 id="ch-cross-tools-gcc-static" role="wrap"> | 
|---|
| 11 | <?dbhtml filename="gcc-static.html"?> | 
|---|
| 12 |  | 
|---|
| 13 | <title>Cross GCC-&gcc-version; - Static</title> | 
|---|
| 14 |  | 
|---|
| 15 | <indexterm zone="ch-cross-tools-gcc-static"> | 
|---|
| 16 | <primary sortas="a-GCC">GCC</primary> | 
|---|
| 17 | <secondary>cross tools, static</secondary> | 
|---|
| 18 | </indexterm> | 
|---|
| 19 |  | 
|---|
| 20 | <sect2 role="package"> | 
|---|
| 21 | <title/> | 
|---|
| 22 |  | 
|---|
| 23 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 24 | href="../../final-system/common/gcc.xml" | 
|---|
| 25 | xpointer="xpointer(//*[@role='package']/para[1])"/> | 
|---|
| 26 |  | 
|---|
| 27 | <segmentedlist> | 
|---|
| 28 | <segtitle>&buildtime;</segtitle> | 
|---|
| 29 | <segtitle>&diskspace;</segtitle> | 
|---|
| 30 |  | 
|---|
| 31 | <seglistitem> | 
|---|
| 32 | <seg>Not checked yet</seg> | 
|---|
| 33 | <seg>Not checked yet</seg> | 
|---|
| 34 | </seglistitem> | 
|---|
| 35 | </segmentedlist> | 
|---|
| 36 |  | 
|---|
| 37 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 38 | href="../../final-system/common/gcc.xml" | 
|---|
| 39 | xpointer="xpointer(//*[@role='package']/segmentedlist[2])"/> | 
|---|
| 40 |  | 
|---|
| 41 | </sect2> | 
|---|
| 42 |  | 
|---|
| 43 | <sect2 role="installation"> | 
|---|
| 44 | <title>Installation of Cross GCC Compiler with Static libgcc | 
|---|
| 45 | and no Threads</title> | 
|---|
| 46 |  | 
|---|
| 47 | <para os="aa">We will make a couple of essential adjustments to the specs file | 
|---|
| 48 | to point to use our build environment:</para> | 
|---|
| 49 |  | 
|---|
| 50 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> | 
|---|
| 51 |  | 
|---|
| 52 | <para os="ac">To make sure that we use the proper syntax for a couple of tools, | 
|---|
| 53 | we apply the following patch:</para> | 
|---|
| 54 |  | 
|---|
| 55 | <screen os="ad"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen> | 
|---|
| 56 |  | 
|---|
| 57 | <para os="ae">The following patch ensures that <command>gcc</command> does not | 
|---|
| 58 | search the <filename class="directory">/usr</filename> directory for | 
|---|
| 59 | <filename class="libraryfile">libgcc_s.so</filename> when | 
|---|
| 60 | cross-compling:</para> | 
|---|
| 61 |  | 
|---|
| 62 | <screen os="af"><userinput>patch -Np1 -i ../&gcc-cross_search-patch;</userinput></screen> | 
|---|
| 63 |  | 
|---|
| 64 | <para os="ag">Now we will need to setup our StartFile Spec to the correct library | 
|---|
| 65 | location:</para> | 
|---|
| 66 |  | 
|---|
| 67 | <screen os="ah"><userinput>echo " | 
|---|
| 68 | #undef STARTFILE_PREFIX_SPEC | 
|---|
| 69 | #define STARTFILE_PREFIX_SPEC \"/tools/lib/\"" >> gcc/config/linux.h</userinput></screen> | 
|---|
| 70 |  | 
|---|
| 71 | <para os="ai">Now we will change <command>gcc</command>'s search path to look | 
|---|
| 72 | into <filename class="directory">/tools</filename> only:</para> | 
|---|
| 73 |  | 
|---|
| 74 | <screen os="aj"><userinput>cp gcc/Makefile.in{,.orig} | 
|---|
| 75 | sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ | 
|---|
| 76 | gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen> | 
|---|
| 77 |  | 
|---|
| 78 | <important os="ak"> | 
|---|
| 79 | <para>The above patches and sed's are critical in ensuring a | 
|---|
| 80 | successful overall build. Do not forget to apply them.</para> | 
|---|
| 81 | </important> | 
|---|
| 82 |  | 
|---|
| 83 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 84 | href="../../final-system/common/gcc.xml" | 
|---|
| 85 | xpointer="xpointer(//*[@os='f'])"/> | 
|---|
| 86 |  | 
|---|
| 87 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 88 | href="../../final-system/common/gcc.xml" | 
|---|
| 89 | xpointer="xpointer(//*[@os='g'])"/> | 
|---|
| 90 |  | 
|---|
| 91 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 92 | href="../../final-system/common/gcc.xml" | 
|---|
| 93 | xpointer="xpointer(//*[@os='h'])"/> | 
|---|
| 94 |  | 
|---|
| 95 | <screen><userinput>../gcc-&gcc-version;/configure --prefix=/cross-tools \ | 
|---|
| 96 | --host=${LFS_HOST} --target=${LFS_TARGET} \ | 
|---|
| 97 | --with-local-prefix=/tools --disable-nls --disable-shared \ | 
|---|
| 98 | --disable-threads --enable-languages=c</userinput></screen> | 
|---|
| 99 |  | 
|---|
| 100 | <variablelist os="al"> | 
|---|
| 101 | <title>The meaning of the configure options:</title> | 
|---|
| 102 |  | 
|---|
| 103 | <varlistentry> | 
|---|
| 104 | <term><parameter>--with-local-prefix=/tools</parameter></term> | 
|---|
| 105 | <listitem> | 
|---|
| 106 | <para>The purpose of this switch is to remove <filename | 
|---|
| 107 | class="directory">/usr/local/include</filename> from | 
|---|
| 108 | <command>gcc</command>'s include search path. This is not | 
|---|
| 109 | absolutely essential, however, it helps to minimize the | 
|---|
| 110 | influence of the host system.</para> | 
|---|
| 111 | </listitem> | 
|---|
| 112 | </varlistentry> | 
|---|
| 113 |  | 
|---|
| 114 | <varlistentry> | 
|---|
| 115 | <term><parameter>--disable-shared</parameter></term> | 
|---|
| 116 | <listitem> | 
|---|
| 117 | <para>Disables the creation of the shared libraries.</para> | 
|---|
| 118 | </listitem> | 
|---|
| 119 | </varlistentry> | 
|---|
| 120 |  | 
|---|
| 121 | <varlistentry> | 
|---|
| 122 | <term><parameter>--disable-threads</parameter></term> | 
|---|
| 123 | <listitem> | 
|---|
| 124 | <para>This will prevent GCC from finding the multi-thread | 
|---|
| 125 | include files, since we haven't created them for this architecture | 
|---|
| 126 | yet. We will be able to find the multi-thread information after | 
|---|
| 127 | we create the Glibc headers.</para> | 
|---|
| 128 | </listitem> | 
|---|
| 129 | </varlistentry> | 
|---|
| 130 |  | 
|---|
| 131 | <varlistentry> | 
|---|
| 132 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
| 133 | <listitem> | 
|---|
| 134 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
| 135 | </listitem> | 
|---|
| 136 | </varlistentry> | 
|---|
| 137 |  | 
|---|
| 138 | </variablelist> | 
|---|
| 139 |  | 
|---|
| 140 | <para>Continue with compiling the package:</para> | 
|---|
| 141 |  | 
|---|
| 142 | <screen><userinput>make all-gcc</userinput></screen> | 
|---|
| 143 |  | 
|---|
| 144 | <para>Install the package:</para> | 
|---|
| 145 |  | 
|---|
| 146 | <screen><userinput>make install-gcc</userinput></screen> | 
|---|
| 147 |  | 
|---|
| 148 | </sect2> | 
|---|
| 149 |  | 
|---|
| 150 | <sect2 role="content"> | 
|---|
| 151 | <title/> | 
|---|
| 152 |  | 
|---|
| 153 | <para>Details on this package are located in <xref | 
|---|
| 154 | linkend="contents-gcc" role="."/></para> | 
|---|
| 155 |  | 
|---|
| 156 | </sect2> | 
|---|
| 157 |  | 
|---|
| 158 | </sect1> | 
|---|