Using ccache on FreeBSD (howto)

ccache is a compiler cache. It speeds up re-compilation of C/C++ code by caching previous compiles and detecting when the same compile is being done again.

The following is a step by step guide to how to enable and use ccache on FreeBSD 7.1:

  1. su
  2. # cd /usr/ports/devel/ccache
  3. # make install clean
  4. # vim /etc/make.conf

.if (!empty(.CURDIR:M/usr/src*) || !empty(.CURDIR:M/usr/obj*)) && !defined(NOCCACHE)

CC=/usr/local/libexec/ccache/world-cc

CXX=/usr/local/libexec/ccache/world-c++

.endif

Basically we’ve started by installing ccache (steps 1 through 3) and proceeded by editing /etc/make.conf as to enable ccache on builds.

Now we need to update the environment.

Further instructions here

Source: linux-bsd-sharing.blogspot.com (19/01/2009)

About Gerard

Gerard is a keen user of open source operating systems and software. On this blog he shares FreeBSD news and links that he comes across.
This entry was posted in FreeBSD and tagged . Bookmark the permalink.

One Response to Using ccache on FreeBSD (howto)

  1. Is ccache very beneficial if you are only really compiling things like ports, where (hopefully) you are only compiling the once? Or does it cache different routines which could be useful with many ports installs?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>