Skip to content

Commit 1abb02c

Browse files
committed
Revert 'Bump MSRV to 1.68'
This effectively reverts 66cfc68 and adds some comments explaining that we're currently blocked by Winit's MSRV policy + CI from being able to increase our rust-version. This is a frustrating conflict that I hope can be addressed by updating Winit's CI system to allow different platforms to require more recent versions of Rust (which notably isn't in conflict with setting a conservative rust-version in Winit for supporting Debian on Linux) This re-instates building android-activity with cargo-ndk 2 because building on Android with 1.64 requires a linker workaround that's not implemented in newer version of cargo-ndk. This also reinstates the clippy false-negative warning suppression for unsafe blocks. Again it's frustrating that we can't have good things because of how Winit wants to support Debian which shouldn't be relevant for Android development. Here is an upstream issue to discuss a potential solution for this: rust-windowing/winit#3000
1 parent c0a9e20 commit 1abb02c

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
# See top README for MSRV policy
20-
rust_version: [1.68.0, stable]
19+
# XXX: We are currently constrained by Winit's MSRV policy + CI system
20+
# See Cargo.toml for details
21+
rust_version: [1.64.0, stable]
2122
steps:
2223
- uses: actions/checkout@v3
2324

@@ -34,7 +35,10 @@ jobs:
3435
i686-linux-android
3536
3637
- name: Install cargo-ndk
37-
run: cargo install cargo-ndk
38+
# XXX: We have to use an old version of cargo-ndk that supports the
39+
# libgcc linker workaround for rust < 1.68 because Winit's CI system
40+
# currently requires this crate to be buildable with 1.64
41+
run: cargo install cargo-ndk --version "^2"
3842

3943
- name: Setup Java
4044
uses: actions/setup-java@v3

android-activity/Cargo.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,19 @@ repository = "https://github.com/rust-mobile/android-activity"
99
documentation = "https://docs.rs/android-activity"
1010
description = "Glue for building Rust applications on Android with NativeActivity or GameActivity"
1111
license = "MIT OR Apache-2.0"
12-
rust-version = "1.68.0"
12+
13+
# XXX: Even though we have our own MSRV policy that says we only promise to
14+
# support stable releases over the last three months we actually end up
15+
# constrained by the MSRV policy of Winit, which is currently based on
16+
# supporting Alacritty on Debian Sid, and requires a > 10 month old Rust version
17+
#
18+
# This Winit policiy is unfortunately in conflict with what makes sense for
19+
# Android because versions below 1.68 for Android requires awkward toolchain
20+
# linker workarounds, and can't even be compiled with newer versions of
21+
# `cargo ndk` that removed these linker workarounds.
22+
#
23+
# TODO: Open a PR for Winit's CI to test Android builds using a newer toolchain.
24+
rust-version = "1.64"
1325

1426
[features]
1527
# Note: we don't enable any backend by default since features

android-activity/src/game_activity/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,7 @@ extern "Rust" {
759759
// `app_main` function. This is run on a dedicated thread spawned
760760
// by android_native_app_glue.
761761
#[no_mangle]
762+
#[allow(unused_unsafe)] // Otherwise rust 1.64 moans about using unsafe{} in unsafe functions
762763
pub unsafe extern "C" fn _rust_glue_entry(native_app: *mut ffi::android_app) {
763764
abort_on_panic(|| {
764765
// Maybe make this stdout/stderr redirection an optional / opt-in feature?...

android-activity/src/native_activity/glue.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -828,6 +828,7 @@ unsafe extern "C" fn on_content_rect_changed(
828828

829829
/// This is the native entrypoint for our cdylib library that `ANativeActivity` will look for via `dlsym`
830830
#[no_mangle]
831+
#[allow(unused_unsafe)] // Otherwise rust 1.64 moans about using unsafe{} in unsafe functions
831832
extern "C" fn ANativeActivity_onCreate(
832833
activity: *mut ndk_sys::ANativeActivity,
833834
saved_state: *const libc::c_void,

0 commit comments

Comments
 (0)