0
votes

I have a problem when trying to compile Swift 3.1 on Xcode 8.3.3 The Xcode said:

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

But I cannot figure out the swift file that cause the segmentation fault.

Logs Detail:

CompileSwift normal x86_64 cd /Users/hainguyen/Workspace/Flo/FloUniversal/Flo /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/cb/n_ccw95n7zs11l87f9w98s7h0000gn/T/sources-ca5acd -target x86_64-apple-ios8.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator -F /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator -F /Users/hainguyen/Workspace/Flo/FloUniversal/Flo/Flo/Platforms/ios/Frameworks -enable-testing -g -module-cache-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-generated-files.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-own-target-headers.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-project-headers.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/DerivedSources/x86_64 -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/hainguyen/Workspace/Flo/FloUniversal/Flo -emit-module-doc-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo.swiftdoc -serialize-diagnostics-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/AppDelegate.dia -import-objc-header /Users/hainguyen/Workspace/Flo/FloUniversal/Flo/Flo/Platforms/ios/Application/Flo-Bridging-Header.h -O -module-name Flo -emit-module-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo.swiftmodule -emit-objc-header-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo-Swift.h -emit-dependencies-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/AppDelegate.d -num-threads 4 -output-filelist /var/folders/cb/n_ccw95n7zs11l87f9w98s7h0000gn/T/outputs-11dbac

0 swift 0x000000010412b4f7 PrintStackTraceSignalHandler(void*) + 39 1 swift
0x000000010412a9a6 SignalHandler(int) + 646 2 libsystem_platform.dylib 0x00007fff9a5b5b3a _sigtramp + 26 3 libsystem_platform.dylib 0x00007fff5ed2a0c8 _sigtramp + 3296150952 4 swift 0x0000000101b80ba2 swift::Lowering::TypeConverter::getFunctionInterfaceTypeWithCaptures(swift::CanTypeWrapper, swift::AnyFunctionRef) + 242 5 swift
0x0000000101b30f1d swift::Lowering::TypeConverter::getConstantInfo(swift::SILDeclRef) + 157 6 swift 0x0000000101b52af0 swift::SILModule::getOrCreateFunction(swift::SILLocation, swift::SILDeclRef, swift::ForDefinition_t) + 96 7 swift
0x00000001017284c0 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 304 8 swift
0x00000001017ed93c swift::Lowering::SILGenModule::emitVTableMethod(swift::SILDeclRef, swift::SILDeclRef, swift::SILLinkage&) + 60 9 swift
0x00000001017efc6c (anonymous namespace)::SILGenVTable::addEntry(swift::SILDeclRef) + 876 10 swift
0x00000001017ef5fa swift::ASTVisitor<(anonymous namespace)::SILGenVTable, void, void, void, void, void, void>::visit(swift::Decl*) + 778 11 swift
0x00000001017eeca3 (anonymous namespace)::SILGenType::emitType() + 371 12 swift 0x00000001017eeacd swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 29 13 swift 0x0000000101736ecb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1483 14 swift 0x0000000101738af2 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional, bool, bool) + 1666 15 swift 0x0000000100f49561 swift::performFrontend(llvm::ArrayRef, char const*, void*, swift::FrontendObserver*) + 42353 16 swift
0x0000000100ef8d6c main + 9052 17 libdyld.dylib
0x00007fff9a3a6235 start + 1 18 libdyld.dylib
0x0000000000000046 start + 1707449874 Stack dump: 0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -filelist /var/folders/cb/n_ccw95n7zs11l87f9w98s7h0000gn/T/sources-ca5acd -target x86_64-apple-ios8.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -I /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator -F /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator -F /Users/hainguyen/Workspace/Flo/FloUniversal/Flo/Flo/Platforms/ios/Frameworks -enable-testing -g -module-cache-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-generated-files.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-own-target-headers.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Flo-project-headers.hmap -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/DerivedSources/x86_64 -Xcc -I/Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/hainguyen/Workspace/Flo/FloUniversal/Flo -emit-module-doc-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo.swiftdoc -serialize-diagnostics-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/AppDelegate.dia -import-objc-header /Users/hainguyen/Workspace/Flo/FloUniversal/Flo/Flo/Platforms/ios/Application/Flo-Bridging-Header.h -O -module-name Flo -emit-module-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo.swiftmodule -emit-objc-header-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/Flo-Swift.h -emit-dependencies-path /Users/hainguyen/Library/Developer/Xcode/DerivedData/Flo-dvhxokbnekzqxkdydjtabfyrwxeb/Build/Intermediates/Flo.build/Debug-iphonesimulator/Flo.build/Objects-normal/x86_64/AppDelegate.d -num-threads 4 -output-filelist /var/folders/cb/n_ccw95n7zs11l87f9w98s7h0000gn/T/outputs-11dbac

3

3 Answers

0
votes

The cause of Segmentation fault: 11 is the complex expression or function which you have written in your .swift file. You can debug the issue just by checking out the line number mentioned in the error, e.g.:

swift::Lowering::TypeConverter::getFunctionInterfaceTypeWithCaptures(swift::CanTypeWrapper, swift::AnyFunctionRef) + 242 5 swift

If you still cannot debug the issue, pls put the demo code or above mentioned files online and I will help you out.

0
votes

Try disabling Swift Compiler Optimization for Release to be more specific: In your target > Build Settings > Optimization Level > Release > No optimization

-1
votes

No way to identify the segmentation fault swift file from error log.

I tried remove some swift files in the source codes and re-import them then now Segmentation fault error are now disappear.

I don't know why but resolved.

Thanks Sohil R. Memon for your time.