Skip to content
Latchkey

ccache stats show zero hits even though the cache is warm in CI

The cache directory has entries and is restored, yet ccache -s shows no cacheable calls. That means the build compiled without going through ccache at all, so nothing was looked up or stored.

What this error means

ccache -s shows "Cacheable calls: 0" or unchanged hit/miss counters after a full build, and build time is unaffected by the presence of the cache.

ccache
Cacheable calls:   0 / 0
Hits:              0
Misses:            0
Cache hit rate:    0.00 %

Common causes

CMake never applied the compiler launcher

The launcher was set after configuration, or the generator (like Ninja) was configured without CMAKE_<LANG>_COMPILER_LAUNCHER, so compiles call the raw compiler.

The build called the compiler directly

A Makefile or script used a hardcoded gcc/g++ instead of the ccache launcher, so ccache was bypassed.

How to fix it

Wire the launcher at configure time

  1. Pass the launcher when you first configure, not after.
  2. For Make, export CC/CXX with the ccache prefix before building.
  3. Re-run and confirm "Cacheable calls" is non-zero in ccache -s.
Terminal
cmake -S . -B build \
  -DCMAKE_C_COMPILER_LAUNCHER=ccache \
  -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build build

Confirm ccache is on the compile path

Zero the stats, build one file, and check the counters moved so you know ccache is actually invoked.

Terminal
ccache -z
cmake --build build --target main.o
ccache -s | grep 'Cacheable calls'

How to prevent it

  • Set the compiler launcher at configure time, before the build.
  • Zero and re-check ccache -s in CI so a bypassed cache is caught.
  • Avoid hardcoding bare gcc/g++ in Makefiles and scripts.

Frequently asked questions

What causes "ccache stats: 0 hits (warm cache)"?
The launcher was set after configuration, or the generator (like Ninja) was configured without CMAKE_<LANG>_COMPILER_LAUNCHER, so compiles call the raw compiler.
How do I fix ccache stats: 0 hits (warm cache)?
Wire the launcher at configure time

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card