Open marcprux opened 1 week ago
What Android APIs are you running it on in the emulator? List out what APIs you tried for each of arm and x86.
Is this something that termux-elf-cleaner might help with?
No, I tried, it doesn't. This is related to the TLS issue I mentioned earlier.
This is related to the TLS issue I mentioned earlier.
FTR, the issue mentioned is: https://github.com/finagolfin/swift-android-sdk/pull/170#issuecomment-2351990840
What Android APIs are you running it on in the emulator? List out what APIs you tried for each of arm and x86.
I haven't tested against arm API variations yet, but on x86, testing swift-algorithms fails against API 25–28, and passes on API 29+ (see https://github.com/marcprux/swift-algorithms/actions/runs/11114132859). This tracks with the note about TLS becoming available in API 29: https://github.com/aosp-mirror/platform_bionic/blob/master/android-changes-for-ndk-developers.md#elf-tls-available-for-api-level--29
I haven't tested against arm API variations yet
OK, but you tested it on some AArch64 device or emulator, what API was that? I just wonder if it works before API 29 on AArch64.
This tracks with the note about TLS becoming available in API 29
Yep, this is why I raised the API used on the CI emulator from 24 to 29 with Swift 6, because all the test runners were failing otherwise.
The problem is that a Swift file in Foundation calls that inline _swift_stdlib_gettid()
function from the stdlib's synchronization shims that now uses a TLS variable, and that C++ code is presumably compiled by the Swift compiler somehow without specifying an API level, which on Android then defaults to the latest API level, ie with native TLS.
We'll need to find where in the Swift compiler such inline compilation of C++ functions is done and check what it's doing wrong. The full target triple with the API level is passed to the ClangImporter
that integrates C/C++ headers, so I'm not sure why this C++ compilation doesn't.
OK, but you tested it on some AArch64 device or emulator, what API was that? I just wonder if it works before API 29 on AArch64.
It was API 34.
When building and running tests against
swift-algorithms
on an x86 host+emulator with the Swift 6.0 Android toolchain, I'm seeing the following warning and error:This doesn't occur when running on an arm host+emulator (the tests all run and pass on my machine).
It's especially odd, since this package is passing tests on CI.
Is this something that termux-elf-cleaner might help with? I notice that we are using it in CI, but only for the
swift-argument-parser
tests and not any other packages.