ccache 2.4 review

by on

ccache is a compiler cache

License: GPL (GNU General Public License)
File size: 84K
Developer: Andrew Tridgell
0 stars award from

ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations.

The idea came from Erik Thiele wrote the original compilercache program as a bourne shell script. ccache is a re-implementation of Erik's idea in C with more features and better performance.

Why bother with a compiler cache? If you ever run "make clean; make" then you can probably benefit from ccache. It is very common for developers to do a clean build of a project for a whole host of reasons, and this throws away all the information from your previous compiles.

By using ccache you can get exactly the same effect as "make clean; make" but much faster. It also helps a lot when doing RPM builds, as RPM can make doing incremental builds tricky.

I put the effort into writing ccache for 2 reasons. The first is the Samba build farm ( which constantly does clean builds of Samba on about 30 machines after each CVS commit. On some of those machines the build took over an hour. By using ccache we get the same effect as clean builds but about 6 times faster.

The second reason is the autobuild system I used to run for Quantum. That system builds our whole Linux based OS from scratch after every CVS commit to catch compilation problems quickly. Using ccache those builds are much faster.

Here are some key features of "ccache":
keeps statistics on hits/misses
automatic cache size management
can cache compiles that generate warnings
easy installation
very low overhead
uses hard links where possible to avoid copies

What's New in This Release:
fixed handling of hard-linked compilers on AIX
added O_BINARY support, to try and support win32 compiles
show cache directory in stats output
fixed handling of HOME environment variable

ccache 2.4 keywords