New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SwiftPM built with Swift 6.0 and later snapshots crashes on macOS 14 #73327
Comments
Hmm, due to the absolute install_name specified by |
Another approach might be reverting #22658 and making |
#72801 seems trying to solve the same issue for typed throws |
+1 I'm hitting this locally on my Mac running 14.0 |
The issue only seems to reproduce when SwiftPM is built with 6.0 toolchains. I can't reproduce these crashes when building SwiftPM itself with Swift 5.10. IMO this should be moved to the toolchain repository. |
Is it reproducible with SwiftPM command-line tools:
swift build
,swift test
,swift package
etc?Description
You can reproduce the crash by running the following simple command on macOS 14 and later with swift-DEVELOPMENT-SNAPSHOT-2024-04-09-a or later.
The segmentation fault is caused by trying to dereference an async function pointer
$ss23withCheckedContinuation9isolation8function_xScA_pSgYi_SSyScCyxs5NeverOGXEtYalFTu
, which is introduced by #72578 and only available in toolchain stdlib but unavailable in OS stdlib yet.Note that #72578 itself is not wrong, but it just revealed a long-living issue.
Solution?
All images compiled with snapshot toolchains should use toolchain stdlib instead of OS stdlib because:
_stdlib_isOSVersionAtLeast(9999._builtinWordValue, 0._builtinWordValue, 0._builtinWordValue)
always returns true after [Stdlib] Special-case major version 9999 as always available. #22658@available(macOS 9999, ...)
until the version is fixed to be a concrete OS version.if #available
and@backDeploy
check the running OS version by using_stdlib_isOSVersionAtLeast
, and it leads to referencing symbols with@available(macOS 9999)
at runtime.So as long as we use the availability placeholder, executables built with such stdlib must link exactly the same stdlib library at runtime.
Why it doesn't happen on macOS 13 or earlier?
It looks like the
/usr/lib/swift/libswiftCore.dylib
in the version did not include #22658, so_stdlib_isOSVersionAtLeast(9999._builtinWordValue, 0._builtinWordValue, 0._builtinWordValue)
returns false.Alternative Consideration
You might think we can revert #22658 not to make APIs marked with the placeholder always available and adjust test suites. However the implementation is already shipped as a part of macOS 14, so the issue remains as long as we use macOS 14.
Expected behavior
Not crash
Swift & OS version (output of
swift --version ; uname -a
)The text was updated successfully, but these errors were encountered: