mozilla / rust-android-gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

compile failed with -target=aarch64-linux-android

tyrionchen opened this issue · comments

Why am I able to successfully compile when I run cargo build in the rust directory, but it fails when I add --target=aarch64-linux-android?
Here are the steps I took:

git clone git@github.com:mozilla/rust-android-gradle.git
rustup target add aarch64-linux-android
cd rust-android-gradle/samples/rust

and this compiled successfully:
cargo build
image

this compiled failed:
cargo build --target=aarch64-linux-android
image

The error message told me that target aarch64-linux-android is not installed, but I have already installed it.
image

I suggest running Gradle with --info or --verbose. Then you should be able to see the full cargo command lines executed. My guess is that Gradle is finding a different installation than that on your shell path, but there's only one way to find out.

I suggest running Gradle with --info or --verbose. Then you should be able to see the full cargo command lines executed. My guess is that Gradle is finding a different installation than that on your shell path, but there's only one way to find out.

Thanks for @ncalexan 's reply. The cause of this issue has been identified, and I will close this issue for now.
Let me explain. I initially discovered this issue when I failed to build the cargo module using the org.mozilla.rust-android-gradle.rust-android plugin. After analyzing the code, I found that it would always fail as long as we ran "cargo build" with the "--target" parameter. So I raised this question on URLO and eventually got some help, which helped me solve the problem. For those who encounter this issue, you can refer to this link: https://users.rust-lang.org/t/compile-failed-with-target-aarch64-linux-android/92439

I suggest running Gradle with --info or --verbose. Then you should be able to see the full cargo command lines executed. My guess is that Gradle is finding a different installation than that on your shell path, but there's only one way to find out.

thanks @ncalexan, you are right

Glad you got to the bottom of things, and thanks for the helpful link to the thread where you resolved the issue!