[ccache] ccache on generated C++ files...

Joel Rosdahl joel at rosdahl.net
Tue Jun 25 19:03:03 UTC 2019

On Tue, 25 Jun 2019 at 00:28, Malfettone, Kris via ccache
<ccache at lists.samba.org> wrote:
> So what I seem to be observing is only when I do a ninja -t clean or make
> clean. This removes all of my generated files (.h and .cpp files) and of
> course the normal build outputs. A subsequent run is then mostly cache
> misses. If I say manually do a rm $(find -name "*.o") then I get a 100% cache
> hit rate. I had assumed it was due to the fact that the generated files would
> have a newer mtime and ctime. My assumption must be wrong.

Maybe there is a timestamp in the generated files?

> Is there an easy way to print diagnostics on why a cache miss occurred?

Yes, assuming you use ccache 3.5 or newer, you can enable the debug mode and
compare the hashed input for two different builds. See "To debug why you don’t
get an expected cache hit for an object file [...]" on

-- Joel

More information about the ccache mailing list