| 1 | <?xml version="1.0" encoding="ISO-8859-1"?> | 
|---|
| 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" | 
|---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/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 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 19 | href="../../final-system/common/gcc.xml" | 
|---|
| 20 | xpointer="xpointer(//*[@role='package'])"/> | 
|---|
| 21 |  | 
|---|
| 22 | <sect2 role="installation"> | 
|---|
| 23 | <title>Installation of Cross GCC Compiler with Static libgcc | 
|---|
| 24 | and no Threads</title> | 
|---|
| 25 |  | 
|---|
| 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 |  | 
|---|
| 34 | <para os="aa">Make a couple of essential adjustments to the | 
|---|
| 35 | <filename>specs</filename> file to ensure GCC uses our build | 
|---|
| 36 | environment:</para> | 
|---|
| 37 |  | 
|---|
| 38 | <screen os="ab"><userinput>patch -Np1 -i ../&gcc-specs-patch;</userinput></screen> | 
|---|
| 39 |  | 
|---|
| 40 | <para os="ag">Change the StartFile Spec and Standard Include Dir so that | 
|---|
| 41 | GCC looks in <filename class="directory">/tools</filename>:</para> | 
|---|
| 42 |  | 
|---|
| 43 | <screen os="ah"><userinput>echo -en '#undef STANDARD_INCLUDE_DIR\n#define STANDARD_INCLUDE_DIR "/tools/include/"\n\n' >> gcc/config/linux.h | 
|---|
| 44 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_1\n#define STANDARD_STARTFILE_PREFIX_1 "/tools/lib/"\n' >> gcc/config/linux.h | 
|---|
| 45 | echo -en '\n#undef STANDARD_STARTFILE_PREFIX_2\n#define STANDARD_STARTFILE_PREFIX_2 ""\n' >> gcc/config/linux.h</userinput></screen> | 
|---|
| 46 |  | 
|---|
| 47 | <para os="ai">Now alter <command>gcc</command>'s c preprocessor's default | 
|---|
| 48 | include search path to use <filename class="directory">/tools</filename> only:</para> | 
|---|
| 49 |  | 
|---|
| 50 | <screen os="aj"><userinput>cp -v gcc/Makefile.in{,.orig} | 
|---|
| 51 | sed -e "s@\(^CROSS_SYSTEM_HEADER_DIR =\).*@\1 /tools/include@g" \ | 
|---|
| 52 | gcc/Makefile.in.orig > gcc/Makefile.in</userinput></screen> | 
|---|
| 53 |  | 
|---|
| 54 | <para os="t1">We will create a dummy <filename>limits.h</filename> so | 
|---|
| 55 | the build will not use the one provided by the host distro:</para> | 
|---|
| 56 |  | 
|---|
| 57 | <screen os="t2"><userinput>touch /tools/include/limits.h</userinput></screen> | 
|---|
| 58 |  | 
|---|
| 59 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 60 | href="../../final-system/common/gcc.xml" | 
|---|
| 61 | xpointer="xpointer(//*[@os='f'])"/> | 
|---|
| 62 |  | 
|---|
| 63 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 64 | href="../../final-system/common/gcc.xml" | 
|---|
| 65 | xpointer="xpointer(//*[@os='g'])"/> | 
|---|
| 66 |  | 
|---|
| 67 | <xi:include xmlns:xi="http://www.w3.org/2003/XInclude" | 
|---|
| 68 | href="../../final-system/common/gcc.xml" | 
|---|
| 69 | xpointer="xpointer(//*[@os='h'])"/> | 
|---|
| 70 |  | 
|---|
| 71 | <screen os="al"><userinput>AR=ar LDFLAGS="-Wl,-rpath,/cross-tools/lib" \ | 
|---|
| 72 | ../gcc-&gcc-version;/configure --prefix=/cross-tools \ | 
|---|
| 73 | --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ | 
|---|
| 74 | --with-sysroot=${CLFS} --with-local-prefix=/tools --disable-nls \ | 
|---|
| 75 | --disable-shared --with-mpfr=/cross-tools --with-gmp=/cross-tools \ | 
|---|
| 76 | --with-ppl=/cross-tools --with-cloog=/cross-tools \ | 
|---|
| 77 | --without-headers --with-newlib --disable-decimal-float \ | 
|---|
| 78 | --disable-libgomp --disable-libmudflap --disable-libssp \ | 
|---|
| 79 | --disable-threads --enable-languages=c --disable-multilib</userinput></screen> | 
|---|
| 80 |  | 
|---|
| 81 | <variablelist os="am"> | 
|---|
| 82 | <title>The meaning of the configure options:</title> | 
|---|
| 83 |  | 
|---|
| 84 | <varlistentry> | 
|---|
| 85 | <term><parameter>--with-local-prefix=/tools</parameter></term> | 
|---|
| 86 | <listitem> | 
|---|
| 87 | <para>The purpose of this switch is to remove <filename | 
|---|
| 88 | class="directory">/usr/local/include</filename> from | 
|---|
| 89 | <command>gcc</command>'s include search path. This is not | 
|---|
| 90 | absolutely essential, however, it helps to minimize the | 
|---|
| 91 | influence of the host system.</para> | 
|---|
| 92 | </listitem> | 
|---|
| 93 | </varlistentry> | 
|---|
| 94 |  | 
|---|
| 95 | <varlistentry> | 
|---|
| 96 | <term><parameter>--disable-shared</parameter></term> | 
|---|
| 97 | <listitem> | 
|---|
| 98 | <para>Disables the creation of the shared libraries.</para> | 
|---|
| 99 | </listitem> | 
|---|
| 100 | </varlistentry> | 
|---|
| 101 |  | 
|---|
| 102 | <varlistentry> | 
|---|
| 103 | <term><parameter>--disable-threads</parameter></term> | 
|---|
| 104 | <listitem> | 
|---|
| 105 | <para>This will prevent GCC from looking for the multi-thread | 
|---|
| 106 | include files, since they haven't been created for this architecture | 
|---|
| 107 | yet. GCC will be able to find the multi-thread information after | 
|---|
| 108 | the Glibc headers are created.</para> | 
|---|
| 109 | </listitem> | 
|---|
| 110 | </varlistentry> | 
|---|
| 111 |  | 
|---|
| 112 | <varlistentry> | 
|---|
| 113 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
| 114 | <listitem> | 
|---|
| 115 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
| 116 | </listitem> | 
|---|
| 117 | </varlistentry> | 
|---|
| 118 |  | 
|---|
| 119 | </variablelist> | 
|---|
| 120 |  | 
|---|
| 121 | <para os="an">Continue with compiling the package:</para> | 
|---|
| 122 |  | 
|---|
| 123 | <screen os="ao"><userinput>make all-gcc all-target-libgcc</userinput></screen> | 
|---|
| 124 |  | 
|---|
| 125 | <para os="ap">Install the package:</para> | 
|---|
| 126 |  | 
|---|
| 127 | <screen os="aq"><userinput>make install-gcc install-target-libgcc</userinput></screen> | 
|---|
| 128 |  | 
|---|
| 129 | </sect2> | 
|---|
| 130 |  | 
|---|
| 131 | <sect2 role="content"> | 
|---|
| 132 | <title/> | 
|---|
| 133 |  | 
|---|
| 134 | <para>Details on this package are located in <xref | 
|---|
| 135 | linkend="contents-gcc" role="."/></para> | 
|---|
| 136 |  | 
|---|
| 137 | </sect2> | 
|---|
| 138 |  | 
|---|
| 139 | </sect1> | 
|---|