unable to execute command: Segmentation fault: 11 swift frontend command failed due to signal (use -v to see invocation)
Here's how I was able to find out what the problem was:
- Click on the issue in the issue navigator (⌘ + 4, then click on the line with the red ! at the start)
- At the bottom of the file that appears, there should be a line that says something like:
1. While emitting IR SIL function @_TToZFC4Down8Resource12getInstancesfMS0_U__FTSS6paramsGVSs10DictionarySSPSs9AnyObject__9onSuccessGSqFGSaQ__T__7onErrorGSqFT5errorCSo7NSError8responseGSqCSo17NSHTTPURLResponse__T___T_ for 'getInstances' at /path/to/file.swift:112:5
- The location where your error occurred is at the end of that line. (In this case, on line 112 of file.swift in
getInstances
).
I was trying to add the PayPal framework to my iOS Project (Xcode 7.2 and Objective C language). When building it did not throw any error, but when I tried to archive the Project and make the IPA, I was getting that error
unable to execute command: Segmentation fault: 11
Screenshot:
After struggling for a long time, I disabled the Bitcode in Project's Target > Build Settings > Enable Bitcode
. Now the project can be archived. Please check the following screenshot.
Can't really give a straight solution on this (although I'm sure it's an Apple bug), but I just came across the exact same error message and happen to solve it. Here's what I did:
In General
- Comment out recently changed Swift code (check commits) until the app compiles again
- Command-click each called method in the failing line and check if there could be an ambiguity
My Example
In my case (I was using the XMPPFramework written in Objective-C) the failing code looked like this:
for roomMessage: XMPPRoomMessage in self.messages { let slices = split(roomMessage.nickname(), { $0 == "_" }, allowEmptySlices: false)}
Once I replaced roomMessage.nickname()
with "0_test"
the code didn't fail any more. So I command-clicked the method nickname()
(twice) and here's what I saw:
My guess was that the Swift 1.1 compiler has problems with figuring out which method to call if the exact type of an object is not clear. So I made the type of roomMessage
explicit and got another error which I fixed by removing the braces behind the nickname()
method call. This made my app build again. Here's the working code:
for roomMessage: XMPPRoomMessageCoreDataStorageObject in self.messages { let slices = split(roomMessage.nickname, { $0 == "_" }, allowEmptySlices: false)}
I hope this helps someone out there to investigate the issue more quickly than I did.