Setup and Configure distcc in Gentoo
The first thing you'll want to do is get distcc installed. Make sure you have the newest Portage tree by running emerge sync as root if you haven't done this already. Now, to install distcc, run emerge distcc. Optionally, to see what will be installed, you may run emerge -p distcc.
Once distcc is installed, you need to configure it. Put these options into your /etc/make.conf:
FEATURES="-sandbox distcc"
Disable sandbox, which tends to cause issues with distcc, and enable distcc for use when emerging packages
CC="distcc"
Set the C compiler variable to distcc (all C compile jobs go through distcc)
CXX="distcc g++"
Set the C++ compiler variable to distcc (all C++ compile jobs go through distcc)
MAKEOPTS="-j4"
Specifies the way in which distcc splits up the jobs. You should replace the number four with a number slightly higher than the number of CPUs participating. If you've got five uniprocessor machines including the server, set this number to at least six.
DISTCC_HOSTS="localhost 192.168.1.10 192.168.1.11 ...
The hosts that will be participating in compilation. localhost ensures that the server itself does compilation.
DISTCC_VERBOSE=1
Set the verbosity of distcc. 0 is silent.
DISTCC_LOG="/var/log/distcc.log"
Log distcc's actions to the specified log file. Useful to check out what's happening.
DISTCC_DIR=${PORTAGE_TMPDIR}/portage/.distcc
The temp directory distcc uses.
Next, in your /etc/env.d/05gcc:
These two lines exist uncommented, and they act as variables for the default C and C++ compilers. When you comment these out (by placing # in front of them), Gentoo will use what's specified in the /etc/make.conf file.
Now run env-update to save these changes and distcc to start up the daemon. I also like to have distcc run by default when the system comes up:
When you next emerge a program, distcc will distribute compilation to other machines specified in DISTCC_HOSTS. For more info, check out the official Gentoo doc on distcc.
Questions? Comments?
Once distcc is installed, you need to configure it. Put these options into your /etc/make.conf:
FEATURES="-sandbox distcc"
CC="distcc"
CXX="distcc g++"
MAKEOPTS="-j4"
DISTCC_HOSTS="localhost 192.168.1.10 192.168.1.11 ..."
DISTCC_VERBOSE=1
DISTCC_LOG="/var/log/distcc.log"
DISTCC_DIR=${PORTAGE_TMPDIR}/portage/.distcc
CC="distcc"
CXX="distcc g++"
MAKEOPTS="-j4"
DISTCC_HOSTS="localhost 192.168.1.10 192.168.1.11 ..."
DISTCC_VERBOSE=1
DISTCC_LOG="/var/log/distcc.log"
DISTCC_DIR=${PORTAGE_TMPDIR}/portage/.distcc
FEATURES="-sandbox distcc"
Disable sandbox, which tends to cause issues with distcc, and enable distcc for use when emerging packages
CC="distcc"
Set the C compiler variable to distcc (all C compile jobs go through distcc)
CXX="distcc g++"
Set the C++ compiler variable to distcc (all C++ compile jobs go through distcc)
MAKEOPTS="-j4"
Specifies the way in which distcc splits up the jobs. You should replace the number four with a number slightly higher than the number of CPUs participating. If you've got five uniprocessor machines including the server, set this number to at least six.
DISTCC_HOSTS="localhost 192.168.1.10 192.168.1.11 ...
The hosts that will be participating in compilation. localhost ensures that the server itself does compilation.
DISTCC_VERBOSE=1
Set the verbosity of distcc. 0 is silent.
DISTCC_LOG="/var/log/distcc.log"
Log distcc's actions to the specified log file. Useful to check out what's happening.
DISTCC_DIR=${PORTAGE_TMPDIR}/portage/.distcc
The temp directory distcc uses.
Next, in your /etc/env.d/05gcc:
#CC="gcc"
#CXX="g++"
#CXX="g++"
These two lines exist uncommented, and they act as variables for the default C and C++ compilers. When you comment these out (by placing # in front of them), Gentoo will use what's specified in the /etc/make.conf file.
Now run env-update to save these changes and distcc to start up the daemon. I also like to have distcc run by default when the system comes up:
rc-update add distcc default
When you next emerge a program, distcc will distribute compilation to other machines specified in DISTCC_HOSTS. For more info, check out the official Gentoo doc on distcc.
Questions? Comments?
