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