Purpose

The purpose of this exercise is to create a cross-compiler for your Gamecube Linux system. The Cube does not have a lot of RAM which makes compilations costly. It is best to cross-compile on a faster system. This guide will show you the necessary steps to create your compiler. The advantage of my guide is that it uses the sysroot support in the latest GNU tools to allow for easier dynamic linking. You'll be able to link directly with your Cube's libraries from your host system!

Prerequistites

The only prerequistite is that you have a working Gamecube filesystem stored on your system. This is the filesystem that is exported via nfs which your Cube uses as /. The rest of this HOWTO will assume the host system is an i386 system and the Cube's filesystem is stored in /home/gamecube.

Obtain the software

Extract and patch

Extract binutils. Enter the binutils-2.15 directory. Now apply the gekko.patch with the command patch -p2 < gekko.patch.

Extract gcc.

Configure and build binutils-2.15

Enter the binutils-2.15 and directory and configure with this command - ./configure --prefix=/home/gamecube/usr/src/gcc --target=powerpc-gamecube-linux-gnu --with-sysroot=/home/gamecube.
Substitute --prefix with the installation directory where you want your cross-compiler to go. Substitute --with-sysroot with whatever directory you have for your Cube's root filesystem. In this example, the Cube's root is /home/gamecube and I want to install the cross-compiler into /home/gamecube/usr/src/gcc.
Now execute make followed by make install.

Configure and build gcc

Enter the gcc directory and configure with this command - ./configure --prefix=/home/gamecube/usr/src/gcc --target=powerpc-gamecube-linux-gnu --with-cpu=750 --enable-languages="c,c++" --disable-nls --enable-threads=posix --enable-long-long --with-gnu-ld --with-gnu-as --enable-static --with-sysroot=/home/gamecube.
Remember the substitute the paths accordingly.
Now execute make followed by make install

Completion

You should now have a working cross-compiler! It will be installed in /home/gamecube/usr/src/gcc. You can change the installation path by altering the --prefix parameter in the above configurations. The name of the executable will be powerpc-gamecube-linux-gnu-gcc. Have fun cross-compiling!