Fast Compiles with distcc

Jeff Wolf

Linux Geek

jeff@iwolfie.com

http://www.gentoo.org/doc/en/distcc.xml

http://distcc.samba.org

Benefits

Makes use of multiple computers for compiles

Breath new life into old hardware

Configuration integrates well with portage

Enhances the benefits of gentoo

Can use all machines to compile binary package and then install to other servers of same arch with all benefits of source based distro.

Installation

“emerge distcc”

Edit /etc/make.conf setting MAKEOPTS=”-jN” where N = 1 | > (2*num_cpus + 1 is good start) and set FEATURES=”distcc”

Use “distcc-config” to setup hosts “distcc-config –set-hosts “192.168.0.2 192.168.0.3””

Start distcc on boot “rc-update add distccd default”

Installation (cont.)

Start distccd “/etc/init.d/distccd start”

To use distcc on manual compiles (applies to other Linux distros) update PATH to “export \ PATH=”/usr/lib/ccache/bin:/usr/lib/distcc/bin:${PATH}”

Create distcc user in /etc/passwd “echo \ “distcc:x:240:2:distccd:/dev/null:/bin/false” >> /etc/passwd”

Commands

“emerge package” - everything is automatic, uses distcc by default

“USE=”-distcc” FEATURES=”-distcc” emerge package” Turns off distcc for that package build.

To use distcc with normal “make” builds your path has to be setup correctly as noted on last slide and you have to include “-jN” after make.

If you don't want to use distcc for every package don't permanently update your PATH just set when you want to use it. (small bash script is perfect for this for us with bad memory :) )

Cross-Compiling

Please see http://dev.gentoo.org/~vapier/CROSS-COMPILE-HOWTO

Cross-compiling is a little more involved.

Link has specific Gentoo instructions.

What about other linux distros? You need a cross-compiler for your distro and has to be on all of your distcc hosts.

Monitor

To monitor progress “DISTCC_DIR=”/var/tmp/portage/.distcc/” distccmon-gnome” or text version “DISTCC_DIR=”/var/tmp/portage/.distcc/” distccmon-text N” where N equals to update interval (in seconds)

Summary

Distcc is very cool

Makes source based distro very attractive for corporate environment (like gentoo :) )

Can use distcc to build out binary for rest of alike servers.

If you are concerned with a task that runs at a particular time (backups) just stop the daemon, and you won't participate in the distcc goodness.

Some packages don't like to be compiled with distcc :(

2005-05-05T10:07:43