On 2010-08-27 15:59, Tor Arne Vestbø wrote:
> On 27.08.10 13.15, Tor Arne Vestbø wrote:
>> I'm sorry to report that I'm seeing build issues with master when
>> building Qt on Mac OS X (but the issue should be fixable):
> 
>> I'm assuming the hash is based solely on the contents of the
>> preprocessed output, not the flags/defines that were passed? But it
>> seems that the defines are stored somewhere in the precompiled header,
>> since it's barfing out when detecting a mismatch.
> 
> It seems we do include a few flags in the hash as well, but not -D.
> Using the following patch, with CCACHE_SLOPPINESS=time_macros set
> everything seems to work fine:

Great! Thanks for investigating this.

> I moved output_is_precompiled_header to be a global variable so it could
> be read in calculate_object_hash(), there's probably a nicer way to do
> that, passing it back from cc_process_args in an out-argument and
> then back into calculate_object_hash() or something similar.

Since there's already lots of global state, I think adding one more
variable doesn't make it worse. (I have plans to deglobalize state in
the future.)

> I also include all flags in the hash when output_is_precompiled_header
> is set, just to see if things would work. We could perhaps limit this to
> -D and a few others if we can figure out exactly what GCC puts into the
> precompiled header.

Right.

> Finally, I added an improved check for use of precompiled headers,
> checking for the existence of a .gch directory in -include arguments
> (instead of "pch" in the filename as before). You're right that we can't
> detect all uses, and modifying the build system is the sure-safe way,
> but I think we can at least try to be smart here?

I like that approach better, yes. I don't think we need to check that
pchpath is a directory, though, since the preprocessed header may be a
file as well.

I'll apply your patch and remove the directory check.

> With this setup I do get mostly direct hits on subsequent runs. The few
> preprocessed hits I get happens when looking for the object file hash in
> the manifest and not finding the manifest. Not sure why this would happen?

Then the hash of the arguments and the input file has changed. It's a
bit fiddly but possible to debug this. If you want to do it, you can
compile ccache with -DCCACHE_DEBUG_HASH and set CCACHE_DEBUG_HASH=1 in
the environment. ccache will then write the bytes it hashes to the file
ccache-debug-hash.bin so that you can compare the hashed bytes from two
different runs in a binary editor.

-- Joel
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to