9

I have a strange problem with the new Xcode 8 (no beta version) and swift3.

Once every other 3-4 times that I compile my code I get a 'command failed due to signal segmentation fault 11' error. I just need to enter new empty line, or sometimes changing some spaces, or add a comment (everywhere in the code) and the error disappears and I can compile again. This is really strange because I'm not changing anything in the code! And sometimes I can compile and it works, then I don't change anything, I compile again and I get the error. This is really annoying!

I have noticed this is happening since I have installed several 'Firebase' pods (Firebase, Firebase/Auth etc...). But I need them.

Anyone has any suggestion?

PS: I have set the Enable Bitcode of my project to No as many solution suggested, but nothing. In the error message it is not indicated any swift page where the error can be, an example is:

  1. While loading members for 'Class_name' at
  2. While deserializing 'func_name' (FuncDecl #42)

'func_name' is this one:

public class func loginUser(fir_user: FIRUser) {
    let user = SFUser()
    user.email = fir_user.email 
    user.isLogged = true
    try! sfRealm.write() {
        sfRealm.add(user, update:true)
    }

    var userToAdd = [String:AnyObject]()
    userToAdd["email"] = fir_user.email! as NSString

    let ref=FIRDatabase.database().reference()
    let usersRef = ref.child(childName)
    usersRef.setValue([key:value])
}

But then, as I said, I can just enter an empty row in another file and it compiles!

Thanks

Ian Barber
  • 19,765
  • 3
  • 58
  • 58
Andrea.Ferrando
  • 987
  • 13
  • 23
  • 3
    good to know that such kind of errors persists on XCode8 ... :( – Luca Rocchi Sep 15 '16 at 09:18
  • If you uninstall those pods do you still get the error message (If you compile 3-4 times)? – Qbyte Sep 15 '16 at 13:50
  • 1
    @Andrea Please post the solution you found as an answer, since your problem seems resolved. – Dev-iL Oct 04 '16 at 12:27
  • @Dev-iL thank you, just done :) – Andrea.Ferrando Oct 07 '16 at 11:06
  • This may help : http://stackoverflow.com/questions/32645533/xcode-7-compile-error-command-failed-due-to-signal-segmentation-fault-11?answertab=active#tab-top – technerd Oct 18 '16 at 10:50
  • i faced the same and i update my xcode 8.2.1 to 8.3 and error is gone. you can get latest xcode from http://stackoverflow.com/questions/10335747/how-to-download-xcode-4-5-6-7-8-and-get-the-dmg-or-xip-file – Vatsal Shukla Mar 29 '17 at 07:30

6 Answers6

2

I have the same issue i just figure out that i was using xcode 8.1 and the project's working copy was in xcode 8.2.1 so i just re install xcode 8.2.1 and problem got solved. Hope other can get the help trough this.

Premal Khetani
  • 3,175
  • 1
  • 26
  • 58
  • i also tried re intall xcode 8.2.1, when i just open the project it was working correctly, but after few minutes of coding it started showing this error and whole code editor's font becomes black color ( i mean Code Editor can't recognise / identify those syntex ). – Vatsal Shukla Mar 29 '17 at 05:31
  • @Vats Well i am agree for that but some times pc restart or xcode restart works for the problem. but i hadn't face this issue yet after that replacement. – Premal Khetani Apr 04 '17 at 11:13
0

Ok, it seems that I have found the solution: it is a problem with Firebase and cocoapods, so 2 solutions:

Download Firebase and import into your project

I, instead, updated cocoapods to the last version and it worked. Upgraded Firebase - Now Getting Swift Compile Error

Andrea.Ferrando
  • 987
  • 13
  • 23
  • I am getting this error and I have never used cocoapods (bad me?) so while problems with cocoapods may cause this error, it can happen without cocoapods. – Mitchell Model Jan 27 '17 at 01:23
0

In my case there was some type checking issue deep down the compiler so the editor didn't give error in the gutter but on building the project I was getting signal setmentation fault 11 error:

1.  While type-checking 'GetStoreAPIRequestModel' at /Users/.../StoreAPIModel.swift:9:1
2.  While type-checking expression at [/Users/.../StoreAPIModel.swift:15:18 - line:15:31] RangeText="[Dictionary]()"
3.  While resolving type [Dictionary] at [/Users/.../StoreAPIModel.swift:15:18 - line:15:29] RangeText="[Dictionary]"

So I changed my code from:

var stores = [Dictionary]() {
        willSet {
            allStores.removeAll()

            for model in newValue {
                allStores.append(StoreAPIModel(dictionary: model as! Dictionary).getModel())
            }
        }
    }

To (more descriptive dictionary):

var stores = [[String : Any]]() {
        willSet {
            allStores.removeAll()

            for model in newValue {
                allStores.append(StoreAPIModel(dictionary: model as [String : AnyObject]).getModel())
            }
        }
    }
HAK
  • 2,023
  • 19
  • 26
0

This is tricky problem. Issue can be with line of code or syntax. I was getting similar error and it was due to incorrect usage of dictionary. I was trying to increment the value of dictionary element.

Solution is to triage the code, detailed error provide which module has issue, so try commenting part of code until you find the line which is causing the issue.

Pandurang Yachwad
  • 1,695
  • 1
  • 19
  • 29
0

Hi i had the same issue with FireBase , my problem was that i was extending FIRStorageReference and FIRDatabaseReference and some time it compile successfully some time i get

command failed due to signal segmentation fault 11

so i removed that files and implement the method other way , now everything works fine.

Constantin Saulenco
  • 2,353
  • 1
  • 22
  • 44
0

Found my problem when this occurred. (No cocoapods.) I thought I had left the program in a working state, but I was wrong. I am writing a straightforward command-line program. What it does is somewhat general, so I defined all the strings that make it specific in let statements at the top of the program so that I could someday use the program in a different context.

Since that was working so well, I thought I'd be clever and do the same with a filter of an array of dictionaries. I turned:

list.filter { $0["SearchStrings"] == nil }

into:

let test = { $0["SearchStrings"] == nil }
// ...
list.filter(test)

meaning to continue working on the let, but I never went back and did that. Building gave me the segmentation fault error. Defining test as a function fixed the problem.

(Incidentally, I understand how to strip a filtering function down to the terse braces notation in the context of the call to Array.filter, and why that works, but I don't understand why I can't assign the brace expression to a constant and use it as such.)

Mitchell Model
  • 1,060
  • 10
  • 16