Skip to content

Commit

Permalink
Use Android NDK 27b and update 32-bit ARM Android API level to 21.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
briansmith committed Sep 27, 2024
1 parent 362ecc4 commit 1973e59
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
12 changes: 8 additions & 4 deletions mk/cargo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ qemu_x86_64="qemu-x86_64"
# be needed to compile the build script, or to compile for other targets.
if [ -n "${ANDROID_HOME-}" ]; then
# Keep the next line in sync with the corresponding line in install-build-tools.sh.
ndk_version=25.2.9519653
ndk_version=27.1.12297006
ANDROID_NDK_ROOT=${ANDROID_NDK_ROOT:-${ANDROID_HOME}/ndk/$ndk_version}
fi
if [ -n "${ANDROID_NDK_ROOT-}" ]; then
Expand Down Expand Up @@ -67,7 +67,7 @@ case $target in
aarch64-linux-android)
export CC_aarch64_linux_android=$android_tools/aarch64-linux-android21-clang
export AR_aarch64_linux_android=$android_tools/llvm-ar
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$android_tools/aarch64-linux-android21-clang
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=$CC_aarch64_linux_android
;;
aarch64-unknown-linux-gnu)
use_clang=1
Expand All @@ -94,9 +94,13 @@ case $target in
export CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_RUNNER="$qemu_arm_gnueabihf"
;;
armv7-linux-androideabi)
export CC_armv7_linux_androideabi=$android_tools/armv7a-linux-androideabi19-clang
# https://github.com/android/ndk/wiki/Changelog-r26#announcements says API
# level 21 is the minimum supported as of NDK 26, even though we'd like to
# support API level 19. Rust 1.82 is doing the same; see
# https://github.com/rust-lang/rust/commit/6ef11b81c2c02c3c4b7556d1991a98572fe9af87.
export CC_armv7_linux_androideabi=$android_tools/armv7a-linux-androideabi21-clang
export AR_armv7_linux_androideabi=$android_tools/llvm-ar
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$android_tools/armv7a-linux-androideabi19-clang
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=$CC_armv7_linux_androideabi
;;
armv7-unknown-linux-gnueabihf)
export CC_armv7_unknown_linux_gnueabihf=arm-linux-gnueabihf-gcc
Expand Down
17 changes: 9 additions & 8 deletions mk/install-build-tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,18 @@ case ${target-} in
# https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html says
# "Going forward the Android platform will target the most recent LTS NDK,
# allowing Rust developers to access platform features sooner. These updates
# should occur yearly and will be announced in release notes." Assume that
# means that we should always prefer to be using the latest 25.x.y version of
# the NDK until the Rust project announces that we should use a higher major
# version number.
# should occur yearly and will be announced in release notes."
#
# TODO: This should probably be implemented as a map of Rust toolchain version
# to NDK version; e.g. our MSRV might (only) support an older NDK than the
# latest stable Rust toolchain.
# https://github.com/actions/runner-images/issues/10614 indicates that GitHub
# actions doesn't intend to keep unsupported versions around, so in general
# we'll end up only supporting the latest NDK even for MSRV builds.
#
# https://developer.android.com/ndk/guides/other_build_systems explains how
# to set the API level.
#
# Keep the following line in sync with the corresponding line in cargo.sh.
ndk_version=25.2.9519653
#
ndk_version=27.1.12297006

mkdir -p "${ANDROID_HOME}/licenses"
android_license_file="${ANDROID_HOME}/licenses/android-sdk-license"
Expand Down

0 comments on commit 1973e59

Please sign in to comment.