Build Rust on android

Issue

I’m trying to compile this project: https://github.com/krupitskas/rust_on_android/releases/tag/0.0.1

and get this error:

> Task :app:cargoBuildArm
   Compiling pong v0.0.1 (/home/oleh/Projects/rust_on_android-0.0.1)
error: linking with `/home/oleh/Projects/rust_on_android-0.0.1/platform/android/build/linker-wrapper/linker-wrapper.sh` failed: exit code: 127
  |
linking with `/home/oleh/Projects/rust_on_android-0.0.1/platform/android/build/linker-wrapper/linker-wrapper.sh` failed: exit code: 127

  = note: "/home/oleh/Projects/rust_on_android-0.0.1/platform/android/build/linker-wrapper/linker-wrapper.sh" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--allow-multiple-definition" "-march=armv7-a" "-Wl,--eh-frame-hdr" "-L" "/home/oleh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-linux-androideabi/lib" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.2ea6oez8ywp3lee1.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.3f5zp5i2ksk50hae.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.3gemza6k8yz2pdq3.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.3texf7lydp0kl2bb.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.3u4rshn1rkivyeo2.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.4heijw279kc0110z.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.577t2huktif7nv35.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.9o5728rkebkmfz3.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.y2ssqm04stgueys.rcgu.o" "-o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/libpong_android.so" "-Wl,--version-script=/tmp/rustczfh1Y1/list" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.1kbayaplmttiiwxd.rcgu.o" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps/pong_android.3iou4444umz0hy6e.rcgu.o" "-shared" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/oleh/Projects/rust_on_android-0.0.1/target/armv7-linux-androideabi/debug/deps" "-L" "/home/oleh/Projects/rust_on_android-0.0.1/target/debug/deps" "-L" "/home/oleh/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/armv7-linux-androideabi/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libjni-c04d61acc78bbbfc.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libcesu8-84fe6120caee6e80.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/liblog-eebcebde4e85740e.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libcfg_if-6181364a451b2f57.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libcombine-aa6ac0fb37d781d2.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libmemchr-bc03d89792c3b7a8.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libbytes-d717e8c68f1080b7.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libthiserror-6d184248cae4dd84.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libjni_sys-88a0fdb13b94e2af.rlib" "-Wl,--no-whole-archive" "-Wl,--start-group" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libstd-cb0beac250436a0d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libpanic_unwind-e434dcd9317d78c2.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libminiz_oxide-afa459219c4d92d6.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libadler-f57f538a958bc55d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libobject-c8797db28b71e53c.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libaddr2line-bb211f245cec9142.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libgimli-a6ab61380c35ee99.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/librustc_demangle-4e4d81621f8f8e44.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libhashbrown-f6130bf85123b5dd.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/librustc_std_workspace_alloc-f0b4a50ac6fb811f.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libunwind-78a31eba47812823.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libcfg_if-8c49356d4184b030.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/liblibc-bc3ec46ad7e712af.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/liballoc-cb332653b205c56d.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/librustc_std_workspace_core-0ad625bb743eec22.rlib" "-Wl,--no-whole-archive" "-Wl,--whole-archive" "/tmp/rustczfh1Y1/libcore-0dbd748a486ccd14.rlib" "-Wl,--no-whole-archive" "-Wl,--end-group" "/tmp/rustczfh1Y1/libcompiler_builtins-9259c2a9436ab113.rlib" "-Wl,-Bdynamic" "-ldl" "-llog" "-lgcc" "-lc" "-lm"
  = note: /home/oleh/Projects/rust_on_android-0.0.1/platform/android/build/linker-wrapper/linker-wrapper.sh: line 4: python: command not found
      

error: aborting due to previous error

error: could not compile `pong`
aborting due to previous error


could not compile `pong`

To learn more, run the command again with --verbose.

> Task :app:cargoBuildArm FAILED

Execution failed for task ':app:cargoBuildArm'.
> Process 'command 'cargo'' finished with non-zero exit value 101

Android studio: 4.1.2
NDK version: 21.3.6528147
Build Tools version: 30.0.3
Gradle 6.5

Solution

Based on this line

python: command not found

It seems it can’t find python on your system

Answered By – Buzzec

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published