Re: Caching failed compilations

Andrew Stubbs <[email protected]> Wed, 1 Jul 2015 10:16:14 +0100
Newsgroups gmane.comp.compilers.ccache
Message-ID <[email protected]>
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