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.
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
- Pass the launcher when you first configure, not after.
- For Make, export CC/CXX with the ccache prefix before building.
- Re-run and confirm "Cacheable calls" is non-zero in
ccache -s.
cmake -S . -B build \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cmake --build buildConfirm ccache is on the compile path
Zero the stats, build one file, and check the counters moved so you know ccache is actually invoked.
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 -sin CI so a bypassed cache is caught. - Avoid hardcoding bare gcc/g++ in Makefiles and scripts.