Skip to content
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

Update android ndk version to latest LTS(r23c) #2832

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,45 @@

set -ex

NDK=android-ndk-r21d
wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux-x86_64.zip
unzip -q ${NDK}-linux-x86_64.zip
NDK=android-ndk-r23c
wget --tries=20 -q https://dl.google.com/android/repository/${NDK}-linux.zip
unzip -q ${NDK}-linux.zip

case "$1" in
arm)
arch=arm
api=28
api=31
;;
armv7)
arch=arm
api=28
api=31
;;
aarch64)
arch=arm64
api=28
api=31
;;
i686)
arch=x86
api=28
api=31
;;
x86_64)
arch=x86_64
api=28
api=31
;;
*)
echo "invalid arch: $1"
exit 1
;;
esac;

STANDALONE_NDK="/android/ndk-${1}"
python3 ${NDK}/build/tools/make_standalone_toolchain.py \
--install-dir "/android/ndk-${1}" \
--install-dir "${STANDALONE_NDK}" \
--arch "${arch}" \
--api ${api}

# FIXME: workaround of ndk23 https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946
find "${STANDALONE_NDK}" -name "libunwind.a" -exec sh -c \
'printf "INPUT(-lunwind)" > $(dirname $1)/libgcc.a' shell {} \;

rm -rf ./${NDK}-linux-x86_64.zip ./${NDK}
5 changes: 3 additions & 2 deletions ci/docker/aarch64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \
CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android31-clang \
CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \
CC_aarch64_linux_android=aarch64-linux-android28-clang \
CC_aarch64_linux_android=aarch64-linux-android31-clang \
AR=llvm-ar \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand Down
1 change: 1 addition & 0 deletions ci/docker/arm-linux-androideabi/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \
CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \
CC_arm_linux_androideabi=arm-linux-androideabi-gcc \
AR=llvm-ar \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand Down
5 changes: 3 additions & 2 deletions ci/docker/i686-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ RUN chmod 777 -R /tmp/.android
RUN chmod 755 /android/sdk/cmdline-tools/tools/* /android/sdk/emulator/qemu/linux-x86_64/*

ENV PATH=$PATH:/rust/bin \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc \
CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android31-clang \
CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \
CC_i686_linux_android=i686-linux-android-gcc \
CC_i686_linux_android=i686-linux-android31-clang \
AR=llvm-ar \
HOME=/tmp

ADD runtest-android.rs /tmp/runtest.rs
Expand Down
7 changes: 4 additions & 3 deletions ci/docker/x86_64-linux-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ COPY android-sysimage.sh /android/
RUN bash /android/android-sysimage.sh x86_64 x86_64-24_r07.zip

ENV PATH=$PATH:/rust/bin:/android/ndk-$ANDROID_ARCH/bin \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android-gcc \
CC_x86_64_linux_android=x86_64-linux-android-gcc \
CXX_x86_64_linux_android=x86_64-linux-android-g++ \
CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android31-clang \
CC_x86_64_linux_android=x86_64-linux-android31-clang \
AR=llvm-ar \
CXX_x86_64_linux_android=x86_64-linux-android31-clang++ \
HOME=/tmp
10 changes: 8 additions & 2 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,10 @@ fn test_android(target: &str) {
// incorrect, see: https://github.com/rust-lang/libc/issues/1359
(struct_ == "sigaction" && field == "sa_sigaction") ||
// signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet.
(struct_ == "signalfd_siginfo" && field == "ssi_call_addr")
(struct_ == "signalfd_siginfo" && field == "ssi_call_addr") ||
// FIXME: svm_zero of sockaddr_vm has been changed in ndk r23c
// see: https://github.com/rust-lang/libc/pull/2832
(struct_ == "sockaddr_vm" && field == "svm_zero")
});

cfg.skip_field(move |struct_, field| {
Expand All @@ -1786,7 +1789,10 @@ fn test_android(target: &str) {
// signalfd had SIGSYS fields added in Android 4.19, but CI does not have that version yet.
(struct_ == "signalfd_siginfo" && (field == "ssi_syscall" ||
field == "ssi_call_addr" ||
field == "ssi_arch"))
field == "ssi_arch")) ||
// FIXME: svm_zero of sockaddr_vm has been changed in ndk r23c
// see: https://github.com/rust-lang/libc/pull/2832
(struct_ == "sockaddr_vm" && field == "svm_zero")
});

cfg.skip_field(|struct_, field| {
Expand Down