-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add Musl import, error if unrecognised platform #325
Conversation
@finagolfin you may be interested in this. |
Thanks for the head's up, but I don't actually use Musl. I've just been tinkering with it because I want to release a similar SDK bundle for Android. I will need to submit a similar pull soon to this repo for Bionic though, as I have a local patch for that currently. |
It was more about the package not compiling for Android anymore when it did before. |
OK, this package should cross-compile fine for Android with the current 5.10 release, but the upcoming 6.0 release uses a new Android overlay, that this package has not been ported to yet. I have the trivial patch needed for that available locally on my Android phone, just need to clean it up and submit it. |
Ah that was the problem I found with Musl. It compiled fine, but the actual code caused crashes given the lock primitive defaulted to
|
@swift-ci please test |
typealias Primitive = pthread_mutex_t | ||
#elseif canImport(WinSDK) | ||
typealias Primitive = SRWLOCK | ||
#else | ||
typealias Primitive = Int | ||
#error("Unsupported platform") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From gitblame it seem like this was added for web assembly:
https://github.com/apple/swift-async-algorithms/pull/273/files
Which seems that this can be checked for with arch(wasm32) or os(WASI)
There is also an underscore check for multithreading: #if _runtime(_multithreaded)
This was added in swiftlang/swift#72649
swift-testing uses a combination of os(WASI) and _runtime(_multithreaded) combined with compiler(>=6.1)
https://github.com/swiftlang/swift-testing/pull/322/files
FWIW Mutex has just landed in Swift 6.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc: @0xpablo
Add support for Musl
Also error if platform is not recognised.