ccache is a software development tool that caches the output of C/C++ compilation so that the next time, the same compilation can be avoided and the results can be taken from the cache. This can greatly speed up recompiling time.
The following is a step by step guide to how to enable and use ccache on FreeBSD 8.2.
Install ccache by running the following command:
make install clean -C /usr/ports/devel/ccache
Update /etc/make.conf by adding the following lines:
Basically we've started by installing ccache and proceeded by editing /etc/make.conf as to enable ccache on builds.
Now we need to update the environment.
If you are using csh/tcsh shell add the following to /root/.cshrc:
setenv PATH /usr/local/libexec/ccache:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR /var/tmp/ccache
setenv CCACHE_LOGFILE /var/log/ccache.log
If you are using zsh add the following to your /root/.zshrc file:
If you are using bash add the following to your /root/.profile file:
After updating the dotfiles we update the environment. Users of csh/tcsh shells can update by:
Users of zsh can update the environment by running the following command:
Anyone using bash can update the environment by running the following command:
ccache is installed and the environment is updated. Your next build will be performed with ccache enabled.
To display statistics summary:
To zero statistics:
To set ccache temp size (for example 512MB):
/usr/local/bin/ccache -M 512m
To check out the help file for a list of ccache options:
If you come across a port that fails to build, disable ccache and try again:
make NO_CCACHE=yes install clean
You can find more information regarding ccache through:
links /usr/local/share/doc/ccache/index.htmlPrint This Post