Sometimes ccache gives weird error messages.

the preprocessor gave 5
This most probably means that ccache could not write to your cache directory
(~/.ccache by default, can be overridden with the environment variable
CCACHE_DIR).  This can also occur if ccache could not write to your temporary
directory (~/.ccache by default, overridden by CCACHE_TEMPDIR).

The reason this message is so unclear is that ccache is poorly designed and
the function execute in execute.c (as of ccache 2.4) will fork first and then
try to open two files.  If it fails to open these fails, it will exit with an
exit value set to the undocumented STATUS_NOCACHE which happens to be 5.
Unfortunately, the parent process has no way to know whether this return
value has been emitted by ccache before its execve or by the preprocessor
after the execve...

ccache internal error
Sometimes in ccache -s you will see a certain number of ccache internal errors.
Once again the error log will be clear and say:
  failed to rename tmp files - Permission denied
I was quite annoyed because I got this message only once in a while (like,
every 10 compilations).  This occurs because ccache could not write in some
of the directories of the cache.  I was sharing the cache directory between
me and root (because I build my software as root) and some directories were
created by root.
Fix:
  sudo chown -R $USER ~/.ccache

Back :: Home