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 = SRWLOCK | ||
| #else | ||
| typealias Primitive = Int | ||
| #error("Unsupported platform") |
There was a problem hiding this comment.
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
Add support for Musl
Also error if platform is not recognised.