Xcode shared pre-compiled headers cache

Rainer Müller raimue at macports.org
Thu Oct 14 03:16:40 PDT 2010


Hello,

in ticket #26723 [1] I had to deal with a Xcode related problem.
Apparently the pre-compiled headers of an older build have been re-used
although the file contents has changed on disk.

In the Mac OS X Reference Library [2], I found some documentation about
this feature.

"Xcode automatically regenerates the precompiled header whenever the
prefix header, or any of the files it depends on are changed, so you
don't need to manually maintain the precompiled header."

I think that we have a problem with timestamps here. At extraction the
mtime of the files is preserved from the tarball, which is usually good.
But for a global cache being used across builds this poses a problem.

at time A, version A is released by creating a tarball
at time B, version B is released by creating a tarball
at time C, user builds version A, the cache is being filled
at time D, user builds version B, the cache file is already newer

So at time D, the cache will not be re-generated as the source file is
not recognized to be newer than the cache (time B < time C).

I fixed this problem for MacVim now by using a local cache directory.
This means I am passing the option CACHE_ROOT=${workpath}/caches to
xcodebuild as of r72421 [3].

Correct me if I am wrong as I am no Xcode expert, but I think all of our
ports using the xcode port group might be affected by the same problem.
Therefore I think we need a similar fix in the port group to avoid
possible build problems.

Rainer

[1] https://trac.macports.org/ticket/26723
[2]
http://developer.apple.com/library/mac/#documentation/DeveloperTools/Conceptual/XcodeBuildSystem/800-Reducing_Build_Times/bs_speed_up_build.html
[3] https://trac.macports.org/changeset/72421


More information about the macports-dev mailing list