Skip to content

Commit 114e2a8

Browse files
committed
Auto merge of rust-lang#120593 - maurer:android-bump, r=<try>
Update Android in CI We are currently using a 10+ year old Android image, and it has caused trouble when working on rust-lang#120326. Our current NDK (25) only supports API 19+, so we were already out of spec. This PR: 1. Bumps the API used by the emulator in CI to 21, as per [NDK-26's release notes](https://github.com/android/ndk/wiki/Changelog-r26) deprecating 19 and 20 as targets. 2. Activates aarch64 testing on the emulator, since the base image is now a 64-bit image. 3. Bumps the NDK to 26b try-job: arm-android try-job: aarch64-android
2 parents bcf1f6d + ebc58ac commit 114e2a8

File tree

14 files changed

+78
-23
lines changed

14 files changed

+78
-23
lines changed

config.example.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@
394394
#metrics = false
395395

396396
# Specify the location of the Android NDK. Used when targeting Android.
397-
#android-ndk = "/path/to/android-ndk-r25b"
397+
#android-ndk = "/path/to/android-ndk-r26d"
398398

399399
# =============================================================================
400400
# General install configuration options

src/bootstrap/src/utils/cc_detect.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -247,18 +247,16 @@ pub(crate) fn ndk_compiler(compiler: Language, triple: &str, ndk: &Path) -> Path
247247
triple.to_string()
248248
};
249249

250-
// API 19 is the earliest API level supported by NDK r25b but AArch64 and x86_64 support
251-
// begins at API level 21.
252-
let api_level =
253-
if triple.contains("aarch64") || triple.contains("x86_64") { "21" } else { "19" };
250+
// The earliest API supported by NDK r26d is 21.
251+
let api_level = "21";
254252
let compiler = format!("{}{}-{}", triple_translated, api_level, compiler.clang());
255253
let host_tag = if cfg!(target_os = "macos") {
256254
// The NDK uses universal binaries, so this is correct even on ARM.
257255
"darwin-x86_64"
258256
} else if cfg!(target_os = "windows") {
259257
"windows-x86_64"
260258
} else {
261-
// NDK r25b only has official releases for macOS, Windows and Linux.
259+
// NDK r26d only has official releases for macOS, Windows and Linux.
262260
// Try the Linux directory everywhere else, on the assumption that the OS has an
263261
// emulation layer that can cope (e.g. BSDs).
264262
"linux-x86_64"

src/bootstrap/src/utils/change_tracker.rs

+5
Original file line numberDiff line numberDiff line change
@@ -200,4 +200,9 @@ pub const CONFIG_CHANGE_HISTORY: &[ChangeInfo] = &[
200200
severity: ChangeSeverity::Warning,
201201
summary: "`llvm.lld` is enabled by default for the dist profile. If set to false, `lld` will not be included in the dist build.",
202202
},
203+
ChangeInfo {
204+
change_id: 120593,
205+
severity: ChangeSeverity::Info,
206+
summary: "Removed android-ndk r25b support in favor of android-ndk r26d.",
207+
},
203208
];
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
FROM ubuntu:23.04
2+
3+
ARG DEBIAN_FRONTEND=noninteractive
4+
COPY scripts/android-base-apt-get.sh /scripts/
5+
RUN sh /scripts/android-base-apt-get.sh
6+
7+
COPY scripts/android-ndk.sh /scripts/
8+
RUN . /scripts/android-ndk.sh && \
9+
download_ndk android-ndk-r26d-linux.zip
10+
11+
RUN dpkg --add-architecture i386 && \
12+
apt-get update && \
13+
apt-get install -y --no-install-recommends \
14+
libgl1-mesa-glx \
15+
libpulse0 \
16+
libstdc++6:i386 \
17+
openjdk-8-jre-headless \
18+
tzdata \
19+
wget \
20+
python3
21+
22+
COPY scripts/android-sdk.sh /scripts/
23+
COPY scripts/android-sdk-manager.py /scripts/
24+
COPY host-x86_64/aarch64-android/android-sdk.lock /android/sdk/android-sdk.lock
25+
RUN /scripts/android-sdk.sh
26+
27+
ENV PATH=$PATH:/android/sdk/emulator
28+
ENV PATH=$PATH:/android/sdk/tools
29+
ENV PATH=$PATH:/android/sdk/platform-tools
30+
31+
ENV TARGETS=aarch64-linux-android
32+
33+
ENV RUST_CONFIGURE_ARGS --android-ndk=/android/ndk/
34+
35+
ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target $TARGETS
36+
37+
COPY scripts/sccache.sh /scripts/
38+
RUN sh /scripts/sccache.sh
39+
40+
COPY scripts/android-start-emulator.sh /scripts/
41+
ENTRYPOINT ["/scripts/android-start-emulator.sh", "arm64-v8a", "auto"]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
emulator emulator-linux_x64-12038310.zip fe7a96bf6fbe7b026555dd7f76b713f22a07ec8b
2+
patcher;v4 3534162-studio.sdk-patcher.zip 046699c5e2716ae11d77e0bad814f7f33fab261e
3+
platform-tools platform-tools_r34.0.5-linux.zip 96097475cf7b279fdd8f218f5d043ffe94104ec3
4+
platforms;android-21 android-21_r02.zip 53536556059bb29ae82f414fd2e14bc335a4eb4c
5+
system-images;android-21;default;arm64-v8a sys-img/android/arm64-v8a-21_r04.zip c4375f1b4b4cd21a8617660e25f621cedcbd8332
6+
tools sdk-tools-linux-4333796.zip 8c7c28554a32318461802c1291d76fccfafde054

src/ci/docker/host-x86_64/arm-android/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN sh /scripts/android-base-apt-get.sh
66

77
COPY scripts/android-ndk.sh /scripts/
88
RUN . /scripts/android-ndk.sh && \
9-
download_ndk android-ndk-r25b-linux.zip
9+
download_ndk android-ndk-r26d-linux.zip
1010

1111
RUN dpkg --add-architecture i386 && \
1212
apt-get update && \
@@ -38,4 +38,4 @@ COPY scripts/sccache.sh /scripts/
3838
RUN sh /scripts/sccache.sh
3939

4040
COPY scripts/android-start-emulator.sh /scripts/
41-
ENTRYPOINT ["/scripts/android-start-emulator.sh"]
41+
ENTRYPOINT ["/scripts/android-start-emulator.sh", "armeabi-v7a", "classic"]
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
emulator emulator-linux-5264690.zip 48c1cda2bdf3095d9d9d5c010fbfb3d6d673e3ea
22
patcher;v4 3534162-studio.sdk-patcher.zip 046699c5e2716ae11d77e0bad814f7f33fab261e
3-
platform-tools platform-tools_r28.0.2-linux.zip 46a4c02a9b8e4e2121eddf6025da3c979bf02e28
4-
platforms;android-18 android-18_r03.zip e6b09b3505754cbbeb4a5622008b907262ee91cb
5-
system-images;android-18;default;armeabi-v7a sys-img/android/armeabi-v7a-18_r05.zip 580b583720f7de671040d5917c8c9db0c7aa03fd
3+
platform-tools platform-tools_r34.0.5-linux.zip 96097475cf7b279fdd8f218f5d043ffe94104ec3
4+
platforms;android-21 android-21_r02.zip 53536556059bb29ae82f414fd2e14bc335a4eb4c
5+
system-images;android-21;default;armeabi-v7a sys-img/android/armeabi-v7a-21_r04.zip 8c606f81306564b65e41303d2603e4c42ded0d10
66
tools sdk-tools-linux-4333796.zip 8c7c28554a32318461802c1291d76fccfafde054

src/ci/docker/host-x86_64/dist-android/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ RUN sh /scripts/android-base-apt-get.sh
66
# ndk
77
COPY scripts/android-ndk.sh /scripts/
88
RUN . /scripts/android-ndk.sh && \
9-
download_ndk android-ndk-r25b-linux.zip
9+
download_ndk android-ndk-r26d-linux.zip
1010

1111
# env
1212
ENV TARGETS=arm-linux-androideabi

src/ci/docker/scripts/android-sdk-manager.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ def cli_install(args):
144144
lockfile = Lockfile(args.lockfile)
145145
for package in lockfile.packages.values():
146146
# Download the file from the mirror into a temp file
147-
url = "https://" + MIRROR_BUCKET + ".s3-" + MIRROR_BUCKET_REGION + \
148-
".amazonaws.com/" + MIRROR_BASE_DIR
149-
downloaded = package.download(url)
147+
#url = "https://" + MIRROR_BUCKET + ".s3-" + MIRROR_BUCKET_REGION + \
148+
# ".amazonaws.com/" + MIRROR_BASE_DIR
149+
downloaded = package.download(BASE_REPOSITORY)
150150
# Extract the file in a temporary directory
151151
extract_dir = tempfile.mkdtemp()
152152
subprocess.run([

src/ci/docker/scripts/android-start-emulator.sh

+4-6
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ set -ex
66
# emulator identify the system
77
export SHELL=/bin/bash
88

9-
# Using the default qemu2 engine makes time::tests::since_epoch fails because
10-
# the emulator date is set to unix epoch (in armeabi-v7a-18 image). Using
11-
# classic engine the emulator starts with the current date and the tests run
12-
# fine. If another image is used, this need to be evaluated again.
13-
nohup nohup emulator @armeabi-v7a-18 \
14-
-engine classic -no-window -partition-size 2047 0<&- &>/dev/null &
9+
nohup nohup emulator @$1-21 \
10+
-engine $2 -no-window -no-audio -partition-size 2047 0<&- &>/dev/null &
11+
12+
shift 2
1513

1614
exec "$@"

src/ci/github-actions/jobs.yml

+3
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ auto:
115115
- image: arm-android
116116
<<: *job-linux-4c
117117

118+
- image: aarch64-android
119+
<<: *job-linux-8c
120+
118121
- image: armhf-gnu
119122
<<: *job-linux-4c
120123

tests/codegen/sanitizer/scs-attr-check.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,17 @@
33
//
44
//@ needs-sanitizer-shadow-call-stack
55
//@ compile-flags: -Zsanitizer=shadow-call-stack
6+
// With optimization, Rust may decide to make these functions MIR-only.
7+
//@ compile-flags: -C opt-level=0
68

79
#![crate_type = "lib"]
810
#![feature(no_sanitize)]
911

10-
// CHECK: ; sanitizer_scs_attr_check::scs
12+
// CHECK: ; scs_attr_check::scs
1113
// CHECK-NEXT: ; Function Attrs:{{.*}}shadowcallstack
1214
pub fn scs() {}
1315

14-
// CHECK: ; sanitizer_scs_attr_check::no_scs
16+
// CHECK: ; scs_attr_check::no_scs
1517
// CHECK-NOT: ; Function Attrs:{{.*}}shadowcallstack
1618
#[no_sanitize(shadow_call_stack)]
1719
pub fn no_scs() {}

tests/ui/abi/stack-probes-lto.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//@[x64] only-x86_64
77
//@ ignore-sgx no processes
88
//@ ignore-musl FIXME #31506
9+
//@ ignore-android handler not yet registered #124823
910
//@ ignore-fuchsia no exception handler registered for segfault
1011
//@ compile-flags: -C lto
1112
//@ no-prefer-dynamic

tests/ui/abi/stack-probes.rs

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//@[x64] only-x86_64
77
//@ ignore-emscripten no processes
88
//@ ignore-sgx no processes
9+
//@ ignore-android handler not yet registered #124823
910
//@ ignore-fuchsia no exception handler registered for segfault
1011
//@ ignore-nto Crash analysis impossible at SIGSEGV in QNX Neutrino
1112
//@ ignore-ios Stack probes are enabled, but the SIGSEGV handler isn't

0 commit comments

Comments
 (0)