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
Foundation: repair the build for Android API level 28+ #4889
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please test |
I have a similar pull submitted months ago, #4850, that simply has not been reviewed, which only doesn't have your |
The newer level introduces APIs with additional nullability attribution. This causes issues as the attribution sometimes collides with expectations. Unwrap more cases to appease the nullability attributes. One problematic area of this change is the handling for `Process.run()`. The posix spawn APIs are described as: ``` typedef struct __posix_spawnattr* posix_spawnattr_t; int posix_spawnattr_init(posix_spawnattr_t _Nonnull * _Nonnull __attr); ``` As the inner `_Nonnull` appertains to `posix_spawnattr_t`, it expects a non-null pointer to a non-null pointer. However, as `struct __posix_spawnattr` is opaque, we cannot allocate space for it and thus must be acceptable to take a pointer to null to permit the allocation.
@swift-ci please test |
Oh, nice, I was just going to try building this repo natively on Android with your recent compiler pulls, will apply your Glibc-replacing changes here. I also need to reconcile my earlier pull #4850 for the nullability annotations in NDK 26 with Saleem's first commit here, will try to get to that this week. |
@usableFromInline let free = Android.free | ||
@usableFromInline let memset = Android.memset | ||
@usableFromInline let memcpy = Android.memcpy | ||
@usableFromInline let memcmp = Android.memcmp |
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.
Trying to build with this commit now, looks like you missed an import Android
17 lines below this block.
@@ -25,6 +25,10 @@ import WinSDK | |||
import WASILibc | |||
#endif | |||
|
|||
#if os(Android) |
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.
canImport(Android)
@@ -13,6 +13,7 @@ import WinSDK | |||
#endif | |||
|
|||
#if os(Android) |
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.
canImport(Android)
@@ -13,6 +13,7 @@ import WinSDK | |||
#endif | |||
|
|||
#if os(Android) | |||
import Android | |||
// Android Glibc differs a little with respect to the Linux Glibc. |
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.
Android Glibc
-> Android Bionic
The newer level introduces APIs with additional nullability attribution. This causes issues as the attribution sometimes collides with expectations. Unwrap more cases to appease the nullability attributes. One problematic area of this change is the handling for
Process.run()
. The posix spawn APIs are described as:As the inner
_Nonnull
appertains toposix_spawnattr_t
, it expects a non-null pointer to a non-null pointer. However, asstruct __posix_spawnattr
is opaque, we cannot allocate space for it and thus must be acceptable to take a pointer to null to permit the allocation.