rust-lang / rust-lang/rustup

Fix aarch64-linux-android target installs

Open
#2,900 1 comment 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
7k
Forks
1.1k
Avg merge
22h 40m
Merged PRs (30d)
46

Description

Problem you are trying to solve

Getting android targets to build out of the box.

Solution you'd like

Auto setup some variable so that cargo can link properly for android and cc crate works properly.

For linux the only variable needed is (assuming android NDK installer properly setup its environment):

export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android21-clang

If the NDK installer was defective another variable is needed:

export PATH="$PATH:ANDROID_HOME/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/"
Notes

Without CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER it is impossible to build any rust project for android whether or not this project uses some "-sys" libraries, rendering the default rustup install for android useless.

EDIT: In case you are wondering aarch64-linux-android21-clang is chosen as it is the default chosen for cc crate as well and having different API level linkers may be bad.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating rustup's Android target installation and environment setup entry points; the issue does not name specific files or tests. Reproduce an aarch64-linux-android build, check how the linker and NDK PATH are configured, and verify that a default installation can build without manual environment variables.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, rust
Domain
mobile-dev, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.