When considering a project involving a large number of source files, compilation time is always an issue. DistCC is in these cases a very good solution. From DistCC site:
distcc is a program to distribute builds of C, C++, Objective C or Objective C++ code across several machines on a network. distcc should always generate the same results as a local build, is simple to install and use, and is usually much faster than a local compile</blockquote> My problem was how to keep the $DISTCC_HOSTS variable updated, since computers in my lab never seam to be left alone (after all… this is a lab :) ).
My idea was therefore to use AVAHI and to come up with a simple unix pipe that would feed the $DISTCC_DIR/hosts file.
Here is my hack:
- created /etc/avahi/services/distcc.service:
- Install distcc and avahi-utils
- edit /etc/defaultdistcc accordingly
- add the following command to crontab:
That’s it!
There is also a patch available for distcc to integrate avahi functionality in a more robust manner (for instance by hack will cause problems when compiling during the update of the file), but I didn’t want to patch my Ubuntu distcc version. Best of all it is much easier to distribute the distcc.service file then a patched version of distcc ;).