Xcode 4 gcc 在存档构建上失败:跳过预编译步骤?

发布于 2024-11-05 17:16:09 字数 894 浏览 5 评论 0原文

我已经能够在 Xcode 4 上成功存档,但突然之间(?),我不能了。构建失败并显示无效的 .pch 文件。错误粘贴在下面(通过使用 -Winvalid-pch 重新尝试得到,但从构建日志中似乎发生的是预编译标头实际上并未被预编译 - 它是一个 iOS 应用程序,并直接从 CopyPNG 步骤到 .m 编译。

中似乎没有什么奇怪的。

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

我是否意外地翻转了某些内容? “预编译前缀标头”构建设置 对于所有配置都是“是”。删除派生数据下缓存的 pch 内容并不能解决问题。

另一个事实是:启用该设置。 “增加预编译头的共享”确实让它成功了,但我几乎找不到这个标志的真正用途,而且我以前从未使用过它,也许合理的是,预编译步骤仍然没有出现。当这种情况发生时。

I have been able to Archive on Xcode 4 successfully, but all of a sudden (??), I can't. The build fails with an invalid .pch file. The error is pasted in below (got from a reattempt with -Winvalid-pch, but what seems to be happening from the build log is that the precompiled header is not actually getting precompiled-- it's an iOS app, and goes straight from a CopyPNG step to a .m compile.

Could I have flipped something by accident? Nothing seems odd in my diff of the .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

The "Precompile Prefix Header" build setting is "Yes" for all configurations. Product->Clean doesn't help. Deleting the cached pch stuff under derived data doesn't fix it. Really seems like the whole "precompile" step is missing.

Another factoid: Enabling the setting "Increase Sharing of Precompiled Headers" DOES let it succeed. But I can find almost no reference to what this flag really does, and I have never used it before. And perhaps reasonably, the precompile step still doesn't show up when this happens.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

舟遥客 2024-11-12 17:16:09

你清理过然后重建吗? 产品菜单==> 干净。清理通常可以解决此类问题,有效地指示 Xcode 编译所有内容,无论它是否认为该文件的先前构建仍然有效。

如果失败,请尝试清除项目的 Derived Data 文件夹,位于 ~/Library/Developer/Xcode/DerivedData/YourProjectNamexxx ,其中 xxx 是 uuid 样式字符串。

Have you cleaned and then rebuilt? Product Menu ==> Clean. Cleaning usually solves such problems, effectively instructing Xcode to compile everything, regardless of whether it thinks the previous build of that file is still valid.

If that fails, try wiping out the Derived Data folder for the project, at ~/Library/Developer/Xcode/DerivedData/YourProjectNamexxx where xxx is a uuid-style string.

城歌 2024-11-12 17:16:09

批准的答案是正确的,只是注意它仅在某些情况下有效。

我刚刚将一个项目转换为工作区,并将派生数据位置从默认更改为相对于工作区。预编译头立即停止工作,清理旧位置似乎没有任何区别。当然,因为它是旧位置!

工作区相对位置似乎位于保存工作区文件(myProject.xcworkspace)的文件夹内。现在有新的子文件夹 DerivedData,其中包含以工作空间命名的文件夹,其中包含熟悉的内容。

Index 文件夹包含 PrecompiledHeaders,其中(最后)包含几个子文件夹。删除所有这些并重新编译会发生强制预编译。

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

I just converted a project into workspace and changed Derived Data Location from default to Workspace-relative. Precompiled headers stopped working immediately and cleaning the old location didn't seem to make any difference. Well of cource, since it was the OLD location!

Workspace relative location seems to located inside folder, where the workspace file (myProject.xcworkspace) was saved. There's now new subfolder DerivedData, which contains folder named by workspace, which contains the familiar stuff.

Index folder contains the PrecompiledHeaders, which contains (finally) the several subfolders. Deleting all of those and recompiling forced precompiling happen.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文