Xcode 4.1 致命错误:自构建预编译头以来 stdlib 已修改

发布于 2024-11-29 14:15:39 字数 340 浏览 1 评论 0原文

构建 iPhone 应用程序,使用:

  • Xcode 4.1
  • Base SDK iOS 4.3
  • Apple LLVM Compiler 2.1

我开始收到以下错误:

致命错误:文件 '/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h' 自构建预编译头以来已被修改

我尝试重新安装 Xcode 和 OS X - 没有运气。这是什么原因造成的?

Building an iPhone app, using:

  • Xcode 4.1
  • Base SDK iOS 4.3
  • Apple LLVM Compiler 2.1

I have started getting the following error:

fatal error: file
'/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/../lib/clang/2.1/include/stdint.h'
has been modified since the precompiled header was built

I have tried reinstalling Xcode and OS X - no luck. What's causing this?

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

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

发布评论

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

评论(11

路还长,别太狂 2024-12-06 14:15:39

首先通过 Product -> 尝试干净的构建干净的菜单(从 XCode 4.6.2 开始)。

如果仍然不起作用,则打开管理器(从菜单中选择“窗口”->“管理器”)。打开管理器后,从窗口顶部的工具栏中选择“项目”。左侧是项目列表,选择您遇到问题的项目。

详细信息面板(列表右侧)将显示项目名称、位置、状态。下面的行显示派生数据所在的位置。单击最右侧的删除...按钮。将出现一个对话框,单击“删除”。

您还可以手动删除派生数据:

~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}

该目录包含项目的构建产品和索引。删除它是可以的,因为它只包含 Xcode 生成的项目。下次打开项目时,Xcode 将重新生成所有内容。

First try a clean build via the Product -> Clean menu (as of XCode 4.6.2).

If that still doesn't work then open the Organizer (from the menu select Window->Organizer). Once the Organizer is open, select Projects from the toolbar at the top of the window. On the left is a list of projects, select the one you are having a problem with.

The details panel (to the right of the list) will display the project name, location, status. The row beneath that shows where the Derived Data is located. Click the Delete... button the far right. A dialog will appear, click Delete.

You can also manually delete the Derived Data:

~/Library/Developer/Xcode/DerivedData/{project name + gobly-gook}

This directory contains built products and indexes for the project. It is OK to delete it because it only contains items generated by Xcode. Xcode will regenerate everything next time the project is opened.

时光病人 2024-12-06 14:15:39

我能够以更简单的方式修复它,只需选择“产品”>“清洁,然后产品>从 Xcode 菜单栏构建。

I was able to fix it in a much easier way, by simply choosing Product > Clean, then Product > Build from the Xcode menubar.

财迷小姐 2024-12-06 14:15:39

存档时删除 DerivedData 文件夹对我不起作用。

我必须查看“构建设置”-“构建位置”-“预编译标头缓存路径”并删除该文件夹。

对我来说就是:

/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders

Deleting the DerivedData folder did not work for me when Archiving.

I had to look at Build Settings - Build Locations - Precompiled Header Cache Path and delete that folder.

For me that was:

/var/folders/_w/t0mj70hd1439tqgxff7_mtt00000gn/C/com.apple.Xcode.501/SharedPrecompiledHeaders
甩你一脸翔 2024-12-06 14:15:39

我想我应该添加一个单独的答案,而不是对 Cryptognome 的答案进行评论,因为当问题来自运行 xcodebuild 时,它实际上是一个不同的解决方案。与 Cryptognome 一样,我在使用命令行工具 xcodebuild 时也遇到了错误。作为手动进入 /var 子文件夹的替代方法,我发现可以为共享 PCH 设置自己的缓存,您可以通过设置环境变量 SHARED_PRECOMPS_DIR 来实现这一点,例如如下

xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH

这样,我在自动构建中永远不会遇到错误。

请注意,在上面的命令中,我通常还会设置 OBJROOT 和 SYMROOT 环境变量以在 /tmp 中构建。最后,我把东西清理干净。

I thought I would add a separate answer rather than a comment to Cryptognome's answer, because it is in fact a different solution when the issue comes from running xcodebuild. Like Cryptognome, I had the error come up with the command-line tool xcodebuild. As an alternative to manually going into the /var subfolders, I found that I could set my own cache for the shared PCH, which you can do by setting the environment variable SHARED_PRECOMPS_DIR, e.g as follows

xcodebuild -target Foo -configuration Release SHARED_PRECOMPS_DIR=/tmp/foo/SharedPCH

This way, I never get the error in automatic builds.

Note in the above command, I would also typically set the OBJROOT and SYMROOT env var to build also in /tmp. At the end, I clean things up.

ㄟ。诗瑗 2024-12-06 14:15:39

xcodebuild 命令行工具有时会失败并出现此错误。当我将 svn 工作区同步到早期版本时,就发生了这种情况。 xcodebuild 工具将其预编译标头保留在 Ants 提到的文件夹中:

/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/

您必须查看构建命令本身以查看实际的文件夹名称(-include /var/...),但如果您正在构建,它可能会使用多个文件夹名称对于不同的体系结构(arm6、arm7、模拟器等)因此,如果您在命令行构建时遇到此问题,只需删除 /var/.../SharedPrecompiledHeaders 中的所有内容即可。

The xcodebuild command line tool sometimes fails with this error. This happened to me when I synched an svn workspace to an earlier build. The xcodebuild tool keeps its precompiled headers in the folder Ants mentioned:

/var/folders/... scrambled eggs .../-Caches-/com.apple.Xcode.503/SharedPrecompiledHeaders/

You have to look in the build command itself to see the actual folder name (-include /var/...), but it may be using several if you're building for different architectures (arm6, arm7, simulator, e.g.) So if you're having this problem with a command line build, just delete everything in /var/.../SharedPrecompiledHeaders.

花开柳相依 2024-12-06 14:15:39

通过 iOS Simulator > 删除模拟器的内容重置内容和设置...然后点击休息。这将删除标头和资源的任何现有预编译实例。这对我有用

Remove the contents for the Simulator by iOS Simulator > Reset Content and Settings... and hit Rest. This will remove any existing pre-compiled instances of the headers and resources. This worked for me

无力看清 2024-12-06 14:15:39

解决方案:

1)Product->Clean

2)Product->Build

Error 类型:

一种 Build error

原因之一:

可能更改了框架文件。
当对另一个框架所依赖的框架进行更改时,有时会发生这种情况。预编译头缓存不同步,Xcode 无法编译给定项目。

场景之一:

人们可能选择了“跳转到定义”,并在选择框架控件后做了一些更改。

Solution:

1)Product->Clean

2)Product->Build

Error Type:

a kind of Build error

One of the causes:

one might have changed the framework file.
This sometimes happens when a change is made to a framework that another framework depends upon. The precompiled header cache gets out of sync, and Xcode is unable to compile the given project.

One of the Scenarios:

one might have chosen Jump To Definition and did some change after selecting a framework control.

娜些时光,永不杰束 2024-12-06 14:15:39

我只需通过清理(command+shift+K)和重建就可以摆脱这个错误。

I was able to get rid of this error simply by cleaning (command+shift+K) and rebuilding.

夏花。依旧 2024-12-06 14:15:39

我首先尝试过但没有用。最后我删除了Xcode并重新安装了。现在它工作正常..

Xcode->删除->再次安装

它可能会对某些人有所帮助...

I tried above all but no use. Finally I deleted Xcode and re installed again. Now it is working fine..

Xcode->delete->install again

It might help some one...

鲜血染红嫁衣 2024-12-06 14:15:39

当我运行时,我在cordova上遇到了这个错误: cordova run ios

fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.

** BUILD FAILED **    

The following build commands failed:
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

我尝试使用 clean 和 build 但不起作用,最后我删除了文件夹 '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com .apple.DeveloperTools/6.0-6A313/Xcode' 并且可以工作!
这个提示可能对其他人有帮助

I had this error on cordova when I ran : cordova run ios

fatal error: file '/Users/.../cordova/platforms/ios/CordovaLib/CordovaLib_Prefix.pch' has been modified since the precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch' was built
note: please rebuild precompiled header
  '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode/SharedPrecompiledHeaders/CordovaLib_Prefix-bfgesbulnxtdepfwgniffeysypgv/CordovaLib_Prefix.pch.pch'
1 error generated.

** BUILD FAILED **    

The following build commands failed:
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/NSDictionary+Extensions.o Classes/NSDictionary+Extensions.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC build/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/armv7/CDVInvokedUrlCommand.o Classes/CDVInvokedUrlCommand.m normal armv7 objective-c com.apple.compilers.llvm.clang.1_0.compiler

I tried with clean and build but doesn't work, finaly I removed the folder '/var/folders/gb/3cf6hy4x7z3d7hprls6xmd0m0000gr/C/com.apple.DeveloperTools/6.0-6A313/Xcode' and works!
This tip, may be help others

恋竹姑娘 2024-12-06 14:15:39

Clean 方法对我来说不起作用,最终我通过重新安装 XCode 解决了这个问题。

Clean ways are not working for me, eventually I solved this issue by reinstall XCode.

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