Skip to content

Commit

Permalink
Update android ndk version to latest LTS(r23c): https://developer.and…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiann committed Jun 25, 2022
1 parent fc10a37 commit f35c18e
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 17 deletions.
21 changes: 13 additions & 8 deletions ci/android-install-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,30 @@

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"
Expand All @@ -38,4 +38,9 @@ python3 ${NDK}/build/tools/make_standalone_toolchain.py \
--arch "${arch}" \
--api ${api}

# FIXME: workaround of ndk23 https://github.com/rust-lang/rust/pull/85806#issuecomment-1096266946
for libunwind in $(find ${NDK} -name 'libunwind.a'); do
echo -n "INPUT(-lunwind)" > $(dirname $libunwind)/libgcc.a
done

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

0 comments on commit f35c18e

Please sign in to comment.