Gentoo and distcc

From LQWiki
Jump to: navigation, search

Gentoo can take advantage of distcc to speed up compilation of packages by sharing compilation accross many machines also running distcc.

Installation of distcc

Start by installing distcc using the command

emerge -av distcc

Editing /etc/make.conf

Add distcc to the FEATURES flag in /etc/make.conf, for example:

FEATURES="distcc"

Also the MAKEOPTS setting should be tweaked, for example:

MAKEOPTS="-jX"

Where X is typically twice the number of CPUs, hence twice the number of machines you plan to run distcc on unless you are using machines with more than one CPU. (NOTE: leave anyother options present in MAKEOPTS)

Using with Paludis

If you'd like Paludis to take advantage of distcc then add the following lines to your /etc/paludis/bashrc file making sure to change the host names:

export DISTCC_DIR="/var/tmp/paludis/.distcc"
export PATH="/usr/lib/distcc/bin:${PATH}"
export CC="/usr/lib/distcc/bin/gcc"
export CXX="/usr/lib/distcc/bin/g++"
export DISTCC_HOSTS="localhost another_host"

Adding distcc hosts

To add the distcc servers to the list of machines participating in the build:

distcc-config --set-hosts "foo"

foo can be a list of ip addresses and/or hostnames which are running distcc. Also if the machine your running is to participate in the build then add localhost to the list of machines.

Security

You should edit the file /etc/conf.d/distcc to only allow the configured distcc servers for security reasons.

Starting distcc

Add distcc to the default runlevel on each gentoo machine so when you boot the service is available:

rc-update add distccd default

and start with the command:

/etc/init.d/distccd start

References

See also


External Links