rustup: Can not install on android - target 'aarch64-linux-android' not found in channel.

Problem

When trying to install rustup using the linux command on the rustup site, when proceeding with install it gives me the following error:

Current installation options:


   default host triple: aarch64-linux-android
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is aarch64-linux-android
info: syncing channel updates for 'stable-aarch64-linux-android'
info: latest update on 2021-09-09, rust version 1.55.0 (c8dfcfe04 2021-09-06)
error: target 'aarch64-linux-android' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets

Steps

  1. Use termux
  2. Install rustup using site command
  3. You get this error

Extra Info I tried to install the package rust from the termux package repositories, but it was a too old version for the application I wanted to run. After trying to install rustup using the linux command this is where the problem started.

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (4 by maintainers)

Most upvoted comments

I’d look to your upstream for that software and ask them to make a new release; or else use a non-android system such as Linux or Windows to cross-compile the software for android if I were you. Android really isn’t a good platform to be running compilers etc. in my opinion.

问题

尝试在 rustup 站点上使用 linux 命令安装 rustup 时,在继续安装时出现以下错误:

Current installation options:


   default host triple: aarch64-linux-android
     default toolchain: stable (default)
               profile: default
  modify PATH variable: yes

1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>1

info: profile set to 'default'
info: default host triple is aarch64-linux-android
info: syncing channel updates for 'stable-aarch64-linux-android'
info: latest update on 2021-09-09, rust version 1.55.0 (c8dfcfe04 2021-09-06)
error: target 'aarch64-linux-android' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets

脚步

  1. 使用 termux
  2. 使用站点命令安装 rustup
  3. 你得到这个错误

额外信息 我尝试从 termux 包存储库安装包 rust,但对于我想要运行的应用程序来说,它的版本太旧了。在尝试使用 linux 命令安装 rustup 之后,这就是问题开始的地方。

pkg install proot-distro proot-distro list proot-distro install ubuntu proot-distro login ubuntu

curl --proto ‘=https’ --tlsv1.2 -sSf https://sh.rustup.rs | sh

ok

Just use:

pkg install rust in termux

@kenny-kvibe The toolchain you’ve installed is not officially distributed; rather, it’s distributed by the Termux project for you. In this case, rustup as the official toolchain downloader is not very useful.

@rodrigogs it is. I had to install cargo-ndk and android studio to get it working. Here are the notes I made:

Build for Android

cargo install cargo-ndk
rustup target add \
    aarch64-linux-android \
    armv7-linux-androideabi \
    x86_64-linux-android \
    i686-linux-android

You also need the android sdk and ndk. You can install them by first installing android studio, and then through the sdk manager. Install the oldest sdk version, and ndk version 20.1.x. After that, run export ANDROID_NDK_HOME=~/Android/Sdk/ndk/20.1.5948944 or if ~/Android/Sdk/ndk/20.1.5948944 does not exist, find the correct directory. Then you can run the following to build for android aarch64:

cargo ndk -t aarch64-linux-android build --release

Here is a one-liner: export ANDROID_NDK_HOME=~/Android/Sdk/ndk/20.1.5948944&&rustup target install aarch64-linux-android&&cargo ndk -t aarch64-linux-android build --release

Is it possible to use rust in termux?

Same problem

Same issue with me

yes

When I use pkg install rust get this error

info: syncing channel updates for 'stable-aarch64-linux-android'
info: latest update on 2023-07-13, rust version 1.71.0 (8ede3aae2 2023-07-12)
error: target 'aarch64-linux-android' not found in channel.  Perhaps check https://doc.rust-lang.org/nightly/rustc/platform-support.html for available targets

Running the command suggestion got the same message

It’s unnecessary to build for Android. A solution is to use TermuxArch and then use rustup: `Current installation options:

default host triple: aarch64-linux-android default toolchain: stable (default) profile: default modify PATH variable: yes

  1. Proceed with installation (default)
  2. Customize installation
  3. Cancel installation

2

I’m going to ask you the value of each of these installation options. You may simply press the Enter key to leave unchanged.

Default host triple? [aarch64-linux-android] aarch64-unknown-linux-gnu ` It builds for TermuxArch .

Any fixes?