Command failed due to signal: Segmentation fault: 11 occurred with Eureka 1.5.0 - ios

I have an error "Command failed due to signal: Segmentation fault: 11" when I compile my Swift code with a library Eureka. I am using Xcode Version 7.3 (7D175). My situation is similar to this question.
In the question above, some people were getting the same error with Eureka but it doesn't help me. I have just created a new project and done "pod install". Then I added "AgeRow.swift". So, this project is minimum and clean.
Here is a small sample that causes the segmentation fault error.
Please make sure this sample depends on Eureka 1.5.0.
I am writing my custom row named AgeInlineRow. When I comment out the AgeInlineRow class, the sample can be compiled. That is, other code seems not to be the cause of the error.
public final class AgeInlineRow: _AgeInlineRow, RowType, InlineRowType {
required public init(tag: String?) {
super.init(tag: tag)
onExpandInlineRow { cell, row, _ in
let color = cell.detailTextLabel?.textColor
row.onCollapseInlineRow { cell, _, _ in
cell.detailTextLabel?.textColor = color
}
cell.detailTextLabel?.textColor = cell.tintColor
}
}
public override func customDidSelect() {
super.customDidSelect()
if !isDisabled {
toggleInlineRow()
}
}
public func setupInlineRow(inlineRow: InlineRow) {
inlineRow.year_options = self.year_options
inlineRow.month_options = self.month_options
inlineRow.displayValueFor = self.displayValueFor
}
}
When I remove InlineRowType protocol and modify code to compile, this project can be compiled. So, I guess the cause is InlineRowType protocol and this is the limits of my debug abilities. I have no idea how can I bypass the issue. I have copied Eureka's PickerInlineRow code and modified. Of course PickerInlineRow doesn't cause segmentation fault.
I would be grateful if you could specify the reasons.
Here is the error message below.
0 swift 0x0000000108f344eb llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1 swift 0x0000000108f337d6 llvm::sys::RunSignalHandlers() + 70
2 swift 0x0000000108f34b4f SignalHandler(int) + 287
3 libsystem_platform.dylib 0x00007fff919e252a _sigtramp + 26
4 swift 0x0000000108d5f78b llvm::FoldingSet<llvm::AttributeSetNode>::NodeEquals(llvm::FoldingSetImpl::Node*, llvm::FoldingSetNodeID const&, unsigned int, llvm::FoldingSetNodeID&) const + 59
5 swift 0x000000010835e15f llvm::CallInst::Create(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, llvm::Twine const&, llvm::Instruction*) + 367
6 swift 0x000000010835e2f0 llvm::IRBuilder<true, llvm::ConstantFolder, llvm::IRBuilderDefaultInserter<true> >::CreateCall(llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::Twine const&) + 64
7 swift 0x0000000106d869c5 swift::irgen::IRGenModule::emitSILWitnessTable(swift::SILWitnessTable*) + 1829
8 swift 0x0000000106d1a0dd swift::irgen::IRGenModuleDispatcher::emitGlobalTopLevel() + 861
9 swift 0x0000000106da5a5e performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1278
10 swift 0x0000000106da5f06 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 70
11 swift 0x0000000106c89a1c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 15004
12 swift 0x0000000106c8541d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781
13 swift 0x0000000106c80e3c main + 1932
14 libdyld.dylib 0x00007fff91af25ad start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/ViewController.swift /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/AppDelegate.swift -primary-file /Users/keta/Documents/Swift/AgeInlineRowSample/AgeInlineRowSample/AgeRow.swift -target x86_64-apple-ios9.3 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk -I /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator -F /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator -F /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator/Eureka -enable-testing -g -module-cache-path /Users/keta/Library/Developer/Xcode/DerivedData/ModuleCache -D COCOAPODS -serialize-debugging-options -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-generated-files.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-own-target-headers.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/AgeInlineRowSample-project-headers.hmap -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/DerivedSources/x86_64 -Xcc -I/Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/keta/Documents/Swift/AgeInlineRowSample -emit-module-doc-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow~partial.swiftdoc -Onone -module-name AgeInlineRowSample -emit-module-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow~partial.swiftmodule -serialize-diagnostics-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.dia -emit-dependencies-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.d -emit-reference-dependencies-path /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.swiftdeps -o /Users/keta/Library/Developer/Xcode/DerivedData/AgeInlineRowSample-dpkftrsqyflgpvchqnoeoylaylrj/Build/Intermediates/AgeInlineRowSample.build/Debug-iphonesimulator/AgeInlineRowSample.build/Objects-normal/x86_64/AgeRow.o
P.S. I would like to make a custom inline row that has UIPickerView with two components.

I ran into this when i was implementing DateInlineRow. It seems swift compiler can not infer some types.
I ended up making DateInlineRow generic, even though i don't need the generic type for DateInlineRow.
Check out DateInlineRow implementation
/// A row with an NSDate as value where the user can select a date from an inline picker view.
public final class DateInlineRow_<T>: _DateInlineRow, RowType, InlineRowType {
required public init(tag: String?) {
super.init(tag: tag)
onExpandInlineRow { cell, row, _ in
let color = cell.detailTextLabel?.textColor
row.onCollapseInlineRow { cell, _, _ in
cell.detailTextLabel?.textColor = color
}
cell.detailTextLabel?.textColor = cell.tintColor
}
}
public override func customDidSelect() {
super.customDidSelect()
if !isDisabled {
toggleInlineRow()
}
}
}
public typealias DateInlineRow = DateInlineRow_<NSDate>
According to this your implementation should be.....
public final class AgeInlineRow_<T>: _AgeInlineRow, RowType, InlineRowType {
.....
}
public typealias AgeInlineRow = AgeInlineRow_<String>
Hope it helps

Related

Swift static library compile fails with "Stack dump without symbol names" when build with release configuration

Situation
As I described in title, Swift static library below fails when it's built with release build configuration. It's okay when built with debug configuration.
Codes
It's part of my project codes where the error occurs. If you try compiling it in a static library project, you can also get the error I got.
public struct LocalStorageManager<Instance, Storage> where Instance: Codable, Storage: StorageType {
private let localStorage: Storage
private let coderSet: CoderSet
public func save(_ instance: Instance, name: String) -> URL? {
guard let data = try? coderSet.encoder.encode(instance) else {
return nil
}
return localStorage.save(data: data, name: name)
}
public func load(path: URL) -> Instance? {
guard let data = localStorage.download(with: path) else {
return nil
}
guard let instance = try? coderSet.decoder.decode(Instance.self, from: data) else {
return nil
}
return instance
}
public init(_ localStorage: Storage = LocalStorageService()) {
self.localStorage = localStorage
self.coderSet = CoderSet()
}
}
fileprivate struct CoderSet {
let encoder = JSONEncoder()
let decoder = JSONDecoder()
}
struct LocalStorageService: StorageType {
private let storage: FileManager
init(_ storage: FileManager = FileManager.default) {
self.storage = storage
}
func save(data: Data, name: String?) -> URL? {
guard let name else { return nil }
do {
let filePath = fileURL(with: name)
try data.write(to: filePath ?? URL(string: "www.google.com")!)
return filePath
} catch {
return nil
}
}
func download(with url: URL) -> Data? {
do {
guard storage.fileExists(atPath: url.relativeString) else {
return nil
}
let data = try Data(contentsOf: url)
return data
} catch {
return nil
}
}
}
extension LocalStorageService {
var documentDirectory: URL? {
return try? self.storage.url(for: .documentDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: false)
}
func fileURL(with name: String?) -> URL? {
guard let documentDirectory = documentDirectory else {
return nil
}
let parsedName = name ?? UUID().uuidString
return documentDirectory.appendingPathComponent(parsedName)
}
}
public protocol StorageType {
func save(data: Data, name: String?) -> URL?
func download(with url: URL) -> Data?
}
Error logs
The codes show error logs like:
SwiftCompile normal arm64 Compiling\ CompileFailureTestFramework.swift /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift (in target 'CompileFailureTestFramework' from project 'CompileFailureTestFramework')
cd /Users/youngbinlee/Documents/Github/CompileFailureTestFramework
builtin-swiftTaskExecution -- /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift -emit-module-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftmodule -emit-module-doc-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftdoc -emit-module-source-info-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftsourceinfo -emit-dependencies-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.d -serialize-diagnostics-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.dia -emit-objc-header-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-Swift.h -emit-abi-descriptor-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.abi.json -target arm64-apple-ios16.2-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -I /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/PackageFrameworks -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -no-color-diagnostics -g -module-cache-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity\=checked -O -serialize-debugging-options -enable-bare-slash-regex -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/youngbinlee/Documents/Github/CompileFailureTestFramework -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-generated-files.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-own-target-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-project-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/include -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources-normal/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources -module-name CompileFailureTestFramework -frontend-parseable-output -disable-clang-spi -target-sdk-version 16.2 -parse-as-library -num-threads 10 -o /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o -index-unit-output-path /CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o
caller: $s27CompileFailureTestFramework19LocalStorageManagerVyACyxq_Gq_cfcfA_
callee: $s27CompileFailureTestFramework19LocalStorageServiceVyACSo13NSFileManagerCcfcfA_
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the project and the crash backtrace.
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift -emit-module-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftmodule -emit-module-doc-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftdoc -emit-module-source-info-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.swiftsourceinfo -emit-dependencies-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.d -serialize-diagnostics-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-master.dia -emit-objc-header-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework-Swift.h -emit-abi-descriptor-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.abi.json -target arm64-apple-ios16.2-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator16.2.sdk -I /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/PackageFrameworks -F /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator -no-color-diagnostics -g -module-cache-path /Users/youngbinlee/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -O -serialize-debugging-options -enable-bare-slash-regex -empty-abi-descriptor -Xcc -working-directory -Xcc /Users/youngbinlee/Documents/Github/CompileFailureTestFramework -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-generated-files.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-own-target-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/CompileFailureTestFramework-project-headers.hmap -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Products/Release-iphonesimulator/include -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources-normal/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources/arm64 -Xcc -I/Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/DerivedSources -module-name CompileFailureTestFramework -frontend-parseable-output -disable-clang-spi -target-sdk-version 16.2 -parse-as-library -num-threads 10 -o /Users/youngbinlee/Library/Developer/Xcode/DerivedData/CompileFailureTestFramework-ftqqxqgzqkusyngesbvylequustq/Build/Intermediates.noindex/CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o -index-unit-output-path /CompileFailureTestFramework.build/Release-iphonesimulator/CompileFailureTestFramework.build/Objects-normal/arm64/CompileFailureTestFramework.o
1. Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for CompileFailureTestFramework)
4. While running pass #1046 SILFunctionTransform "EarlyInliner" on SILFunction "#$s27CompileFailureTestFramework19LocalStorageManagerVyACyxq_Gq_cfcfA_".
for expression at [/Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift:37:43 - line:37:63] RangeText="LocalStorageService("
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000107a075b0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000107a065b4 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000107a07c34 SignalHandler(int) + 344
3 libsystem_platform.dylib 0x00000001ae8a02a4 _sigtramp + 56
4 swift-frontend 0x0000000103ac17e4 swift::getEligibleFunction(swift::FullApplySite, swift::InlineSelection) + 1576
5 swift-frontend 0x00000001039b35a0 (anonymous namespace)::SILPerformanceInlinerPass::run() + 2068
6 swift-frontend 0x0000000103908470 swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 4020
7 swift-frontend 0x00000001039050c4 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 148
8 swift-frontend 0x0000000103920670 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
9 swift-frontend 0x000000010390d858 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 504
10 swift-frontend 0x000000010390f9a0 swift::runSILOptimizationPasses(swift::SILModule&) + 368
11 swift-frontend 0x00000001030c1694 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 524
12 swift-frontend 0x00000001030525cc performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1064
13 swift-frontend 0x0000000103054ce8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7284
14 swift-frontend 0x0000000102ff5294 swift::mainEntry(int, char const**) + 3940
15 dyld 0x00000001ae547e50 start + 2544
Insight
The part I noticed is [/Users/youngbinlee/Documents/Github/CompileFailureTestFramework/CompileFailureTestFramework/CompileFailureTestFramework.swift:37:43 - line:37:63] RangeText="LocalStorageService(" and Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var LLVM_SYMBOLIZER_PATH to point to it):
Thanks to those logs, I could solve the error by changing init of LocalStorageManager:
// Changed
public init(_ localStorage: Storage? = nil) {
if let localStorage {
self.localStorage = localStorage
} else {
self.localStorage = LocalStorageService() as! Storage
}
self.coderSet = CoderSet()
}
It works but I don't know why..
Question
So my question is:
Is there any reason why it doesn't fail in debug, but only in release?
And why is the original init failing to compile?
If you have any idea, please let me know. Thanks!

Segmentation fault: 11 - Xcode/Swift 5 compile issue

I'm always getting a Segmentation fault: 11 error when compiling.
I have massively stripped back my code to identify the nuances of what is causing the issue and have produced the demo code below that exhibits the exact same problem.
Can anyone suggest any way to resolve this issue (thats different to what I have already highlight in the code comments)?
PS: this Swift 5 code and occurs with both Xcode 11.7 and Xcode 12
// If we make this a class instead, it compiles! (but I want it to be a struct)
struct SomeStruct {
// If we remove either of these properties or change them to an Int, it compiles! (but I obviously need 2 strings)
let propertyA: String
let propertyB: String
}
protocol Protocol { }
enum Enumeration {
// If we remove this case, it compiles! (but I need this case, and the protocol also)
case possibilityA(protocol: Protocol)
// If we add additional associated values to this case, it compiles! (but I need this case)
case possibilityB(completion: (Result<SomeStruct, Error>) -> ())
}
class SomeClass {
func method() {
// If we remove the use of `possibilityB`, it compiles! (but I need this)
_ = Enumeration.possibilityB(completion: { _ in
})
}
}
Here's the stack dump...
Stack dump:
0. Program arguments: /Applications/Xcode_12.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/x/Demo/Sources/Demo/Demo.swift -emit-module-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftmodule -emit-module-doc-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftdoc -emit-module-source-info-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo~partial.swiftsourceinfo -serialize-diagnostics-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.dia -emit-dependencies-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.d -emit-reference-dependencies-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.swiftdeps -target arm64-apple-ios9.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk -I /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos -I /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib -F /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos -F /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/Library/Frameworks -F /Applications/Xcode_12.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.0.sdk/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/x/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D SWIFT_PACKAGE -D DEBUG -D Xcode -serialize-debugging-options -Xcc -working-directory -Xcc /Users/x/Demo -enable-anonymous-context-mangled-names -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/swift-overrides.hmap -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Products/Debug-iphoneos/include -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources-normal/arm64 -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources/arm64 -Xcc -I/Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/DerivedSources -Xcc -DSWIFT_PACKAGE -Xcc -DDEBUG=1 -target-sdk-version 14.0 -parse-as-library -module-name Demo -o /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Build/Intermediates.noindex/Demo.build/Debug-iphoneos/Demo.build/Objects-normal/arm64/Demo.o -embed-bitcode-marker -index-store-path /Users/x/Library/Developer/Xcode/DerivedData/Demo-hjukrlyoxxzhqwasgqzluieckmux/Index/DataStore -index-system-modules
1. Apple Swift version 5.3 (swiftlang-1200.0.29.2 clang-1200.0.30.1)
2. While evaluating request IRGenSourceFileRequest(IR Generation for file "/Users/x/Demo/Sources/Demo/Demo.swift")
3. While emitting IR SIL function "#$s8Demo9SomeClassC6methodyyF".
for 'method()' (at /Users/x/Demo/Sources/Demo/Demo.swift:21:5)
4. While converting type '(#callee_guaranteed (#in_guaranteed Result<SomeStruct, Error>) -> ())'
0 swift 0x0000000107a19865 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1 swift 0x0000000107a18865 llvm::sys::RunSignalHandlers() + 85
2 swift 0x0000000107a19e1f SignalHandler(int) + 111
3 libsystem_platform.dylib 0x00007fff68acc5fd _sigtramp + 29
4 libsystem_platform.dylib 0x0000000000000004 _sigtramp + 18446603338760010276
5 swift 0x00000001039794d8 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 21400
6 swift 0x000000010396fc26 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8982
7 swift 0x0000000103809dc7 swift::irgen::IRGenerator::emitGlobalTopLevel(llvm::StringSet<llvm::MallocAllocator>*) + 1607
8 swift 0x00000001039449d7 performIRGeneration(swift::IRGenOptions const&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, swift::SourceFile*, llvm::GlobalVariable**, llvm::StringSet<llvm::MallocAllocator>*) + 1687
9 swift 0x000000010396d681 swift::SimpleRequest<swift::IRGenSourceFileRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenSourceFileRequest const&, swift::Evaluator&) + 97
10 swift 0x0000000103948dec llvm::Expected<swift::IRGenSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenSourceFileRequest>(swift::IRGenSourceFileRequest const&) + 940
11 swift 0x000000010394503d swift::performIRGeneration(swift::IRGenOptions const&, swift::SourceFile&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**, llvm::StringSet<llvm::MallocAllocator>*) + 269
12 swift 0x0000000103590d3a performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 3002
13 swift 0x0000000103580928 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 20712
14 swift 0x0000000103501c07 main + 1255
15 libdyld.dylib 0x00007fff688d3cc9 start + 1
16 libdyld.dylib 0x000000000000004f start + 18446603338762077063
error: Segmentation fault: 11 (in target 'Demo' from project 'Demo')
Naming the enum associated values is a shadow zone. While it is apparently accepted under certain conditions, it is not used or even mentioned in the official Swift Language Guide chapter on Enumerations. So in this case, your code compiles fine if you remove the naming.
enum Enumeration {
case possibilityA(Protocol)
case possibilityB((Result<SomeStruct, Error>) -> ())
}
...
func method() {
let _ = Enumeration.possibilityB({ _ in
})
In any case, a crashing compiler is never nice, no matter how bad code you feed it, and furthermore you got a pretty cool minimal test, so filling a report should be your duty and honor :)

fatal error encountered while deserializing SIL global "UIEdgeInsetsZero"

Using Swift 4.2 with Xcode 10 beta, if I write:
import UIKit
let foo: UIEdgeInsets = .zero
Then I get a fatal error at compile time:
*** DESERIALIZATION FAILURE (please include this section in any bug report) ***
result is ambiguous
0 swift 0x000000010784fc5a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x000000010784f066 SignalHandler(int) + 966
2 libsystem_platform.dylib 0x00007fff62a5ef5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000010 _sigtramp + 2639925456
4 libsystem_c.dylib 0x00007fff627fc1ae abort + 127
5 swift 0x0000000104cf599b swift::ModuleFile::fatal(llvm::Error) + 1915
6 swift 0x0000000104d2d4d2 swift::SILDeserializer::readGlobalVar(llvm::StringRef) + 1890
7 swift 0x0000000104dd7f9a swift::SerializedSILLoader::getAllForModule(swift::Identifier, swift::FileUnit*) + 234
8 swift 0x0000000103b2adbe performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 34750
9 swift 0x0000000103b1f10f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7839
10 swift 0x0000000103ac8c48 main + 13144
11 libdyld.dylib 0x00007fff62750015 start + 1
12 libdyld.dylib 0x0000000000000041 start + 2643132461
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -merge-modules -emit-module /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/ViewController~partial.swiftmodule /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/AppDelegate~partial.swiftmodule /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy~partial.swiftmodule -parse-as-library -sil-merge-partial-modules -disable-diagnostic-passes -disable-sil-perf-optzns -target x86_64-apple-ios12.0-simulator -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk -I /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator -F /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator -enable-testing -g -module-cache-path /Users/coeur/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/coeur/Development/Edgy -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-generated-files.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-own-target-headers.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-all-target-headers.hmap -Xcc -iquote -Xcc /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Edgy-project-headers.hmap -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/DerivedSources/x86_64 -Xcc -I/Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/DerivedSources -Xcc -DDEBUG=1 -emit-module-doc-path /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy.swiftdoc -emit-objc-header-path /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy-Swift.h -module-name Edgy -o /Users/coeur/Library/Developer/Xcode/DerivedData/Edgy-gbvthkytwkmyekdynhvvbtmysdbk/Build/Intermediates.noindex/Edgy.build/Debug-iphonesimulator/Edgy.build/Objects-normal/x86_64/Edgy.swiftmodule
1. While deserializing SIL global "UIEdgeInsetsZero"
error: Abort trap: 6
Here is workaround I found for Xcode 10 beta and Xcode 10 beta 2. Just temporary include this somewhere in your project until you update Xcode:
#if swift(>=4.2)
import UIKit.UIGeometry
extension UIEdgeInsets {
public static let zero = UIEdgeInsets()
}
#endif
Issue resolved in Xcode 10 beta 3 and newer.
(the resolution happened thanks to this pull request: https://github.com/apple/swift/pull/17122)
It is the bug of Swift compiler, see https://bugs.swift.org/browse/SR-7879 for current state and get more information.
You can try to use this workaround:
Replace all occurrence .zero like
tableView.separatorInset = .zero
to
tableView.separatorInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
Helpful is search .zero in the whole workspace, checking type, and when the type is UIEdgeInsets, just replace .zero.
It has been fixed today in Xcode 10 beta 3.
https://download.developer.apple.com/Developer_Tools/Xcode_10_beta_3/Release_Notes_for_Xcode_10_beta_3.pdf
"The zero property on UIEdgeInsets can now successfully be used. (40735990)"
Xcode 10
goto Build settings select All
and Search for Optimization Level
Change in Swift Compiler - Code Generation Optimization Level
Debug : No Optimization[-Onone ] to Optimise for Speed [-O]
It worked for me.

Xcode 8 (Swift 3) Command failed due to signal: Killed: 9

After upgrading to Xcode 8 and converting all my code to Swift 3, I have troubles compiling swift resources. It takes a very long time, and my computer gets super laggy and after about 30 minutes I get this
CompileSwift normal arm64 /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrank.swift
cd /Users/choojayson/Dropbox/BottomsUp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c /Users/choojayson/Dropbox/BottomsUp/Thirst/PendingVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/NotificationCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/NotificationsVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserPendingAction.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ChooseDrinkVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/AppDelegate.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/FirebaseReferences.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileStatsCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrankTime.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/MyProfileVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/ProfileStatsFooterCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/WeeklyDrank.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkList.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/User.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/HeaderCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/EndorseVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/GlobalScore.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Username.swift /Users/choojayson/Dropbox/BottomsUp/HomeVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LoginVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LeaderBoardVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/CollectionViewHeaderCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Global.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/CircularTransition.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/Drink.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/WeeklyBestVC.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/DrinkStatus.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/LeaderBoardCell.swift /Users/choojayson/Dropbox/BottomsUp/Thirst/PendingCell.swift -primary-file /Users/choojayson/Dropbox/BottomsUp/Thirst/UserDrank.swift -target arm64-apple-ios8.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos -F /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos -F /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos/SDWebImage -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseAnalytics/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseAuth/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseDatabase/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseInstanceID/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseMessaging/Frameworks/frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/FirebaseStorage/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleIPhoneUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleInterchangeUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleNetworkingUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleParsingUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleSymbolUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp/Pods/GoogleUtilities/Frameworks -F /Users/choojayson/Dropbox/BottomsUp -enable-testing -g -module-cache-path /Users/choojayson/Library/Developer/Xcode/DerivedData/ModuleCache -serialize-debugging-options -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-generated-files.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-own-target-headers.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Thirst-project-headers.hmap -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Products/Debug-iphoneos/include -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Firebase/Analytics/Sources -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/Firebase -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseAnalytics -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseAuth -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseDatabase -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseInstanceID -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseMessaging -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/FirebaseStorage -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleIPhoneUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleInterchangeUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleNetworkingUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleParsingUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleSymbolUtilities -Xcc -I/Users/choojayson/Dropbox/BottomsUp/Pods/Headers/Public/GoogleUtilities -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/DerivedSources/arm64 -Xcc -I/Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -DCOCOAPODS=1 -Xcc -working-directory/Users/choojayson/Dropbox/BottomsUp -emit-module-doc-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank~partial.swiftdoc -Onone -module-name Thirst -emit-module-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank~partial.swiftmodule -serialize-diagnostics-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.dia -emit-dependencies-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.d -emit-reference-dependencies-path /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.swiftdeps -o /Users/choojayson/Library/Developer/Xcode/DerivedData/Thirst-fbgpdykwgpyxllfixfnpenbijinz/Build/Intermediates/Thirst.build/Debug-iphoneos/Thirst.build/Objects-normal/arm64/UserDrank.o -embed-bitcode-marker
Believe it or not, this is the piece of code that was causing the problem for me. With it in, the compile takes about 30 minutes. If I simply comment out that chunk of code, it compiles in less than 30 seconds.
let params : [String: Any] = [
"person_id" : kPersonId,
"person_promo_id" : promo.personPromoId!,
"promo_page_id" : promo.promoPageId!,
"seq_no" : promo.seqNo!,
"promo_type" : promo.promoType!,
"page_name" : promo.pageName!,
"image_name" : promo.imageName!,
"start_date" : promo.startDate!,
"end_date" : promo.endDate!,
"website" : promo.website!,
"facility_name" : promo.facilityName!,
"address" : promo.street!,
"city" : promo.city!,
"prov_state_cd" : promo.provState!,
"country_cd" : promo.country!,
"contact_name" : promo.contactName!,
"contact_phone" : promo.contactPhone!,
"latitude" : promo.latitude!,
"longitude" : promo.longitude!,
"bgColorRed" : promo.bgColorRed!,
"bgColorGreen" : promo.bgColorGreen!,
"bgColorBlue" : promo.bgColorBlue!,
"promoCategories" : promoCat
]
Based on this and other things I have read, I would hunt for a case where you're assigning values to a large or nested dictionary with an Any or AnyObject in the definition. I'm guessing that it's the Any that is sending the compiler off on a wild good chase.
If you check your log where it fails, it should have the error right at the object that failed. This should give you a clue as to what file to look in.
Edit:
#Jay Chow, this is how I solved the compiler problem with the code above:
var params : [String : Any] = [:]
params["person_id"] = kPersonId
params["person_promo_id"] = promo.personPromoId
params["promo_page_id"] = promo.promoPageId
params["seq_no"] = promo.seqNo
params["promo_type"] = promo.promoType
params["page_name"] = promo.pageName
params["image_name"] = promo.imageName
params["start_date"] = promo.startDate
params["end_date"] = promo.endDate
params["website"] = promo.website
params["facility_name"] = promo.facilityName
params["address"] = promo.street
params["city"] = promo.city
params["prov_state_cd"] = promo.provState
params["country_cd"] = promo.country
params["contact_name"] = promo.contactName
params["contact_phone"] = promo.contactPhone
params["latitude"] = promo.latitude
params["longitude"] = promo.longitude
params["bgColorRed"] = promo.bgColorRed
params["bgColorGreen"] = promo.bgColorGreen
params["bgColorBlue"] = promo.bgColorBlue
params["promoCategories"] = promoCat
In my case, when I found that issue the chunk of code was:
return realm2.objects(Alert.self).sorted(by: { (alert1, alert2) -> Bool in
return alert1.hour < alert2.hour &&
alert1.minute < alert2.minute &&
alert1.label < alert2.label
})
My case had to do with appending too many programmatically created constraints to a view controller's view. I had multiple arrays of constraints defined at the class level as follows:
lazy var labelConstraints: [NSLayoutConstraint] = [...]
I was using this notation for all UI elements in my view. By the time I was done building the view, I had roughly 10 arrays of 3-5 NSLayoutConstraints.
I was then appending a concatenated array to the view's constraint array like so:
self.view.addConstraints(labelConstraints + buttonConstraints + viewConstraints, ...)
This line turned out to be the problem. It must be something with lazy initialization and inline array concat. Whatever the cause, I have fixed this using flatMap as follows.
let constraints = [labelConstraints, buttonConstraints, viewConstraints].flatMap{ $0 }
self.view.addConstraints(constraints)
In my case, I was writing a class that implemented Equatable and also had generic members. My issue was rooted in comparing the generic members with ==, when the generic class didn't have a == operator implemented.
For example (using Variable from RxSwift):
class Foo: Equatable {
var fieldOne: Variable<String> = Variable("fieldOne")
var fieldTwo: Variable<String?> = Variable(nil)
public static func ==(lhs: Foo, rhs: Foo) -> Bool {
//should be marked as a compiler error, since Variable doesn't have ==
return lhs.fieldOne == rhs.fieldOne && lhs.fieldTwo == rhs.fieldTwo
}
}
I should have seen a compiler error for this since no definition of == exists for Variable, but the compiler would crash (as well as the static analysis) before being able to show it. I was seeing memory usage of 60GB+ before the crash. Yikes.
It seems swift still has some lingering bugs when it comes to generics.
In my case, Xcode 9, Swift 4, the compilator couldn't stand addition of 8 numbers:
let aBitPattern: UInt64 = ((UInt64(a) & UInt64(0xff)) << 0) +
((UInt64(b) & UInt64(0xff)) << 8) +
((UInt64(c) & UInt64(0xff)) << 16) +
((UInt64(d) & UInt64(0xff)) << 24) +
((UInt64(e) & UInt64(0xff)) << 32) +
((UInt64(f) & UInt64(0xff)) << 40) +
((UInt64(g) & UInt64(0xff)) << 48) +
((UInt64(h) & UInt64(0xff)) << 56)
Transforming to this solved the infinite compilation:
var aBitPattern: UInt64 = ((UInt64(a) & UInt64(0xff)) << 0);
aBitPattern += ((UInt64(b) & UInt64(0xff)) << 8);
aBitPattern += ((UInt64(c) & UInt64(0xff)) << 16);
aBitPattern += ((UInt64(d) & UInt64(0xff)) << 24);
aBitPattern += ((UInt64(e) & UInt64(0xff)) << 32);
aBitPattern += ((UInt64(f) & UInt64(0xff)) << 40);
aBitPattern += ((UInt64(g) & UInt64(0xff)) << 48);
aBitPattern += ((UInt64(h) & UInt64(0xff)) << 56);
Yeah, and sometimes the semicolons help the compilator to understand your code as well.
I always look forward to the new Swift compilator and it always is a huge disappointment from Apple.

Segmentation fault 11 fix?

I'm trying to make an app where you push a button as many times as possible in a certain amount of time for points. I've been building it and running it on my iPhone daily for the past week or so, but now all of the sudden Xcode is giving me and error "segmentation fault 11". I have removed code that I added, removed things from the storyboard, and even reinstalled Xcode, but nothing has fixed the problem. There's articles and videos on how to fix it, but none of them seem to work for me.
Here's my code:
import UIKit
import Foundation
import AudioToolbox
// PlaySounds
class PlaySounds {
private var soundID: SystemSoundID = 0
public init(named name: String) {
if let soundURL = soundURL(forName: name) {
let status = AudioServicesCreateSystemSoundID(soundURL as CFURL, &soundID)
if status != noErr {
print("Unable to create sound at URL: '\(name)'")
soundID = 0
}
}
}
public func play() {
if soundID != 0 {
AudioServicesPlaySystemSound(soundID)
}
}
private func soundURL(forName name: String) -> URL? {
let fileExtensions = ["m4a", "wav", "mp3", "aac", "adts", "aif", "aiff", "aifc", "caf", "mp4"]
for fileExtention in fileExtensions {
if let soundURL = Bundle.main.url(forResource: name, withExtension: fileExtention) {
return soundURL
}
}
print("Unable to find sound file with name '\(name)'")
return nil
}
deinit {
if soundID != 0 {
AudioServicesDisposeSystemSoundID(soundID)
}
}
}
// ViewController
class ViewController: UIViewController {
let startTimer = Timer.scheduledTimer(timeInterval: 0.4, target: self, selector: #selector(UIMenuController.update), userInfo: nil, repeats: true)
let XDSound = PlaySounds(named: "XDDDDDDD")
#IBAction func playButtonPressed(_ sender: AnyObject) {
XDSound.play()
}
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
And the error code:
CompileSwift normal arm64 /Users/aaa/Desktop/XD/XD/XD/ViewController.swift
cd /Users/aaa/Desktop/XD/XD
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/aaa/Desktop/XD/XD/XD/ViewController.swift /Users/aaa/Desktop/XD/XD/XD/AppDelegate.swift -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -F /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -enable-testing -g -module-cache-path /Users/aaa/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-generated-files.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-own-target-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-all-target-headers.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-project-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos/include -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources/arm64 -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/aaa/Desktop/XD/XD -emit-module-doc-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name XD -emit-module-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.d -emit-reference-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.swiftdeps -o /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.o
0 swift 0x000000010bf6bb6d PrintStackTraceSignalHandler(void*) + 45
1 swift 0x000000010bf6b5b6 SignalHandler(int) + 470
2 libsystem_platform.dylib 0x00007fffa9fdebba _sigtramp + 26
3 libsystem_platform.dylib 0x00007fff568ee500 _sigtramp + 2895182176
4 swift 0x000000010944b00f llvm::Value* llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&, llvm::Constant*)>::callback_fn<getTypeMetadataAccessFunction(swift::irgen::IRGenModule&, swift::CanType, swift::ForDefinition_t)::$_3>(long, swift::irgen::IRGenFunction&, llvm::Constant*) + 255
5 swift 0x000000010944974a swift::irgen::emitLazyCacheAccessFunction(swift::irgen::IRGenModule&, llvm::Function*, llvm::GlobalVariable*, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&)> const&) + 1194
6 swift 0x000000010944b2cc getTypeMetadataAccessFunction(swift::irgen::IRGenModule&, swift::CanType, swift::ForDefinition_t, llvm::function_ref<llvm::Value* (swift::irgen::IRGenFunction&, llvm::Constant*)>&&) + 300
7 swift 0x000000010944ae45 emitCallToTypeMetadataAccessFunction(swift::irgen::IRGenFunction&, swift::CanType, swift::ForDefinition_t) + 117
8 swift 0x00000001094498dc swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType) + 108
9 swift 0x000000010948707d void llvm::function_ref<void (swift::irgen::GenericRequirement)>::callback_fn<(anonymous namespace)::EmitPolymorphicArguments::emit(swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&)::$_14>(long, swift::irgen::GenericRequirement) + 861
10 swift 0x000000010947c9e1 (anonymous namespace)::PolymorphicConvention::enumerateRequirements(llvm::function_ref<void (swift::irgen::GenericRequirement)> const&) + 129
11 swift 0x0000000109486bdb swift::irgen::emitPolymorphicArguments(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::SILFunctionType>, swift::CanTypeWrapper<swift::SILFunctionType>, llvm::ArrayRef<swift::Substitution>, swift::irgen::WitnessMetadata*, swift::irgen::Explosion&) + 459
12 swift 0x00000001094e34f5 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2997
13 swift 0x00000001094ce268 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9080
14 swift 0x00000001093f2601 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1329
15 swift 0x00000001094b3fcb performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1259
16 swift 0x00000001093821c7 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 23687
17 swift 0x000000010937a265 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17029
18 swift 0x000000010933782d main + 8685
19 libdyld.dylib 0x00007fffa9dd2255 start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/aaa/Desktop/XD/XD/XD/ViewController.swift /Users/aaa/Desktop/XD/XD/XD/AppDelegate.swift -target arm64-apple-ios10.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.0.sdk -I /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -F /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos -enable-testing -g -module-cache-path /Users/aaa/Library/Developer/Xcode/DerivedData/ModuleCache -D DEBUG -serialize-debugging-options -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-generated-files.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-own-target-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-all-target-headers.hmap -Xcc -iquote -Xcc /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/XD-project-headers.hmap -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Products/Debug-iphoneos/include -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources/arm64 -Xcc -I/Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/DerivedSources -Xcc -DDEBUG=1 -Xcc -working-directory/Users/aaa/Desktop/XD/XD -emit-module-doc-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftdoc -Onone -module-name XD -emit-module-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController~partial.swiftmodule -serialize-diagnostics-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.dia -emit-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.d -emit-reference-dependencies-path /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.swiftdeps -o /Users/aaa/Library/Developer/Xcode/DerivedData/XD-glogqttrbkyynngrdofevqkflfyf/Build/Intermediates/XD.build/Debug-iphoneos/XD.build/Objects-normal/arm64/ViewController.o
1. While emitting IR SIL function #_TFC2XD14ViewControllercfT7nibNameGSqSS_6bundleGSqCSo6Bundle__S0_ for 'init' at /Users/aaa/Desktop/XD/XD/XD/ViewController.swift:56:40
It says on the bottom of the error "swift:56:40" which I think means the 40th character of the 56th line, but all that's there is the opening bracket for the ViewController. Help?
The line to initialize the timer causes the error.
You can't call target/action methods on the top level of a class.
Either declare the variable as implicit unwrapped optional
var startTimer : Timer!
and initialize it in viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
startTimer = Timer.scheduledTimer(timeInterval: 0.4,
target: self,
selector: #selector(UIMenuController.update),
userInfo: nil,
repeats: true)
}
or declare the variable as lazy with a closure
lazy var startTimer : Timer = {
return Timer.scheduledTimer(timeInterval: 4.0, target: self, selector: #selector(update), userInfo: nil, repeats: false)
}()
and call it to start the timer
let _ = startTimer

Resources