Compiling kernels on two machines (was: Rack mount cases)

Mark Purcell mark at purcell.homeip.net
Thu Sep 12 20:06:36 EST 2002


On Wed, Sep 11, 2002 at 08:00:30AM +1000, Alex Satrapa wrote:
> I've tried compiling kernels on two machines here at home.  My fastest 
> machine (500MHz AMD K6-II, 384Mb RAM) allows me to compile kernels in 
> the time it takes me to cook a meal and eat it.  My second-fastest 
> machine (P166, 256Mb RAM) allows me to compile kernels in the time it 
> takes me to cook a meal, eat it, and watch a movie.  Though I guess it 
> might be worth exploring this ccache thing Matthew brought up recently.

Have a look at distcc:

Mark

distcc -- a free distributed C/C++ compiler system
Copyright (C) 2002 by Martin Pool <mbp at samba.org>

$Header: /data/cvs/distcc/README,v 1.7 2002/07/07 11:02:10 mbp Exp $



distcc is a program to distribute compilation of C or C++ code across
several machines on a network. distcc should always generate the same
results as a local compile, is simple to install and use, and is often
significantly faster than a local compile.

Unlike other distributed build systems, distcc does not require all
machines to share a filesystem, have synchronized clocks, or to have
the same libraries or header files installed. Machines can be running
different operating systems, as long as they have compatible binary
formats or cross-compilers. (Currently it is being tested on
gcc-linux-x86 and gcc-freebsd-x86.)

distcc sends the complete preprocessed source code across the network
for each job, so all it requires of the volunteer machines is that
they be running the distccd daemon, and that they have an appropriate
compiler installed.

distcc is not itself a compiler, but rather a front-end to the GNU
C/C++ compiler (gcc), or another compiler of your choice.  All the
regular gcc options and features work as normal.  (Unless there's a
distcc bug, of course. :-)

distcc is designed to be used with GNU make's parallel-build feature
(-j). Shipping files across the network takes time, but few cycles on
the client machine. Any files that can be built remotely are
essentially "for free" in terms of client CPU.

distcc is quite new but has successfully compiled the Linux kernel,
rsync, KDE, Samba and Ethereal, sometimes over twice as fast as a
single machine.

Typical results: building Samba HEAD on a single HP x2000 (1700MHz P4,
1GB) takes 7 minutes, 15 seconds. Using distcc across three such
machines on a 10Mbps hub takes only 3 minutes, 9 seconds (130% faster)
and generates an identical binary.

distcc is distributed under the GNU General Public Licence v2.

distcc makes no attempt to be secure, because security or access
control would detract from the high performance that is its reason for
being.  It should be used only on small networks where everybody with
access to the network is trusted to behave reasonably.

To tell distcc which compile hosts to use, you need to set the
DISTCC_HOSTS environment variable.  At the moment this is just a
space-separated list of hostnames, with the exception that the string
"localhost" (in lowercase) is treated specially.  Repeated hostnames
will make that host proportionally more likely to be chosen.  distcc
should always be called with "make -j", so that compilation can
proceed in parallel across several machines.  You should be generous
in the number of parallel jobs, because the distcc cannot queue
perfectly across all machines.  Using a -j value two or three times
the number of CPUs might work well.

For debugging, you can set the DISTCC_VERBOSE variable; if it's
non-null then you'll see quite a few log messages.

distcc is developed on x86 Debian, and is believed to work on FreeBSD
and Solaris.

For more information, see the manual included in the distribution, or
available from the web site.





More information about the linux mailing list