2

I am in the process of updating a project to iOS 11/Swift 4. I have updated to Swift 3.2 and have a project that builds with one warning: "Conversion to Swift 4 available". So I click the warning and start the migration assistant with the option "Minimize Inference" when asked about Swift 4 @objc Inference.

The build fails quite quickly with this message: Command failed due to signal: Segmentation fault: 11

Stack trace:

0 swift 0x000000010afabdba PrintStackTraceSignalHandler(void*) + 42 1 swift 0x000000010afab1f6 SignalHandler(int) + 662 2 libsystem_platform.dylib 0x00007fff9ec2bb3a _sigtramp + 26 3 swift 0x000000010a10155a clang::ASTReader::readTypeRecord(unsigned int) + 18634 4 swift 0x00000001085e4ff0 swift::migrator::updateCodeAndEmitRemap(swift::CompilerInstance*, swift::CompilerInvocation const&) + 960 5 swift 0x000000010791b775 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1925 6 swift 0x0000000107919784 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7716 7 swift 0x00000001078ce6a8 main + 12248 8 libdyld.dylib 0x00007fff9ea1c235 start + 1

Did anyone else have a similar issue and found a solution for it?

UPDATE: I also tried Swift 4 @objc Inference "Match Swift 3 Behavior" with the same results.

Alex
  • 731
  • 1
  • 11
  • 24
  • I had a similar issue. Somewhere toward the end of the giant log it showed me what method in my code it failed on. Do you have that? – jervine10 Sep 20 '17 at 14:45
  • Not sure, in the "program arguments" section? Basically there is two sections of massive blocks of filepaths and a stack trace in my log message. Did you fint it among all those file paths in the log? – Alex Sep 20 '17 at 14:50
  • Mine was after the migration while doing an Archive actually. I know how I fixed it, so I can probably make it happen again... But it was in the error messages of the build log for me. – jervine10 Sep 20 '17 at 14:53
  • Ah ok, for me the actual compiler is crashing. – Alex Sep 20 '17 at 14:55
  • Yes, so is mine. Here's what the bottom of my log says: 1. While emitting IR SIL function `@_T011InfoPanelViewC6insertyx5panel_tSo6UIViewCRbzAA04InfoD0RzlFAaH_AGXc_Tg5Tf4gn_n". for 'insert(panel:)' at /ViewControllers/Map/InfoPanel/InfoPanelView.swift:48:5` – jervine10 Sep 20 '17 at 15:04
  • Ok, I search for ".swift" and did not find any references to Swift files in the project so I probably have another issue. Thanks for your help though! – Alex Sep 20 '17 at 15:09
  • 2
    I managed to solve this finally today. When I changed to recommended build settings in XCode, the compiler started crashing in normal builds and pointed me towards a function. I then managed to rewrite that function in a way that did not crash the compiler but does the same thing. After the project was building again with recommended setting, the conversion tool worked. – Alex Sep 21 '17 at 15:23

2 Answers2

2

It appears to be a Swift bug which has been filed here: https://bugs.swift.org/plugins/servlet/mobile#issue/SR-4646

That said, have you tried cleaning and deleting derived data?

jakehawken
  • 707
  • 7
  • 12
0

The only thing that helped me (as other than the segmentation fault code 11, there wasn't ANY information what was causing the error), was to disable Whole Module optimization (set Compilation Mode to Single File under Target -> Build Settings) for all configurations. The setting will be re-enabled for Release configs after you go through the conversion or you can re-enable it yourself.

cumanzor
  • 174
  • 2
  • 9