Do you need help on a specific subject? Use the contact form (Request a blog entry) on the right hand side.

2015-12-31

Segmentation fault work around on xcode 7.2

With XCode 7.2 I sometimes experience a "Segmentation Fault". Once it happens, it becomes impossible to recompile my project.
This happens after updating the code while up to that point the code was compiler-error free.
I.e. I would build the project, execute the application, stop de application, make a minor fix, en then bomb: Segmentation fault. And there is (almost) nothing I could do to reverse this. Undoing the change and cleaning the project does not work. Once a segmentation fault, always a segmentation fault.

Until I stumbled upon a work around: My application has a main.swift file. I would select all other swift files in the project and remove them from the target in the "Target Membership" from the "File Inspector" panel.
Then hit Ctrl-B (i.e. rebuild the project).
Of course the build would fail, but this is not important.
Then add the files back to the target and hit Ctrl-B again.
Presto, the code now compiles again, without the segmentation fault!

If you are careful and select (in XCode) only the files that are included in the project then deselect the target membership and use Ctrl-B... then the file selection will remain and implementing the work around will only take a few seconds.

Happy coding...

Did this help?, then please help out a small independent.
If you decide that you want to make a small donation, you can do so by clicking this
link: a cup of coffee ($2) or use the popup on the right hand side for different amounts.
Payments will be processed by PayPal, receiver will be sales at balancingrock dot nl
Bitcoins will be gladly accepted at: 1GacSREBxPy1yskLMc9de2nofNv2SNdwqH

We don't get the world we wish for... we get the world we pay for.

2 comments:

  1. But is this an Xcode bug? And if so are you aware of what is causing it?

    ReplyDelete
  2. I consider this a bug, but I do not know what causes it.
    I have not seen this behaviour recently, i.e. it probably does not occur in 7.3 and I have for certain not seen it in Xcode 8 beta (3 and/or 6).

    ReplyDelete