Skip to content

Xcode 26 beta 1 - Compiler crash (fixed in beta 2) #781

@groue

Description

@groue

Description

When I build my package that uses OpenAPIGenerator with Xcode 26 beta, I see the compiler crash when it compiles _OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift.

1.	Apple Swift version 6.2 (swiftlang-6.2.0.9.909 clang-1700.3.9.907)
2.	Compiling with effective version 5.10
3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for _OpenAPIGeneratorCore)
4.	While running pass #403 SILFunctionTransform "SendNonSendable" on SILFunction "@$s21_OpenAPIGeneratorCore11TypeMatcherV14isKeyValuePair_14referenceStack10componentsSb0A6APIKit10JSONSchemaV_AA09ReferenceK0VzAG0A3APIO10ComponentsVtKF".
 for 'isKeyValuePair(_:referenceStack:components:)' (at XXX/Library/Developer/Xcode/DerivedData/XXX/SourcePackages/checkouts/swift-openapi-generator/Sources/_OpenAPIGeneratorCore/Translator/TypeAssignment/TypeMatcher.swift:177:5)

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           0x0000000108ea3cb0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000108ea1640 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000108ea42dc SignalHandler(int, __siginfo*, void*) + 344
3  libsystem_platform.dylib 0x00000001883af624 _sigtramp + 56
4  libsystem_pthread.dylib  0x000000018837588c pthread_kill + 296
5  libsystem_c.dylib        0x000000018827ec60 abort + 124
6  swift-frontend           0x0000000103c46d7c swift::Partition::assignElement(swift::PartitionPrimitives::Element, swift::PartitionPrimitives::Element, bool) + 96
7  swift-frontend           0x00000001037a1dac swift::RegionAnalysisFunctionInfo::runDataflow() + 5876
8  swift-frontend           0x00000001037a5878 swift::RegionAnalysis::newFunctionAnalysis(swift::SILFunction*) + 1668
9  swift-frontend           0x0000000103a06ed4 (anonymous namespace)::SendNonSendable::run() + 280
10 swift-frontend           0x0000000103a466cc swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 3332
11 swift-frontend           0x0000000103a42740 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 11988
12 swift-frontend           0x0000000103a653d4 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 52
13 swift-frontend           0x0000000103a49190 swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) + 412
14 swift-frontend           0x0000000103a4b76c swift::runSILDiagnosticPasses(swift::SILModule&) + 416
15 swift-frontend           0x0000000102efce4c swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 656
16 swift-frontend           0x0000000102b18ad0 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*) + 1360
17 swift-frontend           0x0000000102b17dbc swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1032
18 swift-frontend           0x0000000102b1b0e0 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
19 swift-frontend           0x0000000102b19cfc swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3580
20 swift-frontend           0x0000000102a9b390 swift::mainEntry(int, char const**) + 5412
21 dyld                     0x0000000187fd6b4c start + 6000

Maybe there exists a workaround in OpenAPIGenerator for this compiler crash?

Reproduction

n/d

Package version(s)

Swift OpenAPI Generator 1.8.0

Expected behavior

No compiler crash

Environment

Xcode 26.0 beta (17A5241e)

Additional information

No response

Activity

added
kind/bugFeature doesn't work as expected.
status/triageCollecting information required to triage the issue.
on Jun 9, 2025
czechboy0

czechboy0 commented on Jun 9, 2025

@czechboy0
Contributor

Hi @groue,

this was fixed the Swift compiler: swiftlang/swift#81187 (comment)

A potential workaround would be to switch the toolchain in Xcode to one with the fix.

groue

groue commented on Jun 9, 2025

@groue
Author

Thank you @czechboy0, I'll try and report! I'm eager to see the new look of my OpenAPI-generator-powered apps :)

frogg

frogg commented on Jun 10, 2025

@frogg

I’m having the same issue.

I’m on the latest Xcode version (Version 26.0 beta (17A5241e)).

PS: I dont really want to compile Swift myself, it would be great if there was a fix within the swift package.

groue

groue commented on Jun 10, 2025

@groue
Author

I'll try and report!

I downloaded the latest toolchain from https://www.swift.org/install/macos/ (swift-DEVELOPMENT-SNAPSHOT-2025-06-03-a.xctoolchain), but now I have another error:

failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.9.904 clang-1700.3.9.904)', while this compiler is 'Apple Swift version 6.2-dev effective-5.10 (LLVM b5d039be1fbae13, Swift 4fb4945ab972c85)'). Please select a toolchain which matches the SDK.

I'm stuck.

I have two distinct suggestions:

  • Please submit the OpenAPI Generator repositories to https://github.com/swiftlang/swift-source-compat-suite. This should help spotting such compiler regression earlier in the future.

  • Please consider shipping a workaround in OpenAPI Generator, if possible, even if it's temporary. Sounds useless, I know, but for many users of this repository, it's the difference between being able to work now, and being able to work eventually, at some indeterminate time in the future, when Apple decides that a new Xcode that includes the fix is shipped.

czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

Please submit the OpenAPI Generator repositories to https://github.com/swiftlang/swift-source-compat-suite. This should help spotting such compiler regression earlier in the future.

We did: swiftlang/swift-source-compat-suite#1003

Please consider shipping a workaround in OpenAPI Generator, if possible, even if it's temporary.

We considered this, unfortunately due to the compiler bug (that's now fixed) affecting all indirect enum types, that'd require a larger code change than just a few line workaround.

czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

I downloaded the latest toolchain from https://www.swift.org/install/macos/ (swift-DEVELOPMENT-SNAPSHOT-2025-06-03-a.xctoolchain), but now I have another error:

You'll need the release/6.2 branch toolchain, not the main branch toolchain, so for example: https://download.swift.org/swift-6.2-branch/xcode/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a-osx.pkg

That seems to work around the crasher for me, please let me know if it still doesn't work for you though 🙏

groue

groue commented on Jun 10, 2025

@groue
Author

All right @czechboy0, I'll try again and report.

And thanks for submitting to the compat suite. From my previous experiences (last one), the maintainers can be quite slow to proceed, and can surprisingly block the submission of code that reveals compatibility issues. Maybe try to apply a gentle push, eventually. Due to the upcoming release of Swift 6.2, now looks like a perfect time for effectively merging code into the compatibility suite.

hactar

hactar commented on Jun 10, 2025

@hactar

I downloaded the latest toolchain from https://www.swift.org/install/macos/ (swift-DEVELOPMENT-SNAPSHOT-2025-06-03-a.xctoolchain), but now I have another error:

You'll need the release/6.2 branch toolchain, not the main branch toolchain, so for example: https://download.swift.org/swift-6.2-branch/xcode/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a/swift-6.2-DEVELOPMENT-SNAPSHOT-2025-05-30-a-osx.pkg

That seems to work around the crasher for me, please let me know if it still doesn't work for you though 🙏

Hmm, I downloaded the specific toolchain you linked @czechboy0, installed it, and switched Xcode to use it. When building any iOS project however, I get this error:

/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator26.0.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64-apple-ios-simulator.swiftinterface:1:1 failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.9.904 clang-1700.3.9.904)', while this compiler is 'Apple Swift version 6.2-dev effective-5.10 (LLVM 0d47fa0a0fd41fb, Swift 536aa932a9e0ea3)'). Please select a toolchain which matches the SDK.
czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

@hactar sorry about that, I only tested when building against the macOS SDK - do you also reproduce it when building a macOS CLI tool using Swift OpenAPI Generator, for example https://github.com/apple/swift-openapi-generator/tree/main/Examples/hello-world-urlsession-client-example?

czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

Maybe @cmcgee1024 can tell us if this is expected

hactar

hactar commented on Jun 10, 2025

@hactar

@hactar sorry about that, I only tested when building against the macOS SDK - do you also reproduce it when building a macOS CLI tool using Swift OpenAPI Generator, for example https://github.com/apple/swift-openapi-generator/tree/main/Examples/hello-world-urlsession-client-example?

Hmm, yes I can reproduce this for my Hummingbird swift on server project targeting MacOS.

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-macos.swiftinterface:1:1 failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.9.904 clang-1700.3.9.904)', while this compiler is 'Apple Swift version 6.2-dev effective-5.10 (LLVM 0d47fa0a0fd41fb, Swift 536aa932a9e0ea3)'). Please select a toolchain which matches the SDK.

czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

You're right, @hactar - using the same exact tools, I'm also seeing the error.

czechboy0

czechboy0 commented on Jun 10, 2025

@czechboy0
Contributor

A workaround appears to be to manually edit /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX26.0.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-macos.swiftinterface and replace the erroring occurrences of #available(macOS 16, iOS 19, tvOS 19, watchOS 12, visionOS 3, *) with #available(macOS 26, iOS 26, tvOS 26, watchOS 26, visionOS 26, *). Please confirm if this at least unblocks you or if you're still hitting this.

Note the MacOSX26.0.sdk in the path, so if you're testing against an iOS project, you might need to edit the corresponding file in that SDK's path.

18 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.status/triageCollecting information required to triage the issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @groue@hactar@czechboy0@frogg@wangzhizhou

        Issue actions

          Xcode 26 beta 1 - Compiler crash (fixed in beta 2) · Issue #781 · apple/swift-openapi-generator