[ccache] Disk Space Requirements

Martin Pool mbp at canonical.com
Thu Jul 20 01:01:22 GMT 2006

On 19 Jul 2006, Naqib Khan <naqibn at nortel.com> wrote:
> Thanks Jim & TNoell, those were helpful responses.
> My followup question would be regarding setting the CCACHE_HARDLINK
> environment variable.  Is anyone using this successfully - as that would
> imply that disk space usage is being minimized.  I ask since the MAN
> page says that set using hard links can:  "confuse programs like 'make'
> that rely on modification times".

Yes, it can be used successfully.

If I recall correctly, ccache hardlinks the file and then touches it, so
it's modification time will always be at least new enough.  The
behaviour alluded to is this: you build a project in two trees, sharing
a ccache and with hard links enabled.  When you build the second time,
the object files in both trees will have a new mtime.  This means that
if you go back to the first tree and run "make" again, it will have to
relink everything because the file timestamps have changed - it will
work, it may just be slower, depending on how long the link phase takes.

So it's basically a space/time tradeoff.

Basically my advice on disk space would be to clean out source trees
when you're no longer using the objects, and trust ccache to let you
rebuild them quickly...


More information about the ccache mailing list