| [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 |  | 
|---|
| [b128a0e] | 8 | <!-- Common GCC-Static --> | 
|---|
|  | 9 |  | 
|---|
| [a9e389d] | 10 | <sect1 id="ch-cross-tools-gcc-static" role="wrap"> | 
|---|
|  | 11 | <?dbhtml filename="gcc-static.html"?> | 
|---|
|  | 12 |  | 
|---|
|  | 13 | <title>Cross GCC-&gcc-version; - Static</title> | 
|---|
|  | 14 |  | 
|---|
|  | 15 | <indexterm zone="ch-cross-tools-gcc-static"> | 
|---|
|  | 16 | <primary sortas="a-GCC">GCC</primary> | 
|---|
|  | 17 | <secondary>cross tools, static</secondary> | 
|---|
|  | 18 | </indexterm> | 
|---|
|  | 19 |  | 
|---|
|  | 20 | <sect2 role="package"> | 
|---|
|  | 21 | <title/> | 
|---|
|  | 22 |  | 
|---|
|  | 23 | <para>The GCC package contains the GNU compiler collection, which includes | 
|---|
|  | 24 | the C and C++ compilers.</para> | 
|---|
|  | 25 |  | 
|---|
|  | 26 | </sect2> | 
|---|
|  | 27 |  | 
|---|
|  | 28 | <sect2 role="installation"> | 
|---|
| [ae51e2a] | 29 | <title os="a">Installation of Cross GCC Compiler with Static libgcc | 
|---|
| [a9e389d] | 30 | and no Threads</title> | 
|---|
|  | 31 |  | 
|---|
|  | 32 | <para os="c">The GCC documentation recommends building GCC outside of the source | 
|---|
|  | 33 | directory in a dedicated build directory:</para> | 
|---|
|  | 34 |  | 
|---|
|  | 35 | <screen os="d"><userinput>mkdir -v ../gcc-build | 
|---|
|  | 36 | cd ../gcc-build</userinput></screen> | 
|---|
|  | 37 |  | 
|---|
|  | 38 | <para os="e">Prepare GCC for compilation:</para> | 
|---|
|  | 39 |  | 
|---|
| [ae51e2a] | 40 | <!-- This is the common configure line for GCC-Static. --> | 
|---|
|  | 41 | <!-- It's not actually used by any arch but is here for reference. --> | 
|---|
| [35e0963] | 42 | <screen os="ae"><userinput>AR=ar LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \ | 
|---|
| [e1b2402] | 43 | ../gcc-&gcc-version;/configure --prefix=${CLFS}/cross-tools \ | 
|---|
|  | 44 | --build=${CLFS_HOST} --host=${CLFS_HOST} --target=${CLFS_TARGET} \ | 
|---|
|  | 45 | --with-sysroot=${CLFS} --disable-nls  --disable-shared \ | 
|---|
| [35e0963] | 46 | --with-mpfr=${CLFS}/cross-tools --with-gmp=${CLFS}/cross-tools \ | 
|---|
| [f6137b6] | 47 | --with-mpc=${CLFS}/cross-tools --without-headers --with-newlib \ | 
|---|
|  | 48 | --disable-decimal-float --disable-libgomp --disable-libmudflap \ | 
|---|
| [0f33b23] | 49 | --disable-libssp --disable-threads --enable-languages=c \ | 
|---|
|  | 50 | --disable-multilib</userinput></screen> | 
|---|
| [a9e389d] | 51 |  | 
|---|
|  | 52 | <variablelist os="af"> | 
|---|
|  | 53 | <title>The meaning of the configure options:</title> | 
|---|
|  | 54 |  | 
|---|
| [f704d3f] | 55 | <varlistentry os="af1"> | 
|---|
|  | 56 | <term><parameter>--prefix=${CLFS}/cross-tools</parameter></term> | 
|---|
|  | 57 | <listitem> | 
|---|
|  | 58 | <para>This tells the configure script to prepare to install the | 
|---|
|  | 59 | package in the <filename class="directory">${CLFS}/cross-tools</filename> | 
|---|
|  | 60 | directory.</para> | 
|---|
|  | 61 | </listitem> | 
|---|
|  | 62 | </varlistentry> | 
|---|
|  | 63 |  | 
|---|
|  | 64 | <varlistentry os="af2"> | 
|---|
|  | 65 | <term><parameter>--build=${CLFS_HOST}</parameter></term> | 
|---|
|  | 66 | <listitem> | 
|---|
|  | 67 | <para>This tells the configure script the triplet to use to build GCC. | 
|---|
|  | 68 | It will use ${CLFS_HOST} as that's where it's being built.</para> | 
|---|
|  | 69 | </listitem> | 
|---|
|  | 70 | </varlistentry> | 
|---|
|  | 71 |  | 
|---|
|  | 72 | <varlistentry os="af3"> | 
|---|
|  | 73 | <term><parameter>--host=${CLFS_HOST}</parameter></term> | 
|---|
|  | 74 | <listitem> | 
|---|
|  | 75 | <para>This tells the configure script the triplet of the machine GCC | 
|---|
|  | 76 | will be executed on when actually cross compiling.  It will use | 
|---|
|  | 77 | ${CLFS_HOST} as that's where GCC will execute when cross compiling | 
|---|
|  | 78 | software later.</para> | 
|---|
|  | 79 | </listitem> | 
|---|
|  | 80 | </varlistentry> | 
|---|
|  | 81 |  | 
|---|
|  | 82 | <varlistentry os="af4"> | 
|---|
|  | 83 | <term><parameter>--target=${CLFS_TARGET}</parameter></term> | 
|---|
|  | 84 | <listitem> | 
|---|
|  | 85 | <para>This tells the configure script the triplet of the machine GCC | 
|---|
|  | 86 | will build executables for.  It will use ${CLFS_TARGET} so that software | 
|---|
|  | 87 | compiled with this version of GCC can be executed on the embedded machine | 
|---|
|  | 88 | target.</para> | 
|---|
|  | 89 | </listitem> | 
|---|
|  | 90 | </varlistentry> | 
|---|
|  | 91 |  | 
|---|
|  | 92 | <varlistentry os="af5"> | 
|---|
|  | 93 | <term><parameter>--with-sysroot=${CLFS}</parameter></term> | 
|---|
|  | 94 | <listitem> | 
|---|
|  | 95 | <para>This tells configure that ${CLFS} is going to be the root | 
|---|
|  | 96 | of our system. It will now use the specified sysroot, ${CLFS}, as | 
|---|
|  | 97 | a prefix of the default search paths.</para> | 
|---|
|  | 98 | </listitem> | 
|---|
|  | 99 | </varlistentry> | 
|---|
|  | 100 |  | 
|---|
|  | 101 | <varlistentry os="af6"> | 
|---|
|  | 102 | <term><parameter>--disable-nls</parameter></term> | 
|---|
|  | 103 | <listitem> | 
|---|
|  | 104 | <para>This disables internationalization as i18n is not needed for the | 
|---|
|  | 105 | cross-compile tools.</para> | 
|---|
|  | 106 | </listitem> | 
|---|
|  | 107 | </varlistentry> | 
|---|
|  | 108 |  | 
|---|
|  | 109 | <varlistentry os="af7"> | 
|---|
| [a9e389d] | 110 | <term><parameter>--disable-shared</parameter></term> | 
|---|
|  | 111 | <listitem> | 
|---|
|  | 112 | <para>Disables the creation of the shared libraries.</para> | 
|---|
|  | 113 | </listitem> | 
|---|
|  | 114 | </varlistentry> | 
|---|
|  | 115 |  | 
|---|
| [f704d3f] | 116 | <varlistentry os="af8"> | 
|---|
|  | 117 | <term><parameter>--with-mpfr=${CLFS}/cross-tools</parameter></term> | 
|---|
|  | 118 | <listitem> | 
|---|
|  | 119 | <para>Tells configure where to find the | 
|---|
|  | 120 | <filename class="directory">lib</filename> and | 
|---|
|  | 121 | <filename class="directory">include</filename> directories | 
|---|
|  | 122 | that contain MPFR which was built earlier.</para> | 
|---|
|  | 123 | </listitem> | 
|---|
|  | 124 | </varlistentry> | 
|---|
|  | 125 |  | 
|---|
|  | 126 | <varlistentry os="af9"> | 
|---|
|  | 127 | <term><parameter>--with-gmp=${CLFS}/cross-tools</parameter></term> | 
|---|
|  | 128 | <listitem> | 
|---|
|  | 129 | <para>Tells configure where to find the | 
|---|
|  | 130 | <filename class="directory">lib</filename> and | 
|---|
|  | 131 | <filename class="directory">include</filename> directories | 
|---|
|  | 132 | that contain GMP which was built earlier.</para> | 
|---|
|  | 133 | </listitem> | 
|---|
|  | 134 | </varlistentry> | 
|---|
|  | 135 |  | 
|---|
| [f6137b6] | 136 | <varlistentry os="af10"> | 
|---|
|  | 137 | <term><parameter>--with-mpc=${CLFS}/cross-tools</parameter></term> | 
|---|
|  | 138 | <listitem> | 
|---|
|  | 139 | <para>Tells configure where to find the | 
|---|
|  | 140 | <filename class="directory">lib</filename> and | 
|---|
|  | 141 | <filename class="directory">include</filename> directories | 
|---|
|  | 142 | that contain MPC which was built earlier.</para> | 
|---|
|  | 143 | </listitem> | 
|---|
|  | 144 | </varlistentry> | 
|---|
|  | 145 |  | 
|---|
| [f704d3f] | 146 | <varlistentry os="af11"> | 
|---|
|  | 147 | <term><parameter>--without-headers</parameter></term> | 
|---|
|  | 148 | <listitem> | 
|---|
|  | 149 | <para>Tells configure to not use any headers from any C libraries. | 
|---|
|  | 150 | This is needed as we haven't yet built the C library and to prevent | 
|---|
|  | 151 | influence from the host environment.</para> | 
|---|
|  | 152 | </listitem> | 
|---|
|  | 153 | </varlistentry> | 
|---|
|  | 154 |  | 
|---|
|  | 155 | <varlistentry os="af12"> | 
|---|
|  | 156 | <term><parameter>--with-newlib</parameter></term> | 
|---|
|  | 157 | <listitem> | 
|---|
|  | 158 | <para>Tells configure to build libgcc without needing any C | 
|---|
|  | 159 | libraries.</para> | 
|---|
|  | 160 | </listitem> | 
|---|
|  | 161 | </varlistentry> | 
|---|
|  | 162 |  | 
|---|
|  | 163 | <varlistentry os="af13"> | 
|---|
|  | 164 | <term><parameter>--disable-decimal-float</parameter></term> | 
|---|
|  | 165 | <listitem> | 
|---|
|  | 166 | <para>Tells configure to disable IEEE 754-2008 decimal floating | 
|---|
|  | 167 | point support.  Decimal floating point support isn't needed yet.</para> | 
|---|
|  | 168 | </listitem> | 
|---|
|  | 169 | </varlistentry> | 
|---|
|  | 170 |  | 
|---|
|  | 171 | <varlistentry os="af14"> | 
|---|
|  | 172 | <term><parameter>--disable-libgomp</parameter></term> | 
|---|
|  | 173 | <listitem> | 
|---|
|  | 174 | <para>Tells configure to not build the GOMP run-time libraries. | 
|---|
|  | 175 | GOMP is the GNU implementation of OpenMP, a API for shared-memory | 
|---|
|  | 176 | parallel programming.</para> | 
|---|
|  | 177 | </listitem> | 
|---|
|  | 178 | </varlistentry> | 
|---|
|  | 179 |  | 
|---|
|  | 180 | <varlistentry os="af15"> | 
|---|
|  | 181 | <term><parameter>--disable-libmudflap</parameter></term> | 
|---|
|  | 182 | <listitem> | 
|---|
|  | 183 | <para>Tells configure to not build libmudflap.  Mudflap is a | 
|---|
|  | 184 | library that can be used to help check for proper pointer usage.</para> | 
|---|
|  | 185 | </listitem> | 
|---|
|  | 186 | </varlistentry> | 
|---|
|  | 187 |  | 
|---|
|  | 188 | <varlistentry os="af16"> | 
|---|
|  | 189 | <term><parameter>--disable-libssp</parameter></term> | 
|---|
|  | 190 | <listitem> | 
|---|
|  | 191 | <para>Tells configure not to build run-time libraries for stack | 
|---|
|  | 192 | smashing detection.</para> | 
|---|
|  | 193 | </listitem> | 
|---|
|  | 194 | </varlistentry> | 
|---|
|  | 195 |  | 
|---|
|  | 196 | <varlistentry os="af17"> | 
|---|
| [a9e389d] | 197 | <term><parameter>--disable-threads</parameter></term> | 
|---|
|  | 198 | <listitem> | 
|---|
|  | 199 | <para>This will prevent GCC from looking for the multi-thread | 
|---|
|  | 200 | include files, since they haven't been created for this architecture | 
|---|
|  | 201 | yet. GCC will be able to find the multi-thread information after | 
|---|
| [f704d3f] | 202 | the glib headers are created.</para> | 
|---|
| [a9e389d] | 203 | </listitem> | 
|---|
|  | 204 | </varlistentry> | 
|---|
|  | 205 |  | 
|---|
| [f704d3f] | 206 | <varlistentry os="af18"> | 
|---|
| [a9e389d] | 207 | <term><parameter>--enable-languages=c</parameter></term> | 
|---|
|  | 208 | <listitem> | 
|---|
|  | 209 | <para>This option ensures that only the C compiler is built.</para> | 
|---|
|  | 210 | </listitem> | 
|---|
|  | 211 | </varlistentry> | 
|---|
|  | 212 |  | 
|---|
| [0f33b23] | 213 | <varlistentry os="af19"> | 
|---|
|  | 214 | <term><parameter>--disable-multilib</parameter></term> | 
|---|
|  | 215 | <listitem> | 
|---|
|  | 216 | <para>This option specifies that multiple target libraries should | 
|---|
|  | 217 | not be built.</para> | 
|---|
|  | 218 | </listitem> | 
|---|
|  | 219 | </varlistentry> | 
|---|
|  | 220 |  | 
|---|
| [a9e389d] | 221 | </variablelist> | 
|---|
|  | 222 |  | 
|---|
| [ae51e2a] | 223 | <para os="ah">Continue with compiling the package:</para> | 
|---|
| [a9e389d] | 224 |  | 
|---|
| [ae51e2a] | 225 | <screen os="ai"><userinput>make all-gcc all-target-libgcc</userinput></screen> | 
|---|
| [a9e389d] | 226 |  | 
|---|
| [ae51e2a] | 227 | <para os="aj">Install the package:</para> | 
|---|
| [a9e389d] | 228 |  | 
|---|
| [ae51e2a] | 229 | <screen os="ak"><userinput>make install-gcc install-target-libgcc</userinput></screen> | 
|---|
| [a9e389d] | 230 |  | 
|---|
|  | 231 | </sect2> | 
|---|
|  | 232 |  | 
|---|
|  | 233 | <sect2 role="content"> | 
|---|
|  | 234 | <title/> | 
|---|
|  | 235 |  | 
|---|
|  | 236 | <para>Details on this package are located in <xref | 
|---|
|  | 237 | linkend="contents-gcc" role="."/></para> | 
|---|
|  | 238 |  | 
|---|
|  | 239 | </sect2> | 
|---|
|  | 240 |  | 
|---|
|  | 241 | </sect1> | 
|---|