iOS Xcode 编译错误:无法执行命令:分段错误:11

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30576693/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 07:13:28  来源:igfitidea点击:

iOS Xcode compile error: unable to execute command: Segmentation fault: 11

iosobjective-cxcodecompiler-errorsllvm

提问by Cane

I have a project which compiled perfectly in the past, but after the last Xcode update (6.3.2) I get a compile error whenever I try to run it directly on a device. Building and Running it in the simulator works fine. The Archive function works fine as well. But no matter what device I connect or what iOS version the device is running, I always get the same compile error:

我有一个过去编译完美的项目,但是在上次 Xcode 更新 (6.3.2) 之后,每当我尝试直接在设备上运行它时,都会出现编译错误。在模拟器中构建和运行它工作正常。存档功能也可以正常工作。但是无论我连接什么设备或设备运行的是什么 iOS 版本,我总是得到相同的编译错误:

Stack dump:

0.  /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.3.sdk/System/Library/Frameworks/CoreImage.framework/Headers/CIFilter.h:221:39: current parser token 'NS_REQUIRES_NIL_TERMINATION'
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: arm-apple-darwin14.3.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.m
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.cache
clang: note: diagnostic msg: /var/folders/p5/2yjs4f055hb0vvgl12yvj38r0000gq/T/SmallAdsSystem-a86b3e.sh
clang: note: diagnostic msg: 

********************
  1. It shows me random files that I'm supposed to submit to the bug report.
  2. I haven't made any code changes from a working version to the version causing the current problems and I even reverted to an earlier version which is live and running in the Appstore but still the same error.
  3. I have deleted xcode and installed again trough the app store
  4. I tried making changes to my code to maybe pinpoint any problems but since the source file of the problem changes every time, I don't really think anymore that it has anything to do with my code.
  1. 它显示了我应该提交给错误报告的随机文件。
  2. 我没有对从工作版本到导致当前问题的版本进行任何代码更改,我什至恢复到早期版本,该版本在 Appstore 中实时运行,但仍然出现相同的错误。
  3. 我已经删除了 xcode 并通过应用商店重新安装
  4. 我尝试对我的代码进行更改以查明任何问题,但由于问题的源文件每次都会发生变化,我真的不再认为它与我的代码有任何关系。

This is driving me mad. Any help is much appreciated

这让我发疯。任何帮助深表感谢

采纳答案by Cane

Apparently it was a bug in my Xcode version. Had to revert to an old one and everything worked again. With the newest update everything was working ok again.

显然这是我的 Xcode 版本中的一个错误。不得不恢复到旧的,一切又恢复了。随着最新的更新,一切又正常了。

回答by Manab Kumar Mal

I tried to add the paypal framework to my iOS Project (Using Xcode 7.2 and Objective-C language), When building it is not giving any error, but when I try to archive the Project and trying to make the IPA, I am getting that Error

我尝试将 paypal 框架添加到我的 iOS 项目(使用 Xcode 7.2 和 Objective-C 语言),构建时没有出现任何错误,但是当我尝试存档项目并尝试制作 IPA 时,我明白了错误

unable to execute command: Segmentation fault: 11

无法执行命令:分段错误:11

Screenshot:

截屏:

enter image description here

在此处输入图片说明

After huge trying I have disabled the Bitcode in Project's Target->Build Settings->Enable Bitcode. Now the build can be achieved. Please check the following screenshot.

经过大量尝试后,我在项目的目标-> 构建设置-> 启用位码中禁用了位码。现在可以实现构建。请检查以下屏幕截图。

enter image description here

在此处输入图片说明

回答by u7067387

I found a fix for my problem:

我找到了解决我的问题的方法:

I'm using a virtual machine and opened the project directly in the shared folder. I moved the project to the documents and now it works!

我正在使用虚拟机并直接在共享文件夹中打开项目。我将项目移到文档中,现在它可以工作了!

回答by Biga

We've just realized that segfault was caused by invalid unicodecharacters in our sources.

我们刚刚意识到段错误是由我们源代码中的无效 unicode字符引起的。

回答by Vikram Belde

unable to execute command: Segmentation fault: 11.

I was able to turn off the bitcode and able to achieve the ipa. An in depth of what bitcode means can be seen here

我能够关闭位码并能够实现ipa。可以在此处深入了解 bitcode 的含义

enter image description here

在此处输入图片说明

回答by Hamada AL

If you are using a virtual machine, then copy the files inside the virtual machine, don't import from your shared files, and it will work.

如果您使用的是虚拟机,则复制虚拟机内的文件,不要从您的共享文件中导入,它会起作用。

回答by SmarterSusheel

Pods are provided xcode/.... path for installation from git and i installed xcode 7.3.1 and its named like xcode3 so i face this type of error but when i renamed it to xcode then this error is solved for me.

Pod 提供了 xcode/.... 用于从 git 安装的路径,我安装了 xcode 7.3.1 并且它的名称类似于 xcode3,所以我面临这种类型的错误,但是当我将其重命名为 xcode 时,这个错误就为我解决了。

So In summary, First of all please check your xcode name in application section.

所以总而言之,首先请在应用程序部分检查您的 xcode 名称。

If it is not xcode then please rename it to xcode and try to run your app.

如果它不是 xcode,那么请将其重命名为 xcode 并尝试运行您的应用程序。

回答by user2444342

I had the exact same problem. In my case I looked at the offending file and played around with it. I was able to resolve the error by commenting out a giant NSDictionary declaration:

我有同样的问题。就我而言,我查看了有问题的文件并对其进行了处理。我能够通过注释掉一个巨大的 NSDictionary 声明来解决这个错误:

 NSDictionary* glyphNameToUnicode = [[NSDictionary alloc] initWithObjectsAndKeys:
                                    @"A", @"A",
                                    @"\u00C6", @"AE",
                                    @"\u01FC", @"AEacute",
                                    @"\u01E2", @"AEmacron",

This thing had probably 300 lines maybe more. Instead I moved the declaration into a file and loaded the dictionary from the file. Not sure if that helps, but in my case those files were not random...

这东西大概有 300 行,也许更多。相反,我将声明移动到一个文件中并从文件中加载了字典。不确定这是否有帮助,但就我而言,这些文件不是随机的......

Its deff a bug with xcode though...

虽然它是 xcode 的一个错误...

回答by Joshua Nozzi

In order to solve a problem (a known bug closed as a duplicate as of this writing) that caused apps built under 10.12 (macOS Sierra) to fail to launch under 10.9 (even when they'd done so without trouble previously), I'd installed 10.11 and Xcode 7.3.1 under a VMWare instance. Xcode (due to laziness on my part) was copied to the Desktop.

为了解决导致在 10.12 (macOS Sierra) 下构建的应用程序无法在 10.9 下启动的问题(在撰写本文时已关闭的已知错误)(即使他们之前没有遇到任何问题),我d 在 VMWare 实例下安装了 10.11 和 Xcode 7.3.1。Xcode(由于我的懒惰)被复制到桌面。

After reading SmarterSusheel's answer regarding a renamed Xcode, it dawned on me it may be path-related, so I moved Xcode to /Applicationsand tried again. Problem (mostly) solved. I say "mostly" because I also had to copy my project folder into the VMWare instance since it seemed to have issues building under the shared folder as well.

在阅读 SmarterSusheel 关于重命名的 Xcode 的回答后,我意识到它可能与路径相关,所以我将 Xcode 移到/Applications并再次尝试。问题(大部分)解决了。我说“主要”是因为我还必须将我的项目文件夹复制到 VMWare 实例中,因为在共享文件夹下构建它似乎也有问题。

回答by llama591

Setting Link-Time Optimizationto NOin both Debug and Release mode is what resolved the problem for me.

在调试和发布模式下设置Link-Time OptimizationNO对我来说解决了问题。