Install toolchain of x86_64-linux-android


#1

As per this, x86_64-linux-android is a Tier 2 platforms, I was able to add the target as:

Hasans-MacBook-Air:~ h_ajsf$ rustup target add x86_64-linux-android
info: downloading component 'rust-std' for 'x86_64-linux-android'

But failed to install the toolchain:

Hasans-MacBook-Air:~ h_ajsf$ rustup toolchain install stable-x86_64-linux-android
info: syncing channel updates for 'stable-x86_64-linux-android'
info: latest update on 2018-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
error: target not found: 'x86_64-linux-android'

Even when I tried working around it by enforcing changing default toolchain:

Hasans-MacBook-Air:rust_lib_for_android h_ajsf$ rustup override set stable-x86_64-linux-android
info: syncing channel updates for 'stable-x86_64-linux-android'
320.1 KiB / 320.1 KiB (100 %) 103.5 KiB/s ETA:   0 s                
info: latest update on 2018-11-08, rust version 1.30.1 (1433507eb 2018-11-07)
error: target not found: 'x86_64-linux-android'

Any idea how can I d it?


#2

That forge page already shows that x86_64-linux-android only has std (suitable as a target), but does not have rustc and cargo to make up the toolchain.

But why are you trying to install the android-native Rust toolchain on your macbook? In general, you only need the Rust target to cross-compile, and then linker support comes from something like the Android SDK.


#3

Thanks, I understood we have 2 option to cross compile for Android:

  1. Use std rustc with linker support that is generated by Android NDK
  2. Install Android native by rust toolchain install

And I’m trying to do it with the second option.


#4

“Android native” implies that you will install and run the toolchain on Android. That’s not cross compilation. But I’m curious where you heard this, because it doesn’t look like native toolchains are shipped for any of the Android targets.


#5

mmm, so it looks something wrong in my understanding


#6

Maybe we’re mixing terms here. Native compilation can mean that the host running the compiler is the same as the target it will run on, the opposite of cross-compilation.

But Android also uses Native as in the NDK to distinguish code compiled for a particular CPU target, as opposed to the SDK with Java code that’s compiled to generic bytecode. In that sense, Rust is always native.