[ccache] Strange Behaviour Exacerbated by ccache - suggestions for improvement

tnoell at lexmark.com tnoell at lexmark.com
Thu Jun 29 18:47:42 GMT 2006

Hi ccache list:

We have been using ccache for almost 2 years with almost no trouble, and 
think it is great!

We did, however, recently have an interesting problem that exposed some 
things in ccache that could be improved.  Just thought I would relay our 
experience to the list to see if it can help improve ccache in the future. 
 Here goes ..

A developer makes a mistake in makefile that leads to a ccache command 
line that is missing the compiler as argv[1].  First argument to the 
compiler and now argv[1] to ccache is '-c'.   ccache immediately 
dispatches cleanup_all() before processing the rest of the command line. 

For this build, CCACHE_DIR points to a well populated ccache that runs 
NLEVELS=4, and a full cleanup takes around 23 minutes.  (we run ccache -c 
in crons at night and with a 50% threshold so that we have plenty of elbow 
room during the day).   Developer reports "ccache is hung", and kills the 

We run the same command line from the shell prompt (with CCACHE_DIR unset, 
therefore defaults to ~/.ccache) and it very quickly cleans the empty 
~/.ccache and then dumps the usage.  This is because the next argument was 
-I and after cleanup_all() ccache parses the rest of the args.   The 
command line is long, and usage text is multi-line, and we don't 
immediately see the little line tucked in between that says "Cleaned 
cache".  :)  We eventually did, and realized what was going on.

Clearly none of this is ccache's fault.  It does, however, lead to a 
couple of suggestions.

1)  Parse all command line options for validity before dispatching any 
actions like cleanup_all().  Thus, in this case, -I would have caused 
usage() end exit right away.
2) Maybe put ccache command line options in their own name space 
--ccache-clean instead of -c so that compiler options on errant command 
lines don't mimic ccache command line options.


In any case, thanks for a great tool!

Best Regards,
Tim Noell
Lexmark International, Inc.

More information about the ccache mailing list