Skip to content

Pass ANDROID_ABI and ANDROID_PLATFORM environment variables#257

Open
pr2502 wants to merge 1 commit intorust-lang:mainfrom
pr2502:android-build
Open

Pass ANDROID_ABI and ANDROID_PLATFORM environment variables#257
pr2502 wants to merge 1 commit intorust-lang:mainfrom
pr2502:android-build

Conversation

@pr2502
Copy link

@pr2502 pr2502 commented Dec 8, 2025

Uses environment variables as passed by cargo-ndk version 4.0 and later, and passes them as defines to cmake. Note the environment variable names as currently documented on https://crates.io/crates/cargo-ndk are outdated, the docs have been fixed later in bbqsrc/cargo-ndk@1bee04b305.

For me this fixed issues with cross compilation to android, similar to #226.

I wasn't quite sure where to put this logic, so please let me know if you want it moved somewhere more appropriate.

Uses environment variables as passed by cargo-ndk version 4.0 and later,
and passes them as defines to cmake.
Note the environment variable names as currently documented on
<https://crates.io/crates/cargo-ndk> are outdated, the docs have been
fixed later in <bbqsrc/cargo-ndk@1bee04b305>.

fixes rust-lang#226
@yume-chan
Copy link

yume-chan commented Mar 9, 2026

This fix targets specifically to cargo-ndk. I wonder can this package automatically infer ANDROID_ABI value from CARGO_CFG_TARGET_ARCH (when CARGO_CFG_TARGET_OS is android) so we don't need any setup at all?

EDIT: ANDROID_PLATFORM and possibly CARGO_NDK_CMAKE_TOOLCHAIN_PATH still need to be forwarded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants