[ccache] Build Safety

Vincent Dupuis vincedupuis at hotmail.com
Fri Sep 25 06:18:19 MDT 2009

Hi, and welcome to ccache!

> Date: Fri, 25 Sep 2009 10:22:14 +0200
> From: tom.dalton at eds.com
> To: ccache at lists.samba.org
> Subject: [ccache] Build Safety
> Hi,
> I think I know the answer to this question, but I want a second opinion!
> In the past, I have used the Clearcase version control system, which has
> it's own make system, clearmake. Clearmake provides some build caching
> functionality (which it terms wink-ins), that allows it to 'wink-in'
> build objects from other users views. I have experienced a lot of
> problems with this system, because clearcase wouldn't detect that two
> users were building the same file in a different environment (e.g.
> external libraries at different versions. This caused me all sorts of
> issues.

That's why it is not very used.

> Is it possible for inconsistent environments between builds to cause
> ccache to incorrectly use a cached object instead of recompiling? For
> example, different builds of gcc, different external libraries etc? What
> circumstances could cause this?

for each compile ccache makes a key with the following information:1. the pre-processor output from running the compiler with -E
2. the command line options
3. the real compilers size and modification time
4. any stderr output generated by the compilerif something changes then it recompiles and recache the new key/.o
so if you use a different external librairies, #1 and maybe #2 can change.

> Secondly, if there is not much that can break ccache, is it possible to
> use a shared cache (e.g. on an nfs-shared disk) to allow many users on
> many hosts to cache build results across several versions of a single
> product? (which will mean different gcc versions, libraries, even
> kernels.)

if each users use different gcc versions, libraries, even kernels, then
sharing the cache is not useful. It's better to use it locally. Try to compile
your product from scratch witch ccache and recompile (clean before) and 
compare the time. (ie: time make all). Here is my current stats at this moment:

cache directory                     /home/vince/projects/raaf/ccache
cache hit                          16462
cache miss                         11307
called for link                       70
compile failed                        63
preprocessor error                     4
not a C/C++ file                    1198
files in cache                      8779
cache size                         793.5 Mbytes
max cache size                     976.6 Mbytes

like you see, I skip compilation of 16462 files locally.

> Thanks for your help - ccache sounds really useful, but I want to make
> sure there's no 'traps'!
> Thanks,
> Tom
> _______________________________________________
> ccache mailing list
> ccache at lists.samba.org
> https://lists.samba.org/mailman/listinfo/ccache
Internet explorer 8 aide à protéger la vie privée.

More information about the ccache mailing list