Xcode 7 Compile Error: "Command Failed Due to Signal: Segmentation Fault: 11"

Command failed due to signal: Segmentation fault: 11

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.

Command failed due to signal: Segmentation fault: 11 while archiving

Try disabling Swift Compiler Optimization for Release

Then if you get any errors for missing files:

In the file inspector of the file click on the folder icon next to "Location" and locate the file manually

Command failed due to signal: Segmentation fault: 11 | Xcode 7.2

This is a hair pulling error especially common in XCode7.

Occasionally the usual XCode stupid bug protocol (clean, XCode Restart, clean, build) fixes it. However, often it is due to one or more offending lines of code. This doesn't necessarily mean there is a bug in the code, either!

So, before restarting, it is sometimes useful to undo recent changes sequentially and trying to build as you go along. If any of your dependencies or frameworks have been updated since your last successful build, these could be a likely candidate.

There are a couple things that seem to produce this error fairly regularly. So please add to this list concisely if you can isolate specific issues that CONSISTENTLY cause errors for you:

1) String concatenation using the plus operator in calls to methods that use autoclosures (found in calls to XCGLogger):

 public func myFunc(@autoclosure closure: () -> String?){
// do something
}

someInstance.myFunc("Hi " + nameStr + "!")

2) failure to call super.init() from subclass especially when super class is using a default initializer (you haven't explicitly created your own init)

3) Accidentally using a single equals sign to test for equality (using = instead of == ) especially in complex statement such as in this answer.

Command failed due to signal: Segmentation fault: 11 compile error

In "MYHelpers.h/.m" of your project (presumably from https://github.com/AlexandrGraschenkov/MYHelpers)
a NSString category with some utility methods is defined:

#pragma mark - NSString+Utils

@interface NSString (Utils)
- (NSString *)trim; // trim whitespace characters with new line
- (NSString *):(NSString *)appendString;
- (NSURL *)toURL;
- (NSString *)URLEncodedString;
- (NSString *)URLDecodedString;
- (NSString *)lightURLEncodeString;
+ (BOOL)emailValidate:(NSString *)email;
- (CGSize)sizeForStringWithFont:(UIFont *)font constrainedToSize:(CGSize)size;
- (id)JSON;
@end

The second method

- (NSString *):(NSString *)appendString;

has an empty selector name. This is allowed in Objective-C,
and you can call the method with

NSString *foobar = [@"foo" :@"bar"];

(I don't know if the method was intentionally defined with an empty
selector name – I wouldn't recommend it.)

But it causes the Swift compiler to crash. This happens only if NSString
is referenced somewhere in the Swift code.
(The compiler should never crash, no matter how malformed the input is,
so I would recommend to file a bug report at Apple).

You can rename the method to

- (NSString *)appendString:(NSString *)appendString;

(or simply remove it if you don't need it in your project),
that should solve the problem.

Command failed due to signal: Segmentation fault: 11 Xcode 8.0

I finally found the problem and solved it.

I first Created new project,
then moved my source files, one at a time to the new project,

I finally found the problem was not even related to Alamofire.

The error was coming from a library which I used for managing files

Maybe these steps will help someone



Related Topics



Leave a reply



Submit