Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command failed due to signal: Segmentation fault: 11

You can get this error when the compiler gets too confused about what's going on in your code. I noticed you have a number of what appear to be functions nested within functions. You might try commenting out some of that at a time to see if the error goes away. That way you can zero in on the problem area. You can't use breakpoints because it's a compile time error, not a run time error.


I recently encountered the same problem, and I will try to generalise how I solved it, as a lot of these answers are to spesific to be of help to everyone.

1. First look at the bottom of the error message to identify the file and function which causes the segmentation fault.

Error message

2. Then I look at that function and commented out all of it. I compiled and it now worked. Then I removed the comments from parts of the function at a time, until I hit the line that was responsible for the error. After this I was able to fix it, and it all works. :)


For anyone else coming across this... I found the issue was caused by importing a custom framework, I have no idea how to correct it. But simply removing the import and any code referencing items from the framework fixes the issue.

(╯°□°)╯︵ ┻━┻

Hope this can save someone a few hours chasing down which line is causing the issue.


For me, this was caused by a change in the Parse SDK syntax in Swift 2.0. If you are using Parse and you upgrade to Swift 2.0, the following syntax changes:

Swift 1.2:

myPFQuery.findObjectsInBackgroundWithBlock({ (queryResults: [AnyObject]?, error: NSError?) -> Void in

    // CODE

})

Swift 2.0:

myPFQuery.findObjectsInBackgroundWithBlock { (queryResults: [PFObject]?, error: NSError?) -> Void in

    // CODE

}

The removal of the first '(' and the last ')' is what was causing the biggest problem. Took me AGES to find this!


I hit this error. After some frustration I tried Xcode clean and everything started working again. Just leaving this here for future reference.


When I got this error converting from Swift to Swift 2.0, it clearly indicates a particular file (blahClass.swift) that has the problem, then it outlined all of the warnings & errors in the error message text. I went through and resolved these manually and now the app compiles fine.