KexAri KexAri - 2 months ago 39
Swift Question

Segmentation fault 11 is this related to Obj-C-bridge.h?

I'm migrating to Swift 3.0 and keep coming across the Segmentation fault 11:

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
cd "/Users/kekearif/Documents/MyApp/MyApp Dev/ios-app"
export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk
export TOOLCHAINS=com.apple.dt.toolchain.XcodeDefault
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name SA_Dev -Onone -D COCOAPODS -DDEV -DDEBUG -sdk /......./MyApp\ DEV.build/Objects-normal/arm64/SA_Dev-Swift.h -import-objc-header /Users/kekearif/Documents/MyApp/MyApp\ Dev/ios-app/MyApp/Obj-C-bridge.h -Xcc -working-directory/Users/kekearif/Documents/MyApp/MyApp\ Dev/ios-app

<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)


The long path ends with:

SA_Dev-Swift.h -import-objc-header /Users/kekearif/Documents/MyApp/MyApp\ Dev/ios-app/MyApp/Obj-C-bridge.h -Xcc -working-directory/Users/kekearif/Documents/MyApp/MyApp\ Dev/ios-app


Is this likely to be an issue with either my
Obj-C-bridge.h
or pods?

Answer

This is a bug in the SWIFT compiler, which Apple has to fix. You should report it to Apple.

Until Apple has fixed the bug, you should try to isolate the piece that triggers the bug and then make some changes so the bug isn't triggered. Sometimes, changing the order of a few things or changing the white space is enough. Sometimes, you have to remove the triggering code and replace it with an alternative implementation.

And yes, the place to start is Obj-C-bridge.h. Remove everything there and then start to add things piece by piece until you have identified the triggering code or line.