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