%general-entities; ]> Toolchain ToolChain cross tools <para>This section combines Binutils, GCC, GMP, and MPFR packages to create a clean toolchain.</para> </sect2> <sect2 role="installation"> <title>Installation of our Toolchain We are going to extract all the files needed to create our toolchain: tar -jxf ../gcc-&gcc-version;.tar.bz2 tar -jxf ../binutils-&binutils-version;.tar.bz2 tar -jxf ../mfpr-&mpfr-version;.tar.bz2 tar -jxf ../gmp-&gmp-version;.tar.bz2 We are going to create a combined directory for or build: mkdir -pv sysroot-toolchain cd gcc-&gcc-version;; tar -c * | \ ( cd ../sysroot-toolchain ; tar xf - ) cd ../binutils-&binutils-version;; tar -c * | \ ( cd ../sysroot-toolchain ; tar xf - ) cd ../sysroot-toolchain mv ../mpfr-&mpfr-version; ./mpfr mv ../gmp-&gmp-version; ./gmp This ensures by default the compiler will look in /tools/lib/../lib or /tools/lib/../lib64 as appropriate: echo " #undef STANDARD_STARTFILE_PREFIX_1 #undef STANDARD_STARTFILE_PREFIX_2 #define STANDARD_STARTFILE_PREFIX_1 \"/tools/lib/\" #define STANDARD_STARTFILE_PREFIX_2 \"\"" >> gcc/config/linux.h Finally, disable in configure, so it doesn't pick up the host's header files: cp -v configure{,.orig} sed -e '/FLAGS_FOR_TARGET.*\/lib\//s@-B[^ ]*/lib/@@g' configure.orig > \ configure AR=ar AS=as ../sysroot-toolchain/configure \ --with-sysroot=${CLFS} --prefix=/cross-tools \ --target=i686-pc-linux-gnu --with-local-prefix=/tools \ --without-headers --with-newlib --disable-nls \ --disable-shared --disable-decimal-float --disable-libgomp \ --disable-libmudflap --disable-libssp --disable-threads \ --enable-languages=c --enable-64-bit-bfd --with-lib-path=/tools/lib The meaning of the new configure options: --enable-languages=c,c++ This option ensures that only the C and C++ compilers are built. --enable-__cxa_atexit This option allows use of __cxa_atexit, rather than atexit, to register C++ destructors for local statics and global objects and is essential for fully standards-compliant handling of destructors. It also affects the C++ ABI and therefore results in C++ shared libraries and C++ programs that are interoperable with other Linux distributions. --enable-c99 Enable C99 support for C programs. --enable-long-long Enables long long support in the compiler. --enable-threads=posix This enables C++ exception handling for multi-threaded code. Continue with compiling the package: make Install the package: make install <para>Details on this package are located in <xref linkend="contents-gcc" role="."/></para> </sect2> </sect1>