Error: Abort trap: 6 when compiling using Xcode 12 beta (12A6159) with Swift 5.2.4 release toolchain

Can someone help me debug this compiler issue. Does watchOS 7 SDK depend on Swift 5.3?

Our dependencies were compiled using Xcode 11.5 so I switched to toolchain to 5.2.4 when using Xcode 12 beta.

Found this error when attempting to compile:

/Applications/Xcode_12-beta_1.app/Contents/Developer/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator7.0.sdk/usr/lib/swift/Swift.swiftmodule/x86_64-apple-watchos-simulator.swiftinterface:21658:21: error: module 'Builtin' has no member named 'convertUnownedUnsafeToGuaranteed'
    return try body(Builtin.convertUnownedUnsafeToGuaranteed(fakeBase,
                    ^~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<unknown>:0: error: failed to load module 'Swift'
Assertion failed: (!hasMultiplePrimaryInputs() && "have not implemented >1 primary input yet"), function assertMustNotBeMoreThanOnePrimaryInput, file /Users/buildnode/jenkins/workspace/oss-swift-5.2-package-osx/swift/lib/Frontend/FrontendInputsAndOutputs.cpp, line 111.

0  swift                    0x000000010f60c0f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1  swift                    0x000000010f60b315 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010f60c6d0 SignalHandler(int) + 272
3  libsystem_platform.dylib 0x00007fff70ba75fd _sigtramp + 29
4  swift                    0x0000000111a6c0e8 cmark_strbuf__initbuf + 138619
5  libsystem_c.dylib        0x00007fff70a7d808 abort + 120
6  libsystem_c.dylib        0x00007fff70a7cac6 err + 0
7  swift                    0x000000010f6c8f91 swift::FrontendInputsAndOutputs::getPrimarySpecificPathsForAtMostOnePrimary() const (.cold.1) + 33
8  swift                    0x000000010bbb6bb0 swift::FrontendInputsAndOutputs::getPrimarySpecificPathsForAtMostOnePrimary() const + 256
9  swift                    0x000000010bbab305 swift::CompilerInvocation::getModuleOutputPathForAtMostOnePrimary() const + 21
10 swift                    0x000000010b999c11 emitIndexDataIfNeeded(swift::SourceFile*, swift::CompilerInvocation const&, swift::CompilerInstance&) + 161
11 swift                    0x000000010b994c75 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 7653
12 swift                    0x000000010b991f21 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 5153
13 swift                    0x000000010b92e05e main + 734
14 libdyld.dylib            0x00007fff709aecc9 start + 1
15 libdyld.dylib            0x0000000000000078 start + 2405766064
error: Abort trap: 6

Yes, what you're seeing is that the stdlib in the newer SDK requires a new compiler builtin, which is available in Swift 5.3. I don't know for sure if that builtin was unavailable in 5.2.4 but that seems highly likely given what you are seeing. Were your dependencies compiled with library evolution turned on? If so, then it should be ok to compile your project with a Swift 5.3 toolchain in Xcode 12 beta even though your dependencies were compiled with Xcode 11.5. The Swift 5.3 compiler will be able to consume (a) the swiftinterfaces for your dependencies generated by the Swift 5.2.4 compiler and (b) the swiftinterfaces in the Xcode 12 beta SDKs correctly.

2 Likes