Using distcc with your Raspberry Pi

by Gregor Uhlenheuer on April 7, 2013

Compiling and building of portage packages takes quite a while when using the Raspberry Pi. Fortunately there is a nice way to use your main workstation’s (probably much greater) computation power to your Pi’s good: distcc

Diclaimer : This article expects your build servers to run gentoo linux as well and to be configured to cross compile Raspberry Pi compatible ARM (arm6j-hardfloat-linux-gnueabi) binaries. Until I find some time to write a small howto for that you can read the respective gentoo documentation on distcc cross-compiling.

Preparing your build server(s)

At first we are going to prepare all your build servers that should assist your Raspberry Pi during the compilation process.

Install distcc

First you have to install sys-devel/distcc:

$ emerge -av sys-devel/distcc

Configuration

After you have successfully installed distcc on your build server(s) you can adjust the configuration to your likings. The configuration file usually can be found at /etc/conf.d/distcc.

Start the daemon

Now you can start your distcc daemon using the init scripts:

$ /etc/init.d/distccd start

Additionally you may want to add the distcc service to your default runlevel:

$ rc-update add distccd default

Prepare your Raspberry Pi

After you prepared your build server(s) you can move on to setup your Raspberry Pi.

Install distcc

You have to install distcc on your Raspberry Pi as well:

$ emerge -av sys-devel/distcc

Additionally you have to add distcc to your portage features. Edit your make.conf appropriately:

FEATURES="distcc"

List build servers

Now you have to specify which build servers should be taken into account when using distcc. In the /etc/distcc/hosts file you can list all server addresses. The order defines the priorities:

Prepare GCC

Finally you have to tell distcc which compiler has to be used instead of gcc - you can use a wrapper script like this for this purpose:

Now you just have to replace the existing symbolic links like this:

Test your setup

Now that all necessary steps are taken you can test the distcc setup when emerging a cross-compile compatible package.

$ emerge -va htop

You can observe the distcc daemon log on one of your build servers in order to check if your build servers are utilized during the compilation phase:

$ tail -f /var/log/distccd

This post is tagged with gentoo, linux, raspberrypi and distcc