diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index 463565125972f..2b9e5aef97d81 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -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" @@ -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} diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 0aa99eeea10ae..9658e2d34e42e 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -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 diff --git a/ci/docker/arm-linux-androideabi/Dockerfile b/ci/docker/arm-linux-androideabi/Dockerfile index e5cc79d87fd1b..538a0be845442 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -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 diff --git a/ci/docker/i686-linux-android/Dockerfile b/ci/docker/i686-linux-android/Dockerfile index 62a379b3cf8bc..666ffcc65fd52 100644 --- a/ci/docker/i686-linux-android/Dockerfile +++ b/ci/docker/i686-linux-android/Dockerfile @@ -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 diff --git a/ci/docker/x86_64-linux-android/Dockerfile b/ci/docker/x86_64-linux-android/Dockerfile index a814edda6cdea..144dc1ba4237f 100644 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ b/ci/docker/x86_64-linux-android/Dockerfile @@ -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 diff --git a/libc-test/build.rs b/libc-test/build.rs index ac3f54baf96d0..8e7b95b9eeace 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -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| { @@ -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| {