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