04 January 2006

Debian Kernel with distcc

Debian with distccUsing distcc with debian

distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code across several machines on a network. distcc is often two or more times faster than a local compile which makes it excellent for performing compiling kernels and other things on slow machines.

distcc however is a little harder than normal to get working with debian's kernel-package tool.

The purpose of this howto is to guide someone though the process of getting distcc to work with make-kpkg on a debian system.

Getting distcc for debian

This is rather trivial.

 apt-get install distcc

There are also a graphical distcc monitoring tool which can be installed as follows:

apt-get install distccmon-gnome

Preparing your debian for using make-kpkg with distcc

You need to set up what the distcc man page refers to as a "masquerade directory" which contains symlinks from the name of the real compiler to the distcc binary. This directory is inserted early on the PATH, so that calls to the compiler are intercepted and distcc is run instead. distcc then removes itself from the PATH to find the real compiler.

This done by performing the following steps:

mkdir -p /usr/local/distcc/bin
cd /usr/local/distcc/bin
ln -s /usr/bin/distcc c++
ln -s /usr/bin/distcc cc
ln -s /usr/bin/distcc g++
ln -s /usr/bin/distcc gcc

You now need to add the new /usr/local/distcc/bin directory to the start of your $PATH variable which is outlined in the next step.

Configuring your environment

distcc functions primarily on some environment variables which can be added to your $HOME/.bashrc file as defined below:

CONCURRENCY_LEVEL=40
DISTCC_HOSTS="localhost tokra sokar alkesh osiris"
PATH="/usr/local/distcc/bin:${PATH}"
export CONCURRENCY_LEVEL DISTCC_HOSTS PATH

What do these variables do?

CONCURRENCY_LEVEL=40 

This tells make-kpkg how many jobs to send off to the compiler (distcc)

DISTCC_HOSTS="localhost tokra sokar alkesh osiris" 

Tells distcc which machines to use for distributing jobs to. The host list is a simple whitespace separated list of hostnames. distcc prefers hosts towards the start of the list, so machines should be listed in descending order of speed. It is important that you place localhost at the right point in the list to get the best performance.

If your machine is slower than the other hosts in the list then you place it later in the list or not at all as it will slow the distribution of the jobs to the faster hosts. If however your machine is faster than the volunteers, you should place localhost towards the beginning of the list

PATH="/usr/local/distcc:${PATH}" 

This places /usr/local/distcc/bin early in the PATH so that the calls to the compiler are intercepted by the symlinks to distcc instead of the compiler itself. distcc will then distribute jobs to the host listed in DISTCC_HOSTS= and compiled using the real compilers.

you can see original link here

Thanks
Apenguin

No comments: