[ccache] Caching failed compilations

Andrew Stubbs ams at codesourcery.com
Wed Jul 1 03:16:14 MDT 2015


On 30/06/15 15:30, Akim Demaille wrote:
> Could ccache offer a mode where even failed compiled be ccached?

I'd like to see this too!

Or rather, I would have liked to see this on a project I worked on a 
while ago. It's not really a common use case for most people, I'd 
imagine, and not something I'd use now (my compile failures would be 
almost entirely cache misses).

I did have a look at how feasible it is, and basically I think it can be 
done. The caching is based on a hash of the input source files, combined 
with the command line arguments and various other environmental factors; 
in particular, the content of the output binaries is immaterial. The 
warning messages that accompany the binary are already cached, so 
caching error messages is not a big deal. It merely needs some sort of 
mechanism to record the exit code.

I don't believe it would be possible to cache compilations where a 
header file is missing, for example, but those fail very quickly anyway.

Andrew


More information about the ccache mailing list