Skip to content

Commit 0ff704d

Browse files
committed
Use Android NDK 27b and update 32-bit ARM Android API level to 21.
The version of the Android NDK used in GitHub Actions, /usr/local/lib/android/sdk/ndk/27.1.12297006, doesn't support SDK version 19 (or 20) any more.
1 parent 362ecc4 commit 0ff704d

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

mk/cargo.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ qemu_x86_64="qemu-x86_64"
3939
# be needed to compile the build script, or to compile for other targets.
4040
if [ -n "${ANDROID_HOME-}" ]; then
4141
# Keep the next line in sync with the corresponding line in install-build-tools.sh.
42-
ndk_version=25.2.9519653
42+
ndk_version=27.1.12297006
4343
ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-${ANDROID_HOME}/ndk/$ndk_version}
4444
fi
4545
if [ -n "${ANDROID_NDK_ROOT-}" ]; then
@@ -67,7 +67,7 @@ case $target in
6767
aarch64-linux-android)
6868
export CC_aarch64_linux_android=$android_tools/aarch64-linux-android21-clang
6969
export AR_aarch64_linux_android=$android_tools/llvm-ar
70-
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$android_tools/aarch64-linux-android21-clang
70+
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$CC_aarch64_linux_android
7171
;;
7272
aarch64-unknown-linux-gnu)
7373
use_clang=1
@@ -94,9 +94,13 @@ case $target in
9494
export CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="$qemu_arm_gnueabihf"
9595
;;
9696
armv7-linux-androideabi)
97-
export CC_armv7_linux_androideabi=$android_tools/armv7a-linux-androideabi19-clang
97+
# https://github.com/android/ndk/wiki/Changelog-r26#announcements says API
98+
# level 21 is the minimum supported as of NDK 26, even though we'd like to
99+
# support API level 19. Rust 1.82 is doing the same; see
100+
# https://github.com/rust-lang/rust/commit/6ef11b81c2c02c3c4b7556d1991a98572fe9af87.
101+
export CC_armv7_linux_androideabi=$android_tools/armv7a-linux-androideabi21-clang
98102
export AR_armv7_linux_androideabi=$android_tools/llvm-ar
99-
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$android_tools/armv7a-linux-androideabi19-clang
103+
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$CC_armv7_linux_androideabi
100104
;;
101105
armv7-unknown-linux-gnueabihf)
102106
export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc

mk/install-build-tools.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,18 @@ case ${target-} in
4141
# https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html says
4242
# "Going forward the Android platform will target the most recent LTS NDK,
4343
# allowing Rust developers to access platform features sooner. These updates
44-
# should occur yearly and will be announced in release notes." Assume that
45-
# means that we should always prefer to be using the latest 25.x.y version of
46-
# the NDK until the Rust project announces that we should use a higher major
47-
# version number.
44+
# should occur yearly and will be announced in release notes.
4845
#
49-
# TODO: This should probably be implemented as a map of Rust toolchain version
50-
# to NDK version; e.g. our MSRV might (only) support an older NDK than the
51-
# latest stable Rust toolchain.
46+
# https://github.com/actions/runner-images/issues/10614 indicates that GitHub
47+
# actions doesn't intend to keep unsupported versions around, so in general
48+
# we'll end up only supporting the latest NDK even for MSRV builds.
49+
#
50+
# https://developer.android.com/ndk/guides/other_build_systems explains how
51+
# to set the API level.
5252
#
5353
# Keep the following line in sync with the corresponding line in cargo.sh.
54-
ndk_version=25.2.9519653
54+
#
55+
ndk_version=27.1.12297006
5556

5657
mkdir -p "${ANDROID_HOME}/licenses"
5758
android_license_file="${ANDROID_HOME}/licenses/android-sdk-license"

0 commit comments

Comments
 (0)