Error when build on Android Studio4.1 Canary 9

Build Env:
OS: Windows 10 Pro Version 1909 for x64
IDE:Android Studio4.1 Canary 9
CygWin64: 3.1.4 with make, perl

Task :core:cargoBuildArm
Compiling openssl-sys v0.9.56
error: failed to run custom build command for openssl-sys v0.9.56

Caused by:
process didn’t exit successfully: C:\GitHub\shadowsocks-android\core\src\main\rust\shadowsocks-rust\target\debug\build\openssl-sys-c563c5c2392b1b4c\build-script-main (exit code: 101)
— stdout
cargo:rustc-cfg=const_fn
cargo:rerun-if-env-changed=ARMV7_LINUX_ANDROIDEABI_OPENSSL_NO_VENDOR
ARMV7_LINUX_ANDROIDEABI_OPENSSL_NO_VENDOR unset
cargo:rerun-if-env-changed=OPENSSL_NO_VENDOR
OPENSSL_NO_VENDOR unset
CC_armv7-linux-androideabi = Some(“C:\Android\sdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi21-clang.cmd”)
CFLAGS_armv7-linux-androideabi = None
CFLAGS_armv7_linux_androideabi = None
TARGET_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
DEBUG = Some(“true”)
running “perl” “./Configure” “–prefix=C:\GitHub\shadowsocks-android\core\src\main\rust\shadowsocks-rust\target\armv7-linux-androideabi\debug\build\openssl-sys-52f3e7afe9723601\out\openssl-build\install” “no-dso” “no-ssl3” “no-unit-test” “no-comp” “no-zlib” “no-zlib-dynamic” “no-engine” “no-async” “no-stdio” “no-shared” “linux-armv4” “-O2” “-DANDROID” “-ffunction-sections” “-fdata-sections” “-fPIC” “-g” “-fno-omit-frame-pointer” “–target=armv7-linux-androideabi”
Configuring OpenSSL version 1.1.1g (0x1010107fL) for linux-armv4
Using os-specific seed configuration
Creating configdata.pm
Creating Makefile



*** OpenSSL has been successfully configured ***


*** If you encounter a problem while building, please open an ***
*** issue on GitHub https://github.com/openssl/openssl/issues ***
*** and include the output from the following command: ***


*** perl configdata.pm --dump ***


*** (If you are new to OpenSSL, you might want to consult the ***
*** ‘Troubleshooting’ section in the INSTALL file first) ***



running “make” “depend”
running “make” “build_libs”
/usr/bin/perl “-I.” -Mconfigdata “util/dofile.pl”
“-oMakefile” include/crypto/bn_conf.h.in > include/crypto/bn_conf.h
/usr/bin/perl “-I.” -Mconfigdata “util/dofile.pl”
“-oMakefile” include/crypto/dso_conf.h.in > include/crypto/dso_conf.h
/usr/bin/perl “-I.” -Mconfigdata “util/dofile.pl”
“-oMakefile” include/openssl/opensslconf.h.in > include/openssl/opensslconf.h
make depend && make _build_libs
make[1]: Entering directory ‘/cygdrive/c/GitHub/shadowsocks-android/core/src/main/rust/shadowsocks-rust/target/armv7-linux-androideabi/debug/build/openssl-sys-52f3e7afe9723601/out/openssl-build/build/src’
make[1]: Leaving directory ‘/cygdrive/c/GitHub/shadowsocks-android/core/src/main/rust/shadowsocks-rust/target/armv7-linux-androideabi/debug/build/openssl-sys-52f3e7afe9723601/out/openssl-build/build/src’
make[1]: Entering directory ‘/cygdrive/c/GitHub/shadowsocks-android/core/src/main/rust/shadowsocks-rust/target/armv7-linux-androideabi/debug/build/openssl-sys-52f3e7afe9723601/out/openssl-build/build/src’
CC=“C:\Android\sdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi21-clang.cmd” /usr/bin/perl crypto/aes/asm/aes-armv4.pl linux32 crypto/aes/aes-armv4.S
C:\Android\sdk\ndk\21.1.6352462\toolchains\llvm\prebuilt\windows-x86_64\bin\armv7a-linux-androideabi21-clang.cmd -I. -Iinclude -Icrypto -fPIC -pthread -Wall -O3 -O2 -ffunction-sections -fdata-sections -fPIC -g -fno-omit-frame-pointer --target=armv7-linux-androideabi -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR=“"C:/GitHub/shadowsocks-android/core/src/main/rust/shadowsocks-rust/target/armv7-linux-androideabi/debug/build/openssl-sys-52f3e7afe9723601/out/openssl-build/install/ssl"” -DENGINESDIR=“"C:\GitHub\shadowsocks-android\core\src\main\rust\shadowsocks-rust\target\armv7-linux-androideabi\debug\build\openssl-sys-52f3e7afe9723601\out\openssl-build\install/lib/engines-1.1"” -DNDEBUG -DANDROID -c -o crypto/aes/aes-armv4.o crypto/aes/aes-armv4.S
make[1]: Leaving directory ‘/cygdrive/c/GitHub/shadowsocks-android/core/src/main/rust/shadowsocks-rust/target/armv7-linux-androideabi/debug/build/openssl-sys-52f3e7afe9723601/out/openssl-build/build/src’

— stderr
/bin/sh: C:Androidsdkndk21.1.6352462toolchainsllvmprebuiltwindows-x86_64binarmv7a-linux-androideabi21-clang.cmd: command not found
make[1]: *** [Makefile:667: crypto/aes/aes-armv4.o] Error 127
make: *** [Makefile:174: build_libs] Error 2
thread ‘main’ panicked at ’

Error building OpenSSL:
Command: “make” “build_libs”
Exit status: exit code: 2

failed to run custom build command for openssl-sys v0.9.56

', C:\Users\820G3\.cargo\registry\src\github.com-1ecc6299db9ec823\openssl-src-111.9.0+1.1.1g\src\lib.rs:379:13

Caused by:

note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

Task :core:cargoBuildArm FAILED

Execution failed for task ‘:core:cargoBuildArm’.

Process ‘command ‘cargo’’ finished with non-zero exit value 101

2 Likes

Did you resolved this?

Looks like an issue of rust plugin with Windows. Try reporting it here: https://github.com/mozilla/rust-android-gradle

If i need install c++ build tools on Windows for rust?

I’ve had this problem also. Have you solved the problem? But my error complain this “could not find native static library libsodium, perhaps an -L flag is missing?”. so how to link libsodium in cargo?