CRUX : Home

Home :: Documentation :: Download :: Development :: Community :: Wiki :: Ports :: Bugs :: Links :: About

Back to wiki start page

Categories: Ports

Distcc and ccache how to.

Author

Danny Rawlins

Description

Provide a way to distribute and speed up compilations.

Warnings

Do not use native or generic with either -march or -mtune as you'll end up with a bad compile on distcc! This is because each distributed job from the sending node will tell the others to use native or generic and this will make each computer use it's own cpu and arch settings. This is only ever safe if all the nodes run the same cpu and arch. I would advise against it at all costs.

Instructions

Quick guide

This is how I setup distcc and ccache, I will make it more general in time. How to configure distcc and ccache.

Install distcc and ccache:

It is recommended to build in a ram file system to aid in faster compiles, instructions are here.

Enable the contrib repository if not already done, then run this command.

prt-get depinst --install-scripts ccache distcc

Edit the following lines:

Edit /etc/rc.conf and add these lines:

DISTCC_ALLOW='10.0.0.0/28'

Add these lines in /etc/pkgmk.conf:

export DISTCC_HOSTS='localhost/4 foo/4 bar/2'
export PATH="/usr/lib/ccache:$PATH"
export CCACHE_PREFIX='distcc'
export DISTCC_DIR='/var'
export CCACHE_DIR='/var/cache/ccache'
export MAKEFLAGS='-j10'
export SCONSFLAGS="$MAKEFLAGS"

To set this dynamically use

export MAKEFLAGS="/usr/bin/distcc -j 2> /dev/null"

Optional extras

Edit /etc/rc.conf and add the pkgmk user if you are using fakeroot.

DISTCC_USER='pkgmk'

Edit /etc/rc.conf and add this line seting the level of verbose messages to the system log. Default is notice, other levels are critical, error, warning, info, or debug.

DISTCC_LOG_LEVEL='info'