2011-05-07

Speedup compilation with a distcc cross compilation on gentoo

This is a shortened version of the gentoo tutorial on crossdev & distcc.
I made it work between my Xoom running a chrooted gentoo and my i7 desktop machine.

On your slave(s) :

emerge sys-devel/crossdev

in make.conf set PORTDIR_OVERLAY to a your local custom overlay if is not done already like :

PORTDIR_OVERLAY="/usr/local/portage"


Compile the toolchain for the Xoom architecture:
crossdev -s4 --target armv7a-hardfloat-linux-gnueabi
emerge distcc

configure /etc/conf.d/distccd to accept incoming requests from the xoom for example, I also changed the log-level so I can see in the syslog (/var/log/messages) which compilation units are sent to my desktop:
DISTCCD_OPTS="${DISTCCD_OPTS} --allow 192.168.1.0/24"
DISTCCD_OPTS="${DISTCCD_OPTS} --log-level notice"

Start the daemon :
/etc/init.d/distccd start

On the master (Xoom) :
Before starting be sure you have sys-devel/binutils-2.21 or better or you will hit this bug : http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=595649
emerge ">=sys-devel/binutils-2.21"
emerge distcc

in /etc/distcc/hosts:
add the ip of your pc machine ie. 192.168.1.200
remove 127.0.0.1 (No need to run the daemon locally)

in /etc/make.conf add distcc feature:
FEATURE="distcc -userfetch"
MAKEOPTS="-j18" # something like nb of cpu in your farm x2

Don't forget to regenerate your environment :
env-update

emerge something (that compiles in C or C++ ;) ) on your Xoom/master, tail /var/log/messages on the slave to see if the compilation occurs correctly