| 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 |  | 
|---|
| 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 |  | 
|---|
| 33 | <screen os="p2"><userinput>patch -Np1 -i ../gcc-4.1.1-posix-1.patch</userinput></screen> | 
|---|
| 34 |  | 
|---|
| 35 | <para os="p3">The following patch fixes the searching of multilib dirs for | 
|---|
| 36 | specs file.The patch standardizes the gcc drivers path iteration functions, | 
|---|
| 37 | ensuring multilib directories are searched in the correct order. This fixes | 
|---|
| 38 | various issues, most noticably with libtool on multilib systems:</para> | 
|---|
| 39 |  | 
|---|
| 40 | <screen os="p4"><userinput>patch -Np1 -i ../&gcc-PR20425-patch;</userinput></screen> | 
|---|
| 41 |  | 
|---|
| 42 | <para os="ac">The following patch ensures that <command>gcc</command> does not | 
|---|
| 43 | search the <filename class="directory">/usr</filename> directory for | 
|---|
| 44 | <filename class="libraryfile">libgcc_s.so</filename> when | 
|---|
| 45 | cross-compiling:</para> | 
|---|
| 46 |  | 
|---|
| 47 | <screen os="ad"><userinput>patch -Np1 -i ../&gcc-cross_search-patch;</userinput></screen> | 
|---|
| 48 |  | 
|---|
| 49 | <para os="c">The GCC documentation recommends building GCC outside of the source | 
|---|
| 50 | directory in a dedicated build directory:</para> | 
|---|
| 51 |  | 
|---|
| 52 | <screen os="d"><userinput>mkdir -v ../gcc-build | 
|---|
| 53 | cd ../gcc-build</userinput></screen> | 
|---|
| 54 |  | 
|---|
| 55 | <para os="e">Prepare GCC for compilation:</para> | 
|---|
| 56 |  | 
|---|
| 57 | <screen os="ae"><userinput>../gcc-&gcc-version;/configure --prefix=${CLFS}/cross-tools \ | 
|---|
| 58 | --host=${CLFS_HOST} --target=${CLFS_TARGET} --disable-multilib \ | 
|---|
| 59 | --with-sysroot=${CLFS} --disable-nls --disable-shared \ | 
|---|
| 60 | --enable-languages=c</userinput></screen> | 
|---|
| 61 |  | 
|---|
| 62 | <variablelist os="af"> | 
|---|
| 63 | <title>The meaning of the configure options:</title> | 
|---|
| 64 |  | 
|---|
| 65 | <varlistentry> | 
|---|
| 66 | <term><parameter>--disable-shared</parameter></term> | 
|---|
| 67 | <listitem> | 
|---|
| 68 | <para>Disables the creation of the shared libraries.</para> | 
|---|
| 69 | </listitem> | 
|---|
| 70 | </varlistentry> | 
|---|
| 71 |  | 
|---|
| 72 | <varlistentry> | 
|---|
| 73 | <term><parameter>--disable-threads</parameter></term> | 
|---|
| 74 | <listitem> | 
|---|
| 75 | <para>This will prevent GCC from looking for the multi-thread | 
|---|
| 76 | include files, since they haven't been created for this architecture | 
|---|
| 77 | yet. GCC will be able to find the multi-thread information after | 
|---|
| 78 | the Glibc headers are created.</para> | 
|---|
| 79 | </listitem> | 
|---|
| 80 | </varlistentry> | 
|---|
| 81 |  | 
|---|
| 82 | <varlistentry> | 
|---|
| 83 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
| 84 | <listitem> | 
|---|
| 85 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
| 86 | </listitem> | 
|---|
| 87 | </varlistentry> | 
|---|
| 88 |  | 
|---|
| 89 | </variablelist> | 
|---|
| 90 |  | 
|---|
| 91 | <para os="ag">Continue with compiling the package:</para> | 
|---|
| 92 |  | 
|---|
| 93 | <screen os="ah"><userinput>make all-gcc</userinput></screen> | 
|---|
| 94 |  | 
|---|
| 95 | <para os="ai">Install the package:</para> | 
|---|
| 96 |  | 
|---|
| 97 | <screen os="aj"><userinput>make install-gcc</userinput></screen> | 
|---|
| 98 |  | 
|---|
| 99 | </sect2> | 
|---|
| 100 |  | 
|---|
| 101 | <sect2 role="content"> | 
|---|
| 102 | <title/> | 
|---|
| 103 |  | 
|---|
| 104 | <para>Details on this package are located in <xref | 
|---|
| 105 | linkend="contents-gcc" role="."/></para> | 
|---|
| 106 |  | 
|---|
| 107 | </sect2> | 
|---|
| 108 |  | 
|---|
| 109 | </sect1> | 
|---|