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