Overview
ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Supported languages are C, C++, Objective-C and Objective-C++.
ccache is free software, released under the GNU General Public License version 3 or later. See also the license page.
Latest news
- 2017-02-17: Version 3.3.4 has been released
- 2016-10-26: Version 3.3.3 has been released
- 2016-09-28: Version 3.3.2 has been released
- 2016-09-28: Version 3.2.9 has been released
- 2016-09-07: Version 3.3.1 has been released
- 2016-09-07: Version 3.2.8 has been released
- 2016-08-27: Version 3.3 has been released
- 2016-07-20: Version 3.2.7 has been released
- 2016-07-12: Version 3.2.6 has been released
- 2016-07-12: Version 3.1.12 has been released
- 2016-06-06: Source code and bug tracker moved to github
- 2016-04-17: Version 3.2.5 has been released
- 2015-10-08: Version 3.2.4 has been released
- 2015-08-16: Version 3.2.3 has been released
- 2015-05-10: Version 3.2.2 has been released
- 2015-03-07: Version 3.1.11 has been released
- 2014-12-10: Version 3.2.1 has been released
- 2014-11-17: Version 3.2 has been released
- 2014-10-19: Version 3.1.10 has been released
- 2013-01-06: Version 3.1.9 has been released
- 2012-08-11: Version 3.1.8 has been released
- 2012-01-08: Version 3.1.7 has been released
- 2011-08-21: Version 3.1.6 has been released
- 2011-05-29: Version 3.1.5 has been released
- 2011-01-09: Version 3.1.4 has been released
- 2010-11-28: Version 3.1.3 has been released
- 2010-11-21: Version 3.1.2 has been released
- 2010-11-07: Version 3.1.1 has been released
- 2010-09-16: Version 3.1 has been released
- 2010-07-15: Version 3.0.1 has been released
- 2010-06-20: Version 3.0 has been released
- 2010-05-10: Version 3.0pre1 has been released
- 2010-02-28: Version 3.0pre0 has been released
- 2010-02-11: Searchable mailing list archive
- 2010-01-27: New maintainer
- 2004-09-13: Version 2.4 has been released
Features
- Keeps statistics on hits/misses.
- Automatic cache size management.
- Can cache compilations that generate warnings.
- Easy installation.
- Low overhead.
- Optionally uses hard links where possible to avoid copies.
Limitations
- Only knows how to cache the compilation of a single C/C++/Objective-C/Objective-C++ file. Other types of compilations (multi-file compilation, linking, etc) will silently fall back to running the real compiler.
- Only works with GCC and compilers that behave similar enough.
- Some compiler flags are not supported. If such a flag is detected, ccache will silently fall back to running the real compiler.
Why bother?
If you ever run make clean; make
, you can probably benefit from
ccache. It is 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 compilations. By using ccache, recompilation goes much faster.
Another reason to use ccache is that the same cache is used for builds in different directories. If you have several versions or branches of a software stored in different directories, many of the object files in a build directory can probably be taken from the cache even if they were compiled for another version or branch.
A third scenario is using ccache to speed up clean builds performed by servers or build farms that regularly check that the code is buildable.
You can also share the cache between users, which can be very useful on shared compilation servers.
Is it safe?
The most important aspect of a compiler cache is to always produce exactly the same output that the real compiler would produce. This includes providing exactly the same object files and exactly the same compiler warnings that would be produced if you use the real compiler. The only way you should be able to tell that you are using ccache is the speed.
ccache has been coded very carefully to try to provide these guarantees. However, there are some corner cases where ccache could fail to detect that source code files have changed since a previous compilation. These limitations are listed under caveats in the manual.
If you experience any bugs or undocumented limitations, please report them.