[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 | |
---|
[8f65e24] | 13 | <title>GCC-&gcc-version; - Static</title> |
---|
[a9e389d] | 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 |
---|
[c4b2364] | 24 | the C compiler. This build of GCC is mainly done so that the C library |
---|
| 25 | can be built next.</para> |
---|
[a9e389d] | 26 | |
---|
| 27 | </sect2> |
---|
| 28 | |
---|
| 29 | <sect2 role="installation"> |
---|
[ae51e2a] | 30 | <title os="a">Installation of Cross GCC Compiler with Static libgcc |
---|
[a9e389d] | 31 | and no Threads</title> |
---|
| 32 | |
---|
[8a77fbd] | 33 | <para os="b">GCC requires the GMP, MPFR, and MPC packages to either be |
---|
| 34 | present on the host or to be present in source form within the gcc source |
---|
| 35 | tree. Unpack these into the GCC directory after unpacking GCC:</para> |
---|
| 36 | |
---|
| 37 | <screen os="ba"><userinput>tar xf ../mpfr-&mpfr-version;.tar.bz2 |
---|
| 38 | mv -v mpfr-&mpfr-version; mpfr |
---|
| 39 | tar xf ../gmp-&gmp-version;.tar.bz2 |
---|
| 40 | mv -v gmp-&gmp-version; gmp |
---|
| 41 | tar xf ../mpc-&mpc-version;.tar.gz |
---|
| 42 | mv -v mpc-&mpc-version; mpc</userinput></screen> |
---|
| 43 | |
---|
[a9e389d] | 44 | <para os="c">The GCC documentation recommends building GCC outside of the source |
---|
| 45 | directory in a dedicated build directory:</para> |
---|
| 46 | |
---|
| 47 | <screen os="d"><userinput>mkdir -v ../gcc-build |
---|
| 48 | cd ../gcc-build</userinput></screen> |
---|
| 49 | |
---|
| 50 | <para os="e">Prepare GCC for compilation:</para> |
---|
| 51 | |
---|
[ae51e2a] | 52 | <!-- This is the common configure line for GCC-Static. --> |
---|
| 53 | <!-- It's not actually used by any arch but is here for reference. --> |
---|
[146587b] | 54 | <screen os="ae"><userinput>../gcc-&gcc-version;/configure \ |
---|
[54fde8f] | 55 | --prefix=${CLFS}/cross-tools \ |
---|
| 56 | --build=${CLFS_HOST} \ |
---|
| 57 | --host=${CLFS_HOST} \ |
---|
| 58 | --target=${CLFS_TARGET} \ |
---|
[94e2400] | 59 | --with-sysroot=${CLFS}/cross-tools/${CLFS_TARGET} \ |
---|
[54fde8f] | 60 | --disable-nls \ |
---|
| 61 | --disable-shared \ |
---|
| 62 | --without-headers \ |
---|
| 63 | --with-newlib \ |
---|
| 64 | --disable-decimal-float \ |
---|
| 65 | --disable-libgomp \ |
---|
| 66 | --disable-libmudflap \ |
---|
| 67 | --disable-libssp \ |
---|
[6368159] | 68 | --disable-libatomic \ |
---|
| 69 | --disable-libquadmath \ |
---|
[54fde8f] | 70 | --disable-threads \ |
---|
| 71 | --enable-languages=c \ |
---|
[5f18bea] | 72 | --disable-multilib \ |
---|
| 73 | --with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src \ |
---|
| 74 | --with-mpfr-lib=$(pwd)/mpfr/src/.libs</userinput></screen> |
---|
[a9e389d] | 75 | |
---|
| 76 | <variablelist os="af"> |
---|
| 77 | <title>The meaning of the configure options:</title> |
---|
| 78 | |
---|
[f704d3f] | 79 | <varlistentry os="af1"> |
---|
| 80 | <term><parameter>--prefix=${CLFS}/cross-tools</parameter></term> |
---|
| 81 | <listitem> |
---|
| 82 | <para>This tells the configure script to prepare to install the |
---|
| 83 | package in the <filename class="directory">${CLFS}/cross-tools</filename> |
---|
| 84 | directory.</para> |
---|
| 85 | </listitem> |
---|
| 86 | </varlistentry> |
---|
| 87 | |
---|
| 88 | <varlistentry os="af2"> |
---|
| 89 | <term><parameter>--build=${CLFS_HOST}</parameter></term> |
---|
| 90 | <listitem> |
---|
| 91 | <para>This tells the configure script the triplet to use to build GCC. |
---|
| 92 | It will use ${CLFS_HOST} as that's where it's being built.</para> |
---|
| 93 | </listitem> |
---|
| 94 | </varlistentry> |
---|
| 95 | |
---|
| 96 | <varlistentry os="af3"> |
---|
| 97 | <term><parameter>--host=${CLFS_HOST}</parameter></term> |
---|
| 98 | <listitem> |
---|
| 99 | <para>This tells the configure script the triplet of the machine GCC |
---|
| 100 | will be executed on when actually cross compiling. It will use |
---|
| 101 | ${CLFS_HOST} as that's where GCC will execute when cross compiling |
---|
| 102 | software later.</para> |
---|
| 103 | </listitem> |
---|
| 104 | </varlistentry> |
---|
| 105 | |
---|
| 106 | <varlistentry os="af4"> |
---|
| 107 | <term><parameter>--target=${CLFS_TARGET}</parameter></term> |
---|
| 108 | <listitem> |
---|
| 109 | <para>This tells the configure script the triplet of the machine GCC |
---|
| 110 | will build executables for. It will use ${CLFS_TARGET} so that software |
---|
| 111 | compiled with this version of GCC can be executed on the embedded machine |
---|
| 112 | target.</para> |
---|
| 113 | </listitem> |
---|
| 114 | </varlistentry> |
---|
| 115 | |
---|
| 116 | <varlistentry os="af5"> |
---|
[94e2400] | 117 | <term><parameter>--with-sysroot=${CLFS}/cross-tools/${CLFS_TARGET}</parameter></term> |
---|
[f704d3f] | 118 | <listitem> |
---|
[94e2400] | 119 | <para>This tells configure that ${CLFS}/cross-tools/${CLFS_TARGET} is going |
---|
[13d7c4f] | 120 | to be the temporary root of our system. It will now use the specified |
---|
| 121 | sysroot as a prefix of the default search paths.</para> |
---|
[f704d3f] | 122 | </listitem> |
---|
| 123 | </varlistentry> |
---|
| 124 | |
---|
| 125 | <varlistentry os="af6"> |
---|
| 126 | <term><parameter>--disable-nls</parameter></term> |
---|
| 127 | <listitem> |
---|
| 128 | <para>This disables internationalization as i18n is not needed for the |
---|
| 129 | cross-compile tools.</para> |
---|
| 130 | </listitem> |
---|
| 131 | </varlistentry> |
---|
| 132 | |
---|
| 133 | <varlistentry os="af7"> |
---|
[a9e389d] | 134 | <term><parameter>--disable-shared</parameter></term> |
---|
| 135 | <listitem> |
---|
| 136 | <para>Disables the creation of the shared libraries.</para> |
---|
| 137 | </listitem> |
---|
| 138 | </varlistentry> |
---|
| 139 | |
---|
[f704d3f] | 140 | <varlistentry os="af11"> |
---|
| 141 | <term><parameter>--without-headers</parameter></term> |
---|
| 142 | <listitem> |
---|
| 143 | <para>Tells configure to not use any headers from any C libraries. |
---|
| 144 | This is needed as we haven't yet built the C library and to prevent |
---|
| 145 | influence from the host environment.</para> |
---|
| 146 | </listitem> |
---|
| 147 | </varlistentry> |
---|
| 148 | |
---|
| 149 | <varlistentry os="af12"> |
---|
| 150 | <term><parameter>--with-newlib</parameter></term> |
---|
| 151 | <listitem> |
---|
| 152 | <para>Tells configure to build libgcc without needing any C |
---|
| 153 | libraries.</para> |
---|
| 154 | </listitem> |
---|
| 155 | </varlistentry> |
---|
| 156 | |
---|
| 157 | <varlistentry os="af13"> |
---|
| 158 | <term><parameter>--disable-decimal-float</parameter></term> |
---|
| 159 | <listitem> |
---|
| 160 | <para>Tells configure to disable IEEE 754-2008 decimal floating |
---|
| 161 | point support. Decimal floating point support isn't needed yet.</para> |
---|
| 162 | </listitem> |
---|
| 163 | </varlistentry> |
---|
| 164 | |
---|
| 165 | <varlistentry os="af14"> |
---|
| 166 | <term><parameter>--disable-libgomp</parameter></term> |
---|
| 167 | <listitem> |
---|
| 168 | <para>Tells configure to not build the GOMP run-time libraries. |
---|
| 169 | GOMP is the GNU implementation of OpenMP, a API for shared-memory |
---|
| 170 | parallel programming.</para> |
---|
| 171 | </listitem> |
---|
| 172 | </varlistentry> |
---|
| 173 | |
---|
| 174 | <varlistentry os="af15"> |
---|
| 175 | <term><parameter>--disable-libmudflap</parameter></term> |
---|
| 176 | <listitem> |
---|
| 177 | <para>Tells configure to not build libmudflap. Mudflap is a |
---|
| 178 | library that can be used to help check for proper pointer usage.</para> |
---|
| 179 | </listitem> |
---|
| 180 | </varlistentry> |
---|
| 181 | |
---|
| 182 | <varlistentry os="af16"> |
---|
| 183 | <term><parameter>--disable-libssp</parameter></term> |
---|
| 184 | <listitem> |
---|
| 185 | <para>Tells configure not to build run-time libraries for stack |
---|
| 186 | smashing detection.</para> |
---|
| 187 | </listitem> |
---|
| 188 | </varlistentry> |
---|
| 189 | |
---|
| 190 | <varlistentry os="af17"> |
---|
[6368159] | 191 | <term><parameter>--disable-libatomic</parameter></term> |
---|
| 192 | <listitem> |
---|
| 193 | <para>Tells configure not to build atomic operations.</para> |
---|
| 194 | </listitem> |
---|
| 195 | </varlistentry> |
---|
| 196 | |
---|
| 197 | <varlistentry os="af18"> |
---|
| 198 | <term><parameter>--disable-libquadmath</parameter></term> |
---|
| 199 | <listitem> |
---|
| 200 | <para>Tells configure not to build quad math operations.</para> |
---|
| 201 | </listitem> |
---|
| 202 | </varlistentry> |
---|
| 203 | |
---|
| 204 | <varlistentry os="af19"> |
---|
[a9e389d] | 205 | <term><parameter>--disable-threads</parameter></term> |
---|
| 206 | <listitem> |
---|
| 207 | <para>This will prevent GCC from looking for the multi-thread |
---|
| 208 | include files, since they haven't been created for this architecture |
---|
| 209 | yet. GCC will be able to find the multi-thread information after |
---|
[ee335b8] | 210 | the glibc headers are created.</para> |
---|
[a9e389d] | 211 | </listitem> |
---|
| 212 | </varlistentry> |
---|
| 213 | |
---|
[6368159] | 214 | <varlistentry os="af20"> |
---|
[a9e389d] | 215 | <term><parameter>--enable-languages=c</parameter></term> |
---|
| 216 | <listitem> |
---|
| 217 | <para>This option ensures that only the C compiler is built.</para> |
---|
| 218 | </listitem> |
---|
| 219 | </varlistentry> |
---|
| 220 | |
---|
[5f18bea] | 221 | <varlistentry os="af21"> |
---|
| 222 | <term><parameter>--disable-multilib</parameter></term> |
---|
| 223 | <listitem> |
---|
| 224 | <para>This option specifies that multiple target libraries should |
---|
| 225 | not be built.</para> |
---|
| 226 | </listitem> |
---|
| 227 | </varlistentry> |
---|
| 228 | |
---|
| 229 | <varlistentry os="af22"> |
---|
| 230 | <term><parameter>--with-mpfr-include=$(pwd)/../gcc-&gcc-version;/mpfr/src</parameter></term> |
---|
| 231 | <listitem> |
---|
| 232 | <para>Tells configure how to find the mpfr headers.</para> |
---|
| 233 | </listitem> |
---|
| 234 | </varlistentry> |
---|
| 235 | |
---|
| 236 | <varlistentry os="af23"> |
---|
| 237 | <term><parameter>--with-mpfr-lib=$(pwd)/mpfr/src/.libs</parameter></term> |
---|
| 238 | <listitem> |
---|
| 239 | <para>Tells configure to use the mpfr libraries built within the GCC |
---|
| 240 | build directory. This happens automatically but is needed to |
---|
| 241 | prevent GCC from searching the host's normal library paths.</para> |
---|
| 242 | </listitem> |
---|
| 243 | </varlistentry> |
---|
[0f33b23] | 244 | |
---|
[a9e389d] | 245 | </variablelist> |
---|
| 246 | |
---|
[ae51e2a] | 247 | <para os="ah">Continue with compiling the package:</para> |
---|
[a9e389d] | 248 | |
---|
[ae51e2a] | 249 | <screen os="ai"><userinput>make all-gcc all-target-libgcc</userinput></screen> |
---|
[a9e389d] | 250 | |
---|
[ae51e2a] | 251 | <para os="aj">Install the package:</para> |
---|
[a9e389d] | 252 | |
---|
[ae51e2a] | 253 | <screen os="ak"><userinput>make install-gcc install-target-libgcc</userinput></screen> |
---|
[a9e389d] | 254 | |
---|
| 255 | </sect2> |
---|
| 256 | |
---|
| 257 | <sect2 role="content"> |
---|
| 258 | <title/> |
---|
| 259 | |
---|
| 260 | <para>Details on this package are located in <xref |
---|
| 261 | linkend="contents-gcc" role="."/></para> |
---|
| 262 | |
---|
| 263 | </sect2> |
---|
| 264 | |
---|
| 265 | </sect1> |
---|