Xcode 4 gcc error while building Archive: skip precompilation step?

I was able to successfully archive Xcode 4, but suddenly (??) I can’t. Build failed .pch file not valid. The error is inserted below (obtained from -Winvalid-pch using -Winvalid-pch , but what seems to come from the build log is that the precompiled header is not actually going to be precompiled - this is an iOS application and goes right from the step CopyPNG to compile .m.

Can I accidentally flip something? Nothing seems strange in my diff .pbxproj file.

 cc1obj: warning: /Users/myname/Library/Developer/Xcode/DerivedData/Foo-afikuaovoaeqhreaaaakpafseuuv/Build/PrecompiledHeaders/Foo_Prefix-guqixmujoiaaaacwjctfkrztxmbz/Foo_Prefix.pch.gch: created by a different GCC executable cc1obj: error: /Users/myname/Library/Developer/Xcode/DerivedData/Foo-afikuaovoaeqhreaaaakpafseuuv/Build/PrecompiledHeaders/Foo_Prefix-guqixmujoiaaaacwjctfkrztxmbz/Foo_Prefix.pch: No such file or directory cc1obj: error: one or more PCH files were found, but they were invalid 

"Precompile Prefix Header" Build Setting - Yes for all configurations. Product-> Pure does not help. Removing a cached pch file from derived data does not fix it. In fact, it seems that the entire "precompilation" step is missing.

Another factoid: Enabling the option "Increase sharing of precompiled headers" allows it to succeed. But I can find almost no reference to what this flag really does, and I have never used it before. And it is perhaps prudent that the precompilation step still does not appear when this happens.

+4
source share
2 answers

Did you clean and rebuild? Product Menu ==> Clear . A cleanup usually solves these problems by effectively instructing Xcode to compile everything, regardless of whether it believes that the previous build of this file is still valid.

If this fails, try deleting the Derived Data folder for the project in ~/Library/Developer/Xcode/DerivedData/YourProjectNamexxx , where xxx is a uuid-style string.

+5
source

The approved answer is correct, just note that it only works in some cases.

I simply converted the project to a workspace and changed the default Derived Data Location to Workspace-relative . The precompiled headers stopped working immediately, and clearing the old location did not seem to make any difference. Good, because it was an OLD location!

The relative location of the workspace seems to be located inside the folder where the workspace file was saved (myProject.xcworkspace). Now there is a new DerivedData subfolder that contains a folder called workspace containing familiar things.

The Index folder contains PrecompiledHeaders, which contains (finally) several subfolders. Removing all of them and recompiling the forced precompilation occurs.

0
source

All Articles