[ccache] Re: About error: "failed to rename tmp files - No such file or directory"

William D. Tanksley, Jr wtanksleyjr at gmail.com
Fri Jun 17 14:41:11 GMT 2005


William Tanksley Jr <wtanksleyjr <at> gmail.com> writes:
> Saket Bagade <sbagade <at> nulinkinc.com> writes:
> > If I have a file with extension .c then it seems to be cached after
> > compiling but if it has a .cc extension, I get the following message in
> > the ${CCACHE_LOGFILE}:
> > failed to rename tmp files - No such file or directory

> I'm having the same problem, only with .cxx files. What's going on?

I worked it out. The solution is to set the CCACHE_CPP2 environment variable --
the CC compiler doesn't understand the .ii file extension that ccache uses.

This took a LONG time to work out because the cc_log message in question is so
terse, and the only other diagnostic output is extremely well hidden.

It seems to me to be sensible that if the compiler outputs an error message and
doesn't create the desired file, the error message should probably be output to
stderr, and probably also logged (if logging is enabled), and the same error
code should be returned.

It does NOT make sense to me to simply continue as though nothing were wrong.

To diagnose this, I appended to the line in 'ccache.c':
  cc_log("failed to rename tmp files - %s\n", strerror(errno));

the additional line:
  cc_log("files: %s %s %s %s\n",
      path_stderr, hashname, tmp_stderr, tmp_hashname);

I then did an ls on all four files, which revealed that only one of them
actually existed (stderr). Looking into it revealed the compiler error, after
which CCACHE_CPP2 became obvious as a fix.

This section of the code could probably stand to be improved in terms of error
reporting. Ideally, the semantics of the compiler running should be improved to
detect failures better -- as I mentioned, it's not optimal to make a total
failure to run so entirely silent.

> -Billy

-Billy




More information about the ccache mailing list