Using a compiler cache

Introduction

A compiler cache speeds up compilation times by caching object files and reusing them on subsequent builds. This even works for complete rebuilds (i.e. deleting the full build-directory). The compiler cache ccache is automatically used when it is found by CMake.

Install it with your package manager, e.g.:

sudo apt install ccache

Usage on eve

Just load the module:

module load /global/apps/modulefiles/ccache/3.3.3
brew install ccache

Windows support in ccache is not yet in the main ccache development line. Please install ccache from https://github.com/cristianadam/ccache/releases.

Just extract the archive and put the ccache.exe into the PATH.

You may want to change the cache directory (environment variable CCACHE_DIR) or increase the cache size (e.g. ccache -M 10G or CCACHE_MAXSIZE). See the ccache docs for configuration instructions.

You can check cache hit statistics with ccache -s.

To disable caching:

cmake . -DOGS_DISABLE_COMPILER_CACHE=ON

This article was written by Lars Bilke. If you are missing something or you find an error please let us know. Generated with Hugo 0.79.0. Last revision: September 22, 2021
Commit: [web] Use generated notebook output. fd7eacd2ab  | Edit this page on