6.12.1. Installation of GCC Cross Compiler
The GCC documentation recommends building GCC outside of the source
directory in a dedicated build directory:
mkdir -v ../gcc-build
cd ../gcc-build
Prepare GCC for compilation:
Note
If you would like to build a C++ compiler in addition to the C
compiler, change the following --enable-languages=c option to be
--enable-languages=c,c++ instead. A C++ compiler is not required
for any of the software included in this book.
AR=ar LDFLAGS="-Wl,-rpath,${CLFS}/cross-tools/lib" \
../gcc-4.6.0/configure --prefix=${CLFS}/cross-tools \
--build=${CLFS_HOST} --target=${CLFS_TARGET} --host=${CLFS_HOST} \
--with-sysroot=${CLFS} --disable-nls --enable-shared \
--enable-languages=c --enable-c99 --enable-long-long \
--with-mpfr=${CLFS}/cross-tools --with-gmp=${CLFS}/cross-tools \
--with-mpc=${CLFS}/cross-tools --disable-multilib \
--with-abi=${CLFS_ABI} --with-arch=mips${CLFS_MIPS_LEVEL} \
--with-float=${CLFS_FLOAT} --with-endian=${CLFS_ENDIAN}
The meaning of the configure options not used previously:
-
--enable-shared
-
Enables the creation of the shared libraries.
-
--enable-c99
-
Enable C99 support for C programs.
-
--enable-long-long
-
Enables long long support in the compiler.
Continue with compiling the package:
make
Install the package:
make install
Some programs need libgcc_s.so.1 to
be included in the target file system. Copy it to the ${CLFS}/lib directory:
cp -v ${CLFS}/cross-tools/${CLFS_TARGET}/lib/libgcc_s.so.1 ${CLFS}/lib