Avahi/Zeroconf patch for distcc updated

Post Syndicated from Lennart Poettering original https://0pointer.net/blog/projects/avahi-distcc.html

I finally found them time to sit down and update my venerable Avahi/Zeroconf patch for
distcc
. A patched distcc
automatically discovers suitable compiler servers on the local network, without
the need to manually configure them. (Announcement).

Here’s a quick HOWTO for using a patched distcc like this:

  • Make sure to start distccd (the server) with the new
    --zeroconf switch, This will make it announce its services on the
    network.
  • Edit your $HOME/.distcc/hosts and add +zeroconf. This
    magic string will enable Zeroconf support in the client, i.e. will be expanded
    to the list of available suitable distcc servers on your LAN.
  • Now set $CC to distcc gcc globally for your login
    sessions. This will tell all well-behaving build systems to use distcc
    for compilation (this doesn’t work for the kernel, as one notable exception).
    Even better than setting $CC to distcc gcc is setting it to
    ccache distcc gcc which will enable ccache in addition to distcc. i.e. stick something like this in your ~/.bash_profile: export CC="ccache distcc gcc"
  • And finally use make -j `distcc -j` instead of plain make
    to enable parallel building with the right number of concurrent processes.
    Setting $MAKEFLAGS properly is an alternative option, however is suboptimal if
    the evalutation is only done once at login time.

If this doesn’t work for you than it is a good idea to run distcc
--show-hosts
to get a list of discovered distcc servers. If this list
isn’t complete then this is most likely due to mismatching GCC versions or
architectures. To check if that’s the case use avahi-browse -r
_distcc._tcp
and compare the values of the cc_machine and
cc_version fields. Please note that different Linux distributions use
different GCC machine strings. Which is expected since GCC is usually patched quite
a bit on the different distributions. This means that a Fedora distcc
(the client) will not find a Debian distccd (the server) and vice
versa. But again: that’s a feature, not a bug.

The new -j and --show-hosts options for distcc are useful for non-zeroconf setups, too.

The patch will automatically discover the number of CPUs on remote machines
and make use of that information to better distribute jobs.

In short: Zeroconf support in distcc is totally hot, everyone should have it!

For more information have a look on the announcement of my original
patch from 2004
(at that time for the historic HOWL Zeroconf daemon), or read the new
announcement linked above.

Distribution packagers! Please merge this new patch into your packages! It
would be a pity to withhold Zeroconf support in distcc from your users any
longer!

Unfortunately, Fedora doesn’t include any distcc packages. Someone should be
changing that (who’s not me ;-)).

You like this patch? Then give me a kudo on ohloh.net. Now that I earned a golden 10 (after kicking Larry Ewing from position 64. Ha, take that Mr. Ewing!), I need to make sure I don’t fall into silver oblivion again. 😉