-
Notifications
You must be signed in to change notification settings - Fork 25
Where is concurrency lib? #138
Comments
I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples. Will try to use few "new concurrency" examples on Android. |
Thanks!
Happy Holidays !
… On Dec 29, 2021, at 10:02 AM, Vlad Gorlov ***@***.***> wrote:
I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples <https://github.com/vgorloff/swift-everywhere-samples>.
I conducted few examples on macOS 12 / Xcode 13.1, but not yet used "new concurrency" in production or commercial apps.
Will try to use few "new concurrency" examples on Android.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PMCVFAWMUERQZ2XWOTUTMWK5ANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
Oh, and we use the new concurrency on iOS/macOS/Linux and its good now for normal operations.
… On Dec 29, 2021, at 1:15 PM, John Burkey ***@***.***> wrote:
Thanks!
Happy Holidays !
> On Dec 29, 2021, at 10:02 AM, Vlad Gorlov ***@***.*** ***@***.***>> wrote:
>
>
> I wasn't used "new concurrency" on Android yet. For example, in this project - https://github.com/vgorloff/swift-everywhere-samples <https://github.com/vgorloff/swift-everywhere-samples>.
> I conducted few examples on macOS 12 / Xcode 13.1, but not yet used "new concurrency" in production or commercial apps.
>
> Will try to use few "new concurrency" examples on Android.
>
> —
> Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PMCVFAWMUERQZ2XWOTUTMWK5ANCNFSM5K57HZOQ>.
> You are receiving this because you authored the thread.
>
|
Building Concurrency example (645e75d) gives me the following error:
Seems the |
The
|
There is a chicken-egg problem "dispatch needs stdlib" and, at the same time, "stdlib needs dispatch". # File: stdlib/public/Concurrency/CMakeLists.txt
if(SWIFT_CONCURRENCY_USES_DISPATCH)
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
include_directories(AFTER
${SWIFT_PATH_TO_LIBDISPATCH_SOURCE})
# FIXME: we can't rely on libdispatch having been built for the
# target at this point in the process. Currently, we're relying
# on soft-linking.
list(APPEND swift_concurrency_link_libraries
dispatch)
endif()
endif() |
To build |
|
:-)
…Sent from my iPhone
On Jan 1, 2022, at 8:40 AM, Vlad Gorlov ***@***.***> wrote:
Dispatch subproject fails to build due compiler flag -Werror :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
does it build? |
I will try to figure out in coming days how to pass arguments to external project (dispatch in our case). After quick search I didn't managed to find "who" is passing that |
Maybe ping compnerd on slack channel for swift on android ? He’s awesome and very aquatinted with stuff like this as he’s the windows build champ on top of all of his other magic.
… On Jan 5, 2022, at 2:50 AM, Vlad Gorlov ***@***.***> wrote:
I will try to figure out in coming days how to pass arguments to external project (dispatch in our case). After quick search I didn't managed to find "who" is passing that -Werror flag. Maybe it is a CMake default.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Sounds like they want to do a strategy discussion with you too - Nice folks . |
Building of "libdispatch" is not a problem. There is already builder for it (https://github.com/vgorloff/swift-everywhere-toolchain/blob/master/lib/Builders/DispatchBuilder.js). Issue that CMake is a functional-programming thing which consumes time to figure out needed options to pass :) |
Compnerd knows the swift builds super well just thinking he could save you time ;-)
… On Jan 5, 2022, at 4:14 PM, Vlad Gorlov ***@***.***> wrote:
Building of "libdispatch" is not a problem. There is already builder for it (https://github.com/vgorloff/swift-everywhere-toolchain/blob/master/lib/Builders/DispatchBuilder.js). Issue that CMake is a functional-programming thing which consumes time to figure out needed options to pass :)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Seems "libDispatch" itself defined compiler flags here: https://github.com/apple/swift-corelibs-libdispatch/blob/swift-5.5.2-RELEASE/cmake/modules/DispatchCompilerWarnings.cmake Strange why I don't have this issue when building libdispatch standalone. Maybe because i am passing C/CXX flags explicitly. |
The issue with if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
add_compile_options($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:-Wno-unused-command-line-argument>)
endif() The next error seems due minSDKVersion 21 (https://stackoverflow.com/a/53217341/1418981):
Cmake uses SDK 16 by default:
|
Passing Next error when building for
|
When I am building libdispatch as standalone, the Thus the following configure error seems due unneeded flag
|
When building stdlib, I am passing manually the C flag |
Next error:
Obviously because libdispatch for some reason was built for armv7 instead for aarch64 :)
|
For some reason the option |
The above issue fixed by passing Cmake flag |
Ok. I am able to build Now it is time to make clean rebuild of Swift, stdlib, libDispatch, libFoundation and then try Async/Await example again. |
Yay!
…
On Jan 6, 2022, at 4:13 AM, Vlad Gorlov ***@***.***> wrote:
Ok. I am able to build stdlib with libswift_Concurrency.so for all 4 Android archs: arm 32/64 bit and x86 32/64 bit.
Now it is time to make clean rebuild of Swift, stdlib, libDispatch, libFoundation and then try Async/Await example again.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
But sample code which works on macOS crashes with |
Getting closer!
… On Jan 6, 2022, at 8:55 AM, Vlad Gorlov ***@***.***> wrote:
But sample code which works on macOS crashes with Segmentation fault on Android :0
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PIP2MVFZVD6ODCD4J3UUWUONANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
I will try one idea, but if it won't work, then I will come back to troubleshooting after next major release of Swift - Swift 5.5.3 or Swift 5.6.0. The Swift Concurrency is experimental thing. |
I think that flag is the old flag when it was experimental - i haven’t had any issues with the feature since they fixed the bugs just post 5.5.
I’m sure compnerd has good advice on this - find him in the slack channel ?
… On Jan 6, 2022, at 9:11 AM, Vlad Gorlov ***@***.***> wrote:
I will try one idea, but if it won't work, then I will come back to troubleshooting after next major release of Swift - Swift 5.5.3 or Swift 5.6.0.
The Swift Concurrency is experimental thing.
Even Cmake option, which is used to activate this feature, defined as following -D SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=TRUE/FALSE
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
The release which builds concurrency is ready https://github.com/vgorloff/swift-everywhere-toolchain/releases/tag/1.0.78 |
Here is what
The issue is |
Got symbols ? |
Not too much:
|
The Concurrency actually working with latest toolchain, but for macOS and Android it works differently. public class SAConcurrencyMain {
private var task: Task<Void, Error>?
public init() {
print("[SAC] Concurrency: Init")
}
public func execute(completion: @escaping () -> Void) {
print("[SAC] Concurrency: Start")
#if !false
task = Task.detached(priority: .high) {
let urls = await self.getURLs()
print("[SAC] Concurrency: Got \(urls.count) urls.")
print("[SAC] Concurrency: End")
completion()
}
#else // Below works on macOS but crashes on Android. See: https://github.com/vgorloff/swift-everywhere-toolchain/issues/138
Task {
let task = Task.detached(priority: .userInitiated) { () -> Int in
let urls = await self.getURLs()
return urls.count
}
let value = await task.value
print("[SAC] Concurrency: Got \(value) urls.")
print("[SAC] Concurrency: End")
completion()
}
#endif
}
private func getURLs() async -> [String] {
Thread.sleep(forTimeInterval: 1)
return ["https://docs.swift.org/", "https://google.com/", "https://ibm.com/"]
}
} The Task {
let task = Task.detached(priority: .userInitiated) { () -> Int in
...
}
let value = await task.value
...
} |
So simple tasks work on droid but complicated ones (task inside task) crashes ?
…
On Jan 6, 2022, at 4:33 PM, Vlad Gorlov ***@***.***> wrote:
The Concurrency actually working with latest toolchain, but for macOS and Android it works differently.
public class SAConcurrencyMain {
private var task: Task<Void, Error>?
public init() {
print("[SAC] Concurrency: Init")
}
public func execute(completion: @escaping () -> Void) {
print("[SAC] Concurrency: Start")
#if !false
task = Task.detached(priority: .high) {
let urls = await self.getURLs()
print("[SAC] Concurrency: Got \(urls.count) urls.")
print("[SAC] Concurrency: End")
completion()
}
#else // Below works on macOS but crashes on Android. See: #138
Task {
let task = Task.detached(priority: .userInitiated) { () -> Int in
let urls = await self.getURLs()
return urls.count
}
let value = await task.value
print("[SAC] Concurrency: Got \(value) urls.")
print("[SAC] Concurrency: End")
completion()
}
#endif
}
private func getURLs() async -> [String] {
Thread.sleep(forTimeInterval: 1)
return ["https://docs.swift.org/", "https://google.com/", "https://ibm.com/"]
}
}
The Task inside a Task not working on Android, but works on macOS:
Task {
let task = Task.detached(priority: .userInitiated) { () -> Int in
...
}
let value = await task.value
...
}
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
True. Some pieces of Concurrency seems working on Android as on macOS. Others seems not. |
Let’s find the Linux concurrency people
…
On Jan 7, 2022, at 2:29 AM, Vlad Gorlov ***@***.***> wrote:
True. Some pieces of Concurrency seems working on Android as on macOS. Others seems not.
Maybe some kind of execution environment on Android is not fully initialised/configured (e.g. MainActor or similar).
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.
|
Hmm, looks like you're building the stdlib with the NDK clang, you have to make sure the Concurrency files are built with Apple's fork of clang. |
Hey! Thanks for this ! Can we jump on that slack channel on swift for android for higher bandwidth? Gorloff you game? I think Vlad is in Europe somewhere, so hoping to catch this "everyone is awake" window.. You don't really need me, i'm merely the pot stirrer. :-) |
Buttaface, any stability issues once you had it running? Saleem mentioned to me that he had to work over the libdispatch on windows stuff to get things stable. |
I'm not sure he's awake. 😉 I don't think there will be much to discuss, that is the only issue I've had with getting it working. I can't really speak to stability, as I don't use the new Concurrency runtime on Android much. However, I run the full compiler validation testsuite on Android with the latest trunk tag once a month, and all the Concurrency tests pass. |
Wake up VLAD ! :-)
Well hoping to have a powwow as needed to get him to a good place.
Then later we can all talk about how we can get assistance getting things you guys need into main?
I can imagine thats “fun”.
We currently use “course grained” actors enough that we should shake any first things loose.
… On Jan 7, 2022, at 11:25 AM, buttaface ***@***.***> wrote:
I'm not sure he's awake. 😉 I don't think there will be much to discuss, that is the only issue I've had with getting it working.
I can't really speak to stability, as I don't use the new Concurrency runtime on Android much. However, I run the full compiler validation testsuite on Android with the latest trunk tag once a month, and all the tests pass.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PJPZUMESCQF3KVPMY3UU4O2FANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
I think the issue is only because he doesn't use the official If you run into any issues with Concurrency on Android, just post it in the forums or the bug tracker and we'll take a look. |
Butta are you on the slack for swift for android ?
Higher bandwidth !
… On Jan 7, 2022, at 11:47 AM, buttaface ***@***.***> wrote:
I think the issue is only because he doesn't use the official build-script, whereas I'm now down to a couple small patches since I use that. There's not much left to upstream for me, just submitting the last handful of patches <https://github.com/search?q=org%3Aapple+author%3Abuttaface&state=open&type=Issues>.
If you run into any issues with Concurrency on Android, just post it in the forums or the bug tracker and we'll take a look.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PLVWR7MJRMM5WNHV7LUU4RKHANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
Interesting. I didn't know that LLVM has a new flag, which seems emits something into binary which seems is needed to support Concurrency feature. |
Can we all jump to slack for a couple minutes?
Butta you on that one?
swift-android.slack.com
… On Jan 7, 2022, at 11:50 AM, Vlad Gorlov ***@***.***> wrote:
Interesting. I didn't know that LLVM has a new flag, which seems emits something into binary which seems is needed to support Concurrency feature.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PMHBKJPMIF4TWFKTC3UU4RWVANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
I didn't know about that one. Vlad and I occasionally chat on another Slack: he can find me on there now if he wants. |
Which slack, can I jump there too? I promise to be nice.
… On Jan 7, 2022, at 11:58 AM, buttaface ***@***.***> wrote:
I didn't know about that one. Vlad and I occasionally chat on another Slack: he can find me on there now if he wants.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PN4NLCSTGNJFAPXEU3UU4SUNANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
I don't think we have invites or are even supposed to publicly talk about it yet. As you said, it's mostly me and him that might need to talk, so we'll get to it whenever. If you want us to look at something in particular, just post it here. |
Cool, no worries.
We will be standing by to test, and we build with swiftpm on Mac using his kit.
Good luck gents.
- John
… On Jan 7, 2022, at 12:02 PM, buttaface ***@***.***> wrote:
I don't think we have invites or are even supposed to publicly talk about it yet. As you said, it's mostly me and him that might need to talk, so we'll get to it whenever. If you want us to look at something in particular, just post it here.
—
Reply to this email directly, view it on GitHub <#138 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AC5F3PJO4PUBFP3W4SEVGWLUU4TDNANCNFSM5K57HZOQ>.
You are receiving this because you authored the thread.
|
Seems like I have to research first which NDK contains clang with Swift concurrency support. It seems easier way than building stdlib with system provided clang and then linking with NDK clang/linker. |
No, you can just use the forked Swift clang to both build and link the Swift stdlib, that works fine. That is what it does by default when you build the full Swift toolchain, so you must be overriding the stdlib build to use the NDK clang. Turn off that override and it should work fine. |
Ok. Then I have to look closer which I past there were some build issues (in this not official toolchain) when building some components using I even have an issue for this #101 |
OK, I didn't know you had issues with the Swift-forked clang before. The problem is this line, where you pass in the NDK clang to build the stdlib instead. I used to do that too, but switched to the Swift-forked clang a couple months ago to fix this issue with building the Concurrency library. |
How’s it going Vlad? |
Can we jump on slack for a few minutes ? I would like to help with this effort. |
Where is _concurrency lib :-)
See discussion section!
Happy Holidays!
The text was updated successfully, but these errors were encountered: