8.4 Using Ccache

Another excellent way of accelerating builds is to use the compiler cache, “ccache”. To use ccache support, you must first create a tar file with ccache and various symlinks within a /opt/ directory. Your tarball contents should be:

opt
opt/ccache
opt/gcc -> ccache
opt/cc -> ccache
opt/g++ -> ccache
opt/c++ -> ccache

This tarball must be called ccache.tar, and be placed in the Jail directory for each Jail that will use ccache (e.g. ${pb}/jails/8.2).

Once the tarball is created, run (-e for enabling, -d for disabling, -c specifies directory, -s maximal size):

# ./tc configCcache -e -c /ccache -s 2G

Then run your builds as you normally would. To debug ccache, add -l /ccache.log switch to the command.

Then, in the root of each build directory, there will be a ccache.log that will let you know if the cache is working.