Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to cross compile from Windows to Android arm64-v8a #2352

Open
ieshaan12 opened this issue Jan 23, 2025 · 1 comment
Open

Unable to cross compile from Windows to Android arm64-v8a #2352

ieshaan12 opened this issue Jan 23, 2025 · 1 comment

Comments

@ieshaan12
Copy link

ieshaan12 commented Jan 23, 2025

Dependencies as specified in cargo.toml -

[dependencies]
openssl = { version = "0.10.35", features = ["vendored"] }

To ensure override as per the manual config, I've set the environment variables as follows (as recommended in #1542)-

OPENSSL_DIR - C:\Program Files\OpenSSL-Win64
OPENSSL_INCLUDE_DIR - C:\Program Files\OpenSSL-Win64\include
OPENSSL_LIB_DIR - C:\Program Files\OpenSSL-Win64\lib\VC\x64\MD

Its working successfully for me if the target and host are both Windows.

However it fails during the cross-compilation with the following error -

 Error configuring OpenSSL build:
      'perl' reported failure with exit code: 255
      Command failed: "perl" "./Configure" "--prefix=C:/Users/{username}/Desktop/Rust/android_ssl/target/aarch64-linux-android/debug/build/openssl-sys-5ec247b7e6331805/out/openssl-build/install" "--openssldir=/usr/local/ssl" "no-shared" "no-module" "no-ssl3" "no-tests" "no-comp" "no-zlib" "no-zlib-dynamic" "--libdir=lib" "no-md2" "no-rc5" "no-weak-ssl-ciphers" "no-camellia" "no-idea" "no-seed" "no-stdio" "linux-aarch64" "-O2" "-DANDROID" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-2" "-fno-omit-frame-pointer" "--target=aarch64-linux-android" "--target=aarch64-linux-android21"

I'm using cargo-ndk to do the cross compilation like so -
cargo ndk -t arm64-v8a -o ./jniLibs build

I've tried a similar thing to cross-compile from MacOS to Android. This has worked fine for me, with the same configuration of the Cargo.toml file.

The issue seems to come only while cross-compiling from Windows to Android.

@ieshaan12
Copy link
Author

I tried one more thing here, explicitly setting environment variables for cargo in ./.cargo/config.toml -

[env]
OPENSSL_DIR = { value = "C:\\Program Files\\OpenSSL-Win64" }
OPENSSL_INCLUDE_DIR = { value = "C:\\Program Files\\OpenSSL-Win64\\include" }
OPENSSL_LIB_DIR = { value = "C:\\Program Files\\OpenSSL-Win64\\lib\\VC\\x64\\MD" }

Still failed with the error above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant