[a9e389d] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?> |
---|
[bd48e48] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ |
---|
[a9e389d] | 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 | |
---|
| 18 | <sect2 role="package"> |
---|
| 19 | <title/> |
---|
| 20 | |
---|
| 21 | <para>The GCC package contains the GNU compiler collection, which includes |
---|
| 22 | the C and C++ compilers.</para> |
---|
| 23 | |
---|
| 24 | </sect2> |
---|
| 25 | |
---|
| 26 | <sect2 role="installation"> |
---|
| 27 | <title>Installation of Cross GCC Compiler with Static libgcc |
---|
| 28 | and no Threads</title> |
---|
| 29 | |
---|
| 30 | <para os="p1">To make sure that a couple of tools use the proper syntax, |
---|
| 31 | apply the following patch:</para> |
---|
| 32 | |
---|
[841271e] | 33 | <screen os="p2"><userinput>patch -Np1 -i ../&gcc-posix-patch;</userinput></screen> |
---|
[a9e389d] | 34 | |
---|
[00c8a02] | 35 | <para os="p3">The following patch is needed for GCC to build against uClibc:</para> |
---|
[841271e] | 36 | |
---|
| 37 | <screen os="p4"><userinput>patch -Np1 -i ../&gcc-uclibc-patch;</userinput></screen> |
---|
| 38 | |
---|
[0602db2] | 39 | <para os="p5">The following patch ensures that <command>gcc</command> does not |
---|
[a9e389d] | 40 | search the <filename class="directory">/usr</filename> directory for |
---|
| 41 | <filename class="libraryfile">libgcc_s.so</filename> when |
---|
| 42 | cross-compiling:</para> |
---|
| 43 | |
---|
[0602db2] | 44 | <screen os="p6"><userinput>patch -Np1 -i ../&gcc-cross_search-patch;</userinput></screen> |
---|
[a9e389d] | 45 | |
---|
| 46 | <para os="c">The GCC documentation recommends building GCC outside of the source |
---|
| 47 | directory in a dedicated build directory:</para> |
---|
| 48 | |
---|
| 49 | <screen os="d"><userinput>mkdir -v ../gcc-build |
---|
| 50 | cd ../gcc-build</userinput></screen> |
---|
| 51 | |
---|
| 52 | <para os="e">Prepare GCC for compilation:</para> |
---|
| 53 | |
---|
| 54 | <screen os="ae"><userinput>../gcc-&gcc-version;/configure --prefix=${CLFS}/cross-tools \ |
---|
| 55 | --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib \ |
---|
[3ca2208] | 56 | --with-sysroot=${CLFS} --disable-nls --disable-shared \ |
---|
| 57 | --disable-threads --enable-languages=c</userinput></screen> |
---|
[a9e389d] | 58 | |
---|
| 59 | <variablelist os="af"> |
---|
| 60 | <title>The meaning of the configure options:</title> |
---|
| 61 | |
---|
| 62 | <varlistentry> |
---|
| 63 | <term><parameter>--disable-shared</parameter></term> |
---|
| 64 | <listitem> |
---|
| 65 | <para>Disables the creation of the shared libraries.</para> |
---|
| 66 | </listitem> |
---|
| 67 | </varlistentry> |
---|
| 68 | |
---|
| 69 | <varlistentry> |
---|
| 70 | <term><parameter>--disable-threads</parameter></term> |
---|
| 71 | <listitem> |
---|
| 72 | <para>This will prevent GCC from looking for the multi-thread |
---|
| 73 | include files, since they haven't been created for this architecture |
---|
| 74 | yet. GCC will be able to find the multi-thread information after |
---|
| 75 | the Glibc headers are created.</para> |
---|
| 76 | </listitem> |
---|
| 77 | </varlistentry> |
---|
| 78 | |
---|
| 79 | <varlistentry> |
---|
| 80 | <term><parameter>--enable-languages=c</parameter></term> |
---|
| 81 | <listitem> |
---|
| 82 | <para>This option ensures that only the C compiler is built.</para> |
---|
| 83 | </listitem> |
---|
| 84 | </varlistentry> |
---|
| 85 | |
---|
| 86 | </variablelist> |
---|
| 87 | |
---|
| 88 | <para os="ag">Continue with compiling the package:</para> |
---|
| 89 | |
---|
| 90 | <screen os="ah"><userinput>make all-gcc</userinput></screen> |
---|
| 91 | |
---|
| 92 | <para os="ai">Install the package:</para> |
---|
| 93 | |
---|
| 94 | <screen os="aj"><userinput>make install-gcc</userinput></screen> |
---|
| 95 | |
---|
| 96 | </sect2> |
---|
| 97 | |
---|
| 98 | <sect2 role="content"> |
---|
| 99 | <title/> |
---|
| 100 | |
---|
| 101 | <para>Details on this package are located in <xref |
---|
| 102 | linkend="contents-gcc" role="."/></para> |
---|
| 103 | |
---|
| 104 | </sect2> |
---|
| 105 | |
---|
| 106 | </sect1> |
---|