3

During our iOS client build we run a clean to prevent/reduce failures. But last week all our build servers failed with this error

fatal error: malformed or corrupted AST file: 'could not find file 'worspace/file_name.h' referenced by AST file'

It seemed that file_name.h was no longer required and a developer removed the svn external which brought it in. But the AST files still held a reference to it - despite the clean.

After investigating I found it was the files in the following folder

var/folders/f3/bznwl6md2bx82f1fv_kkdzl00000gn/C/com.apple.DeveloperTools/5.0.2-5A3005/Xcode/SharedPrecompiledHeaders

Deleting SharedPrecompiledHeaders fixed the issue. At the time I manually did this.

But I'd like a way to automate it. Is there an environmental variable/alternative that can be used to find this directory? I noticed it varies between machines.

Shane Gannon
  • 6,770
  • 7
  • 41
  • 64

3 Answers3

3

The environment variable you are looking for is SHARED_PRECOMPS_DIR

Lane Roathe
  • 450
  • 4
  • 7
1

The final solution was to place the shared precomps dir within the checkout. This allowed the build servers to completely clean the workspace between builds.

Achieved this by passing in the SHARED_PRECOMPS_DIR to xcodebuild.

e.g.

xcodebuild -project ProjectName -target "Target" -configuration Configuration -sdk SDKName SHARED_PRECOMPS_DIR=/absolute/path/to/checkout

By passing this value in at the command line the SHARED_PRECOMPS_DIR was set for all projects. i.e. Including Dependent Projects.

Shane Gannon
  • 6,770
  • 7
  • 41
  • 64
0

Lane's answer is correct. If you need to retrieve this value from the command line parse the output of

xcodebuild -project myProj.xcodeproj -target "myTarg" -showBuildSettings

For further details see How do I print a list of "Build Settings" in Xcode project?

Community
  • 1
  • 1
Shane Gannon
  • 6,770
  • 7
  • 41
  • 64