From 2b55593b0afedd86cc05d67ba5ae3532fe49b322 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Sun, 12 Nov 2023 07:38:46 +0900 Subject: [PATCH] Upgrade Android NDK version --- ci/android-install-ndk.sh | 40 +++------------------- ci/docker/aarch64-linux-android/Dockerfile | 5 +-- ci/docker/arm-linux-androideabi/Dockerfile | 9 ++--- ci/docker/i686-linux-android/Dockerfile | 9 ++--- ci/docker/x86_64-linux-android/Dockerfile | 11 +++--- ci/install-rust.sh | 7 +--- 6 files changed, 25 insertions(+), 56 deletions(-) diff --git a/ci/android-install-ndk.sh b/ci/android-install-ndk.sh index 463565125972f..ebe791af703b8 100644 --- a/ci/android-install-ndk.sh +++ b/ci/android-install-ndk.sh @@ -2,40 +2,10 @@ 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-r26b +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 - ;; - armv7) - arch=arm - api=28 - ;; - aarch64) - arch=arm64 - api=28 - ;; - i686) - arch=x86 - api=28 - ;; - x86_64) - arch=x86_64 - api=28 - ;; - *) - echo "invalid arch: $1" - exit 1 - ;; -esac; +mv ./${NDK}/toolchains/llvm/prebuilt/linux-x86_64 /android -python3 ${NDK}/build/tools/make_standalone_toolchain.py \ - --install-dir "/android/ndk-${1}" \ - --arch "${arch}" \ - --api ${api} - -rm -rf ./${NDK}-linux-x86_64.zip ./${NDK} +rm -rf ./${NDK}-linux.zip ./${NDK} diff --git a/ci/docker/aarch64-linux-android/Dockerfile b/ci/docker/aarch64-linux-android/Dockerfile index 5dc0c0e7fed3f..7b8bdcfdadb32 100644 --- a/ci/docker/aarch64-linux-android/Dockerfile +++ b/ci/docker/aarch64-linux-android/Dockerfile @@ -19,9 +19,9 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=aarch64 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp RUN chmod 777 -R /tmp/.android @@ -31,6 +31,7 @@ ENV PATH=$PATH:/rust/bin \ CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android28-clang \ CARGO_TARGET_AARCH64_LINUX_ANDROID_RUNNER=/tmp/runtest \ CC_aarch64_linux_android=aarch64-linux-android28-clang \ + AR_aarch64_linux_android=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 e51c50e0f53c6..d0fb3176de7e7 100644 --- a/ci/docker/arm-linux-androideabi/Dockerfile +++ b/ci/docker/arm-linux-androideabi/Dockerfile @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=arm -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp 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_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ + CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=armv7a-linux-androideabi28-clang \ CARGO_TARGET_ARM_LINUX_ANDROIDEABI_RUNNER=/tmp/runtest \ - CC_arm_linux_androideabi=arm-linux-androideabi-gcc \ + CC_arm_linux_androideabi=armv7a-linux-androideabi28-clang \ + AR_arm_linux_androideabi=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 05846ea9bf077..a78c7cb6e8457 100644 --- a/ci/docker/i686-linux-android/Dockerfile +++ b/ci/docker/i686-linux-android/Dockerfile @@ -19,18 +19,19 @@ WORKDIR /android/ COPY android* /android/ ENV ANDROID_ARCH=i686 -ENV PATH=$PATH:/android/ndk-$ANDROID_ARCH/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools +ENV PATH=$PATH:/android/linux-x86_64/bin:/android/sdk/cmdline-tools/tools:/android/sdk/platform-tools -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh RUN sh /android/android-install-sdk.sh $ANDROID_ARCH RUN mv /root/.android /tmp 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-android28-clang \ CARGO_TARGET_I686_LINUX_ANDROID_RUNNER=/tmp/runtest \ - CC_i686_linux_android=i686-linux-android-gcc \ + CC_i686_linux_android=i686-linux-android28-clang \ + AR_i686_linux_android=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 96d9721eebd0a..d4e87b5f419fc 100644 --- a/ci/docker/x86_64-linux-android/Dockerfile +++ b/ci/docker/x86_64-linux-android/Dockerfile @@ -13,15 +13,16 @@ RUN apt-get update && \ WORKDIR /android/ ENV ANDROID_ARCH=x86_64 COPY android-install-ndk.sh /android/ -RUN sh /android/android-install-ndk.sh $ANDROID_ARCH +RUN sh /android/android-install-ndk.sh # We do not run x86_64-linux-android tests on an android emulator. # See ci/android-sysimage.sh for information about how tests are run. 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++ \ +ENV PATH=$PATH:/rust/bin:/android/linux-x86_64/bin \ + CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER=x86_64-linux-android28-clang \ + CC_x86_64_linux_android=x86_64-linux-android28-clang \ + CXX_x86_64_linux_android=x86_64-linux-android28-clang++ \ + AR_x86_64_linux_android=llvm-ar \ HOME=/tmp diff --git a/ci/install-rust.sh b/ci/install-rust.sh index 5b50c624cbd66..d7e2be8070dc0 100644 --- a/ci/install-rust.sh +++ b/ci/install-rust.sh @@ -8,12 +8,7 @@ toolchain= if [ -n "$TOOLCHAIN" ]; then toolchain=$TOOLCHAIN else - # Pin the nightly version as newer nightly versions break CI, - # https://github.com/rust-lang/rust/issues/103673 contains related information. - case "$TARGET" in - *android*) toolchain=nightly-2022-10-09;; - *) toolchain=nightly;; - esac + toolchain=nightly fi if [ "$OS" = "windows" ]; then : "${TARGET?The TARGET environment variable must be set.}"