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

China☆狼群 提交于 2020-05-12 21:17:26

问题


I tried to archive my App and get this error: Command failed due to signal: Segmentation fault: 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__".

回答1:


Try disabling 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




回答2:


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

Build Settings > Optimization Level > Release > No optimization [-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.

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

class MyNavigationController:UINavigationController {

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



回答3:


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



来源:https://stackoverflow.com/questions/42167263/command-failed-due-to-signal-segmentation-fault-11-while-archiving

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!