xcodebuild
因以下错误而失败:
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: merge-module command failed due to signal (use -v to see invocation)
** BUILD FAILED **
The following build commands failed:
MergeSwiftModule normal arm64 /Users/vmanot/Documents/Xcode/Projects/Frameworks/ExSwift/build/ExSwift.build/Release-iphoneos/ExSwift.build/Objects-normal/arm64/ExSwift.swiftmodule
CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler
(2 failures)
(上面提到的ExSwift
不是开源ExSwift,而是私有框架。
堆栈跟踪:
0 swift 0x0000000104229edb llvm::sys::PrintStackTrace(__sFILE*) + 43
1 swift 0x000000010422a61b SignalHandler(int) + 379
2 libsystem_platform.dylib 0x00007fff8e88152a _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff5d8c0070 _sigtramp + 3473140576
4 swift 0x000000010268b19e swift::serialization::Serializer::writeSubstitutions(llvm::ArrayRef<swift::Substitution>, std::__1::array<unsigned int, 256ul> const&) + 350
5 swift 0x000000010268a9dc swift::serialization::Serializer::writeNormalConformance(swift::NormalProtocolConformance const*) + 2684
6 swift 0x000000010269597b swift::serialization::Serializer::writeAllDeclsAndTypes() + 8043
7 swift 0x0000000102696949 swift::serialization::Serializer::writeAST(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>) + 2505
8 swift 0x0000000102698f47 swift::serialization::Serializer::writeToStream(llvm::raw_ostream&, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SILModule const*, swift::SerializationOptions const&) + 135
9 swift 0x0000000102699b82 withOutputFile(swift::ASTContext&, llvm::StringRef, llvm::function_ref<void (llvm::raw_ostream&)>) + 226
10 swift 0x0000000102699a06 swift::serialize(llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::SerializationOptions const&, swift::SILModule const*) + 214
11 swift 0x000000010233b54b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 12843
12 swift 0x000000010233810a frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2682
13 swift 0x0000000102334797 main + 2247
14 libdyld.dylib 0x00007fff9d9a35ad start + 1
15 libdyld.dylib 0x0000000000000108 start + 1650838364
如何找到错误的代码?
答案 0 :(得分:2)
我认为此错误的来源可能会有很大差异,取决于您编写的Swift源代码。我在尝试为符合UIPickerViewDataSource的自定义协议编写扩展时收到此错误。具体来说,我正在编写numberOfComponentsInPickerView(_:)
和pickerView(_:numberOfRowsInComponent:)
的默认实现。
我还没有确认,但我怀疑我们遇到的错误与Objective-C互操作性有关。我所知道的只是将这些实现从协议转移到符合要求的类中为我修复了错误。
编辑:更改优化级别,因为Bruno建议没有帮助。