如何识别导致分段错误的源文件:11

时间:2017-08-08 04:03:57

标签: ios swift xcode

尝试在Xcode 8.3.3上编译Swift 3.1时遇到问题 Xcode说:

  

:0:错误:无法执行命令:分段错误:11   :0:错误:编译命令因信号失败(使用-v to   见调用)

但我无法找出导致分段错误的swift文件。

日志明细:

  

CompileSwift正常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 /用户/ hainguyen /库/开发商/ Xcode中/ DerivedData /弗洛 - dvhxokbnekzqxkdydjtabfyrwxeb /编译/中间体/ Flo.build /调试-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   迅速降低:: ::类型转换器:: 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   迅速降低:: :: SILGenModule :: getFunction(SWIFT :: SILDeclRef,   swift :: ForDefinition_t)+ 304 8 swift
  0x00000001017ed93c   迅速降低:: :: SILGenModule :: emitVTableMethod(SWIFT :: SILDeclRef,   swift :: SILDeclRef,swift :: SILLinkage&)+ 60 9 swift
  0x00000001017efc6c(匿名   namespace):: SILGenVTable :: addEntry(swift :: SILDeclRef)+ 876 10 swift
  0x00000001017ef5fa swift :: ASTVisitor<(匿名   namespace):: SILGenVTable,void,void,void,void,void,   void> :: visit(swift :: Decl *)+ 778 11 swift
  0x00000001017eeca3(匿名命名空间):: SILGenType :: emitType()+ 371   12 swift 0x00000001017eeacd   迅速降低:: :: SILGenModule :: visitNominalTypeDecl(SWIFT :: NominalTypeDecl *)   + 29 13 swift 0x0000000101736ecb swift ::降低:: SILGenModule :: emitSourceFile(swift :: SourceFile *,   unsigned int)+ 1483 14 swift 0x0000000101738af2   swift :: SILModule :: constructSIL(swift :: ModuleDecl *,swift :: SILOptions&amp ;,,   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堆栈转储:   0.程序参数:/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 /用户/ hainguyen /库/开发商/ Xcode中/ DerivedData /弗洛 - dvhxokbnekzqxkdydjtabfyrwxeb /编译/中间体/ Flo.build /调试-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 个答案:

答案 0 :(得分:0)

Segmentation fault: 11的原因是您在.swift文件中编写的复杂表达式或函数。您可以通过检查错误中提到的行号来调试问题,例如:

  

迅速降低:: ::的TypeConverter :: getFunctionInterfaceTypeWithCaptures(SWIFT :: CanTypeWrapper,   swift :: AnyFunctionRef)+ 242 5 swift

如果您仍无法调试此问题,请将演示代码或上述文件放在网上,我会帮助您。

答案 1 :(得分:0)

尝试为发布禁用Swift编译器优化 更具体:在目标>构建设置>优化级别>发布>无优化中

答案 2 :(得分:-1)

无法从错误日志中识别分段错误swift文件。

我尝试删除源代码中的一些swift文件并重新导入它们然后现在分段错误错误现在消失了。

我不知道为什么会解决。

感谢Sohil R. Memon的时间。