Cross-compiling using distcc

From gc-linux

Jump to: navigation, search



This page describes a novel technique that eliminates some of the complexity of normal cross-compiling. A classic problem with cross-compiling software for Unix-like systems is that many of the build systems (particularly the GNU auto tools) run small test programs as part of the build system to check for specific features or bugs. Traditional cross-compilation environments do not allow these programs to run and the builds therefore fail. Using distcc allows the build system to be run on the GameCube while delegating the actual compilation to a more powerful machine. This hybrid combines the convenience of local builds without the delays (sometimes many hours for a complex C file) associated with compling on the GameCube.


  • Faster compiling than on strictly a Gamecube.

Example of compiling SDL-1.2.8 without distcc

time make
real    22m7.788s
user    2m51.999s
sys     0m51.555s

Compiling SDL-1.2.8 with distcc

time make -j2 CC="distcc powerpc-unknown-linux-gnu-gcc"
real    5m7.033s
user    0m59.627s
sys     0m49.935s
  • Typically less problems then with attempting to strictly cross compile since configure scripts run natively.


  • Need a Linux that is already setup to run on a GameCube.
  • Doesn't eliminate need to build cross compiler. [Well, it's not really a con, but should be noted.]

TODO Cleanup these two sections below

Host Side

Host side is quite easy to do to be honest.

  • Install distcc.
  • Run: distccd --daemon --allow

where is the IP of the GameCube

That's it really, distccd has a few other options, but nothing worth mentioning. The nice thing is that you don't need root privileges to run distccd. Remember that the cross compiler must be in your PATH when you start up distccd.

Also remeber, The compiler should be named on both GameCube and the host. If your GameCube's compiler is powerpc-linux-uclibc-gcc, the host cross compiler should also be powerpc-linux-uclibc-gcc.

Client Side

Here is what you do for the client:

  • Install distcc for the GameCube.
  • Run: export DISTCC_HOSTS='hostname localhost'

You don't have to have localhost if you don't want to. If you're going to use this often, you should put it in your login script.

  • Now test by running "distcc powerpc-linux-uclibc-gcc -c test.c" on this file (test.c): int main() {}

It shouldn't give any errors.

  • To compile projects with makefiles you typically can do: make -j2 CC="distcc powerpc-linux-uclibc-gcc"

What I do is:

echo 'make -j2 CC="distcc powerpc-linux-uclibc-gcc" $@' > /usr/bin/makedistcc
chmod +x /usr/bin/makedistcc

That way I can just call makedistcc. You could also use an alias put into your login script.

Personal tools