Skip to content

Build for armv7 Android in CI and fix the resulting build errors - #387

Merged
iCharlesHu merged 1 commit into
mainfrom
jake-petroules/androidtriples
Oct 15, 2026
Merged

iCharlesHu merged 1 commit into
mainfrom
jake-petroules/androidtriples

Conversation

@jakepetroules

Copy link
Copy Markdown
Contributor

Adds android_sdk_triples to the pull request workflow so the Swift SDK for Android build covers all three architectures: aarch64, armv7, and x86_64. x86_64 stays last because the reusable workflow uses the final triple for emulator testing, and it must match the host architecture.

Building for armv7 then failed because on 32-bit Android st_mode is a UInt32 while mode_t is a UInt16, so status.st_mode & mode_t(S_IFMT) does not type-check. This affected executableAccessible and the working-directory validation in the spawn path. Both now convert the S_IF* constants to st_mode's own type with numericCast instead of assuming it is mode_t. The constants fit in every platform's st_mode type, so the conversion is lossless.

Testing

Built locally with the Swift 6.4.0 release toolchain:

  • Android aarch64, armv7, and x86_64 (API 28, with --build-tests), plus armv7 in release
  • Linux static SDK aarch64-swift-linux-musl and x86_64-swift-linux-musl
  • macOS, with --build-tests

Add android_sdk_triples to the pull request workflow so the Swift SDK
for Android build covers aarch64, armv7 and x86_64. x86_64 stays last
because the reusable workflow uses the final triple for emulator
testing, and it must match the host architecture.

Building for armv7 failed because on 32-bit Android `st_mode` is a
UInt32 while `mode_t` is a UInt16, so masking `st_mode` with
`mode_t(S_IFMT)` does not type-check. Convert the S_IF* constants to
`st_mode`'s own type with numericCast instead of assuming it is
`mode_t`. The constants fit in every platform's `st_mode` type, so the
conversion is lossless.
@iCharlesHu
iCharlesHu merged commit dbe21bd into main Oct 15, 2026
46 checks passed
@jakepetroules
jakepetroules deleted the jake-petroules/androidtriples branch October 15, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants