[ccache] stat() versus gcc -v in the hash

Koblinger Egmont egmont at uhulinux.hu
Mon Jul 19 09:40:51 GMT 2004


> I looked through the code, and noticed that the date and size of the
> compiler are added to the hash.  Would it be possible to hash the
> output of "gcc -v" (or equivalent) instead?  I think that would make
> the detection of whether the compiler has changed more accurate, but
> I'm not sure.  I'd be happy to write a patch if it sounds like it
> would work.

As Mark replied, there would be at least two drawbacks. One is an extra
fork+exec every time. Second is that if you patch your gcc, you'll get the
same version string, but you do want the compilations to be redone since
gcc has really changed.

Actually, I don't even know if stat()ing the gcc executable is the right
thing -- this is just a trivial frontend to gcc, the real executable is
some /usr/lib/gcc/foo-bar-ix86-pc/idontknowwhat, so that one should be
taken into account, too.

Maybe you could put the md5sum of the gcc executables in the hash.

We use ccache building up a distribution (UHU-Linux) and recompiling our
packages over and over again. To prevent gcc to be modified, we've put a
little hack in our build environment: if we build gcc and the resulted
binary is the same as the one on the main system, then we touch the new
binary back in time so that it will have the same timestamp as it had
before. Maybe you should ask the Gentoo maintainers what they could do.



-- 
Egmont


More information about the ccache mailing list