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