xcode 由于信号导致命令失败:分段错误:归档时为 11

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42167263/
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 09:46:57  来源:igfitidea点击:

Command failed due to signal: Segmentation fault: 11 while archiving

iosxcodeswift3xcode8

提问by Marius Sch?nefeld

I tried to archive my App and get this error: Command failed due to signal: Segmentation fault: 11

我试图存档我的应​​用程序并收到此错误:命令因信号失败:分段错误:11

When I Build it everything went fine, also on real devices. While archiving this happens. Any Ideas how to fix ?

当我构建它时,一切都很好,在真实设备上也是如此。存档时会发生这种情况。任何想法如何解决?

This is a part of the error:

这是错误的一部分:

0  swift                    0x000000010f79f3ad PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x000000010f79eb56 SignalHandler(int) + 790
2  libsystem_platform.dylib 0x00007fffc82d5bba _sigtramp + 26
3  libsystem_platform.dylib 0x0000000000000040 _sigtramp + 936551584
4  swift                    0x000000010cae0de3 swift::CastOptimizer::optimizeUnconditionalCheckedCastAddrInst(swift::UnconditionalCheckedCastAddrInst*) + 1699
5  swift                    0x000000010cb69d4d processFunction(swift::SILFunction&, bool, unsigned int) + 1917
6  swift                    0x000000010cb70c9f (anonymous namespace)::ConstantPropagation::run() + 47
7  swift                    0x000000010caff89e swift::SILPassManager::runOneIteration() + 5166
8  swift                    0x000000010cb051f6 swift::runSILOptimizationPasses(swift::SILModule&) + 3462
9  swift                    0x000000010c7ac0e2 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 20114
10 swift                    0x000000010c7a52b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
11 swift                    0x000000010c7615cf main + 8239
12 libdyld.dylib            0x00007fffc80c8255 start + 1
13 libdyld.dylib            0x00000000000000ee start + 938704538

And at the end:

最后:

1.  While running pass #38147 SILFunctionTransform "Constant Propagation" on SILFunction "@_TTSg5VSC29UIApplicationLaunchOptionsKeyS_s8Hashable5UIKit_P__CSo8NSObjectS2_S0_10ObjectiveC_Ps9AnyObject____TFs17_dictionaryUpCastu2_Rxs8Hashable0_S_rFGVs10Dictionaryxq__GS0_q0_q1__".

回答by Dimitrie-Toma Furdui

Try disabling Swift Compiler Optimization for Release

尝试禁用 Swift Compiler Optimization for Release

Then if you get any errors for missing files:

然后,如果您因丢失文件而出现任何错误:

In the file inspector of the file click on the folder icon next to "Location" and locate the file manually

在文件的文件检查器中,单击“位置”旁边的文件夹图标并手动定位文件

回答by Amir.n3t

In my case, I tested all solutions including disabling optimization in the build settings:

就我而言,我测试了所有解决方案,包括在构建设置中禁用优化:

Build Settings > Optimization Level > Release > No optimization [-Onone]

构建设置 > 优化级别 > 发布 > 无优化 [-Onone]

I don't recommend the above solution since this will affect your entire app and your final binary won't be optimized.

我不推荐上述解决方案,因为这会影响您的整个应用程序,并且您的最终二进制文件不会得到优化。

Based on contact with technical team at Apple, There are multiple reasons that could lead to this error, however there's a known bug for archiving during optimization and you need to bypass it by finding the place that compiler is failing and add @_optimize(none)at the top of your function that's causing the issue.

根据与 Apple 技术团队的联系,有多种原因可能导致此错误,但是在优化期间存在一个已知的存档错误,您需要通过找到编译器失败的地方并添加@_optimize(none)到您的顶部来绕过它导致问题的函数。

This attribute will tell compiler to ignore the function for optimisation.

这个属性会告诉编译器忽略优化的函数。

class MyNavigationController:UINavigationController {

    @_optimize(none)
    init(navigationController: UINavigationController?, context: AppContextProtocol) {
      // content
    }
}

回答by mrabins

Check Build Settings -> Swift 3 @Objc inference. It most likely should be off.

检查构建设置 -> Swift 3 @Objc 推理。它很可能应该关闭。