Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 7 compile error : "Command failed due to signal: Segmentation fault: 11"

Tags:

Yesterday I installed the official Xcode 7 and when I tried to open one of my Swift projects, appeared an alert saying that the new Xcode version wants to update my swift code (or something like this). Okay, I accepted and after this appeared "Command failed due to signal: Segmentation fault: 11" compile error (if you want details about this, I can write the whole error text). Anyone have the same issue?

Thanks

Edited

I installed back Xcode 6.4 and it's okay, no compilation errors.

like image 464
Chirila Vasile Avatar asked Sep 18 '15 06:09

Chirila Vasile


People also ask

When does SEG fault occur in Xcode?

The seg fault did only occur during build step of testing and not during building or running locally. Only in Xcode bots during build step of testing. I am using macOS Sierra and Xcode 8, with the code converted to Swift 2.3.

Is segmentation fault possible with Xcode bots on Mac mini?

I got segmentation fault on my Mac Mini using Xcode Bots. The seg fault did only occur during build step of testing and not during building or running locally. Only in Xcode bots during build step of testing.

How do I fix a segmentation fault?

First look at the bottom of the error message to identify the file and function which causes the segmentation fault. 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.


2 Answers

Omg, this is a terrific bug of Xcode. Just read this. http://blog.bellebethcooper.com/xcode-bug.html It made me smile.

The change was deceptively small, but here's what it was (inside my API client class, where I actually get the JSON data from the API):

I changed this:

`let json = try? NSJSONSerialization.JSONObjectWithData(data, options: [])` 

to this:

`let json = try? NSJSONSerialization.JSONObjectWithData(data, options: []) as! [String: AnyObject]` 

This is one of the most frustrating debugging experiences I've ever had, but I hope this post might help someone else who has the same issue. And if you ended up here via googling a bug you're struggling with and this didn't help you, I'm so sorry. I know exactly what you're going through. Don't give up!

like image 83
Murat Yasar Avatar answered Oct 29 '22 14:10

Murat Yasar


This indicates that some Required method/func is missing from your code. In my case I was using ObjectMapper and in my class I was forgot to include required init() method which causes this "Command failed due to signal: Segmentation fault: 11"

required init?(_ map: Map) {  } 
like image 24
Muhammad Umair Avatar answered Oct 29 '22 15:10

Muhammad Umair