Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unable to execute command: Segmentation fault: 11 swift frontend command failed due to signal (use -v to see invocation)

I have an iOS swift program that compiles and runs fine on Xcode Beta2. When I downloaded beta4, I got a few syntax errors for the new swift language which I corrected. I now get this error:

<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)

The problem is that it does not tell me where this error is so that I can further troubleshoot it. Where can I type -v in order to "see the invocation" and troubleshoot further? Without this, there is absolute no way to figure out the problem. Thanks in advance.

like image 790
Salman Hasrat Khan Avatar asked Jul 29 '14 03:07

Salman Hasrat Khan


5 Answers

Here's how I was able to find out what the problem was:

  1. Click on the issue in the issue navigator (⌘ + 4, then click on the line with the red ! at the start)
  2. 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

  1. The location where your error occurred is at the end of that line. (In this case, on line 112 of file.swift in getInstances).
like image 124
yndolok Avatar answered Sep 21 '22 16:09

yndolok


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:

enter image description here

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.

enter image description here

like image 23
Manab Kumar Mal Avatar answered Sep 23 '22 16:09

Manab Kumar Mal


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

  1. Comment out recently changed Swift code (check commits) until the app compiles again
  2. 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:

enter image description here

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.

like image 41
Jeehut Avatar answered Sep 19 '22 16:09

Jeehut


I also had the same problem,

  1. when I cleaned the derived data
  2. Remove all removed derived data from Trash as well.
  3. Stop Xcode, restart it and clean build

It should be fixed now.

like image 8
Ebru Güngör Avatar answered Sep 23 '22 16:09

Ebru Güngör


In my case this error because I use Class name for variable

var MYClass : MYClass {
    get {
        return.....
    }
}

And this fixes my problem

var myClass : MYClass {
    get {
        return.....
    }
}
like image 4
aminhotob Avatar answered Sep 21 '22 16:09

aminhotob