Thursday, July 23, 2009

distcc made easy

The easiest way to set up a simple two machine distcc environment in Ubuntu 9.04.

Quick and dirty

install distcc on both client and server:
sudo apt-get install distcc

On server:
distccd --daemon --allow your_client_ip_address

On client:
export DISTCC_HOSTS='localhost your_server_ip_address'
make -j4 CC=distcc CXX=distcc

Please note the CXX=distc for projects using C++ e.g. Qt ;)

That's all it takes.

Permanent in project

To make distcc more permanent in your Qt project add the following two lines to yous .pro file:
QMAKE_CC = distcc
QMAKE_CXX = distcc

Which qmake will then generate to:
CC = distcc
CXX = distcc
in the make file.

export DISTCC_HOSTS='localhost your_server_ip_address'
make -j4

Visualize progress

To get visual response of what is happening use distccmon-gnome
(sudo apt-get install distccmon-gnome)