6.12. GCC-4.6.0 - Cross Compiler Final

The GCC package contains the GNU compiler collection, which includes the C and C++ compilers.

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]

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

6.12.2. Contents of GCC

Installed programs: cc (link to gcc), gcc, gccbug, and gcov
Installed libraries: libgcc.a, libgcc_eh.a, libgcc_s.so, libmudflap.[a,so], and libmudflapth.[a,so]

Short Descriptions

cc

The C compiler

gcc

The C compiler

gccbug

A shell script used to help create useful bug reports

gcov

A coverage testing tool; it is used to analyze programs to determine where optimizations will have the most effect

libgcc

Contains run-time support for gcc

libmudflap

The libmudflap libraries are used by GCC for instrumenting pointer and array dereferencing operations.