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

Cross compiling to android error #186

Open
jianshu93 opened this issue Aug 21, 2024 · 0 comments
Open

Cross compiling to android error #186

jianshu93 opened this issue Aug 21, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jianshu93
Copy link

Hi Team,

I was trying to cross compiling it on my macOS to aarch-linux-android, all linkers are correctly chosen (I tested for several other Rust programs) but failed with the following error:

Jianshus-MBP-2:reqwest-middleware jianshuzhao$ cargo build --release --target aarch64-linux-android
Compiling cfg-if v1.0.0
Compiling pin-project-lite v0.2.14
Compiling bytes v1.7.1
Compiling futures-core v0.3.30
Compiling libc v0.2.158
Compiling parking_lot_core v0.9.10
Compiling lock_api v0.4.12
Compiling futures-sink v0.3.30
Compiling scopeguard v1.2.0
Compiling smallvec v1.13.2
Compiling once_cell v1.19.0
Compiling slab v0.4.9
Compiling vcpkg v0.2.15
Compiling pkg-config v0.3.30
Compiling futures-io v0.3.30
Compiling futures-channel v0.3.30
Compiling itoa v1.0.11
Compiling memchr v2.7.4
Compiling pin-utils v0.1.0
Compiling futures-task v0.3.30
Compiling fnv v1.0.7
Compiling ring v0.17.8
Compiling tracing-core v0.1.32
Compiling equivalent v1.0.1
Compiling http v1.1.0
Compiling rustls-pki-types v1.8.0
Compiling hashbrown v0.14.5
Compiling signal-hook-registry v1.4.2
Compiling mio v1.0.2
Compiling parking_lot v0.12.3
Compiling socket2 v0.5.7
Compiling getrandom v0.2.15
Compiling openssl-sys v0.9.103
Compiling futures-util v0.3.30
Compiling httparse v1.9.4
Compiling http-body v1.0.1
Compiling tokio v1.39.3
Compiling indexmap v2.4.0
Compiling tracing v0.1.40
Compiling untrusted v0.9.0
Compiling spin v0.9.8
Compiling try-lock v0.2.5
Compiling foreign-types-shared v0.1.1
Compiling atomic-waker v1.1.2
Compiling openssl v0.10.66
Compiling foreign-types v0.3.2
Compiling want v0.3.1
Compiling pin-project v1.1.5
Compiling openssl-macros v0.1.1
Compiling bitflags v2.6.0
Compiling tower-layer v0.3.3
error: failed to run custom build command for openssl-sys v0.9.103

Caused by:
process didn't exit successfully: /Users/jianshuzhao/Github/reqwest-middleware/target/release/build/openssl-sys-d9b14df7064fed8a/build-script-main (exit status: 101)
--- stdout
cargo:rustc-check-cfg=cfg(osslconf, values("OPENSSL_NO_OCB", "OPENSSL_NO_SM4", "OPENSSL_NO_SEED", "OPENSSL_NO_CHACHA", "OPENSSL_NO_CAST", "OPENSSL_NO_IDEA", "OPENSSL_NO_CAMELLIA", "OPENSSL_NO_RC4", "OPENSSL_NO_BF", "OPENSSL_NO_PSK", "OPENSSL_NO_DEPRECATED_3_0", "OPENSSL_NO_SCRYPT", "OPENSSL_NO_SM3", "OPENSSL_NO_RMD160", "OPENSSL_NO_EC2M", "OPENSSL_NO_OCSP", "OPENSSL_NO_CMS", "OPENSSL_NO_COMP", "OPENSSL_NO_SOCK", "OPENSSL_NO_STDIO"))
cargo:rustc-check-cfg=cfg(openssl)
cargo:rustc-check-cfg=cfg(libressl)
cargo:rustc-check-cfg=cfg(boringssl)
cargo:rustc-check-cfg=cfg(libressl250)
cargo:rustc-check-cfg=cfg(libressl251)
cargo:rustc-check-cfg=cfg(libressl252)
cargo:rustc-check-cfg=cfg(libressl261)
cargo:rustc-check-cfg=cfg(libressl270)
cargo:rustc-check-cfg=cfg(libressl271)
cargo:rustc-check-cfg=cfg(libressl273)
cargo:rustc-check-cfg=cfg(libressl280)
cargo:rustc-check-cfg=cfg(libressl281)
cargo:rustc-check-cfg=cfg(libressl291)
cargo:rustc-check-cfg=cfg(libressl310)
cargo:rustc-check-cfg=cfg(libressl321)
cargo:rustc-check-cfg=cfg(libressl332)
cargo:rustc-check-cfg=cfg(libressl340)
cargo:rustc-check-cfg=cfg(libressl350)
cargo:rustc-check-cfg=cfg(libressl360)
cargo:rustc-check-cfg=cfg(libressl361)
cargo:rustc-check-cfg=cfg(libressl370)
cargo:rustc-check-cfg=cfg(libressl380)
cargo:rustc-check-cfg=cfg(libressl381)
cargo:rustc-check-cfg=cfg(libressl382)
cargo:rustc-check-cfg=cfg(libressl390)
cargo:rustc-check-cfg=cfg(libressl400)
cargo:rustc-check-cfg=cfg(ossl101)
cargo:rustc-check-cfg=cfg(ossl102)
cargo:rustc-check-cfg=cfg(ossl102f)
cargo:rustc-check-cfg=cfg(ossl102h)
cargo:rustc-check-cfg=cfg(ossl110)
cargo:rustc-check-cfg=cfg(ossl110f)
cargo:rustc-check-cfg=cfg(ossl110g)
cargo:rustc-check-cfg=cfg(ossl110h)
cargo:rustc-check-cfg=cfg(ossl111)
cargo:rustc-check-cfg=cfg(ossl111b)
cargo:rustc-check-cfg=cfg(ossl111c)
cargo:rustc-check-cfg=cfg(ossl111d)
cargo:rustc-check-cfg=cfg(ossl300)
cargo:rustc-check-cfg=cfg(ossl310)
cargo:rustc-check-cfg=cfg(ossl320)
cargo:rustc-check-cfg=cfg(ossl330)
cargo:rerun-if-env-changed=AARCH64_LINUX_ANDROID_OPENSSL_LIB_DIR
AARCH64_LINUX_ANDROID_OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=OPENSSL_LIB_DIR
OPENSSL_LIB_DIR unset
cargo:rerun-if-env-changed=AARCH64_LINUX_ANDROID_OPENSSL_INCLUDE_DIR
AARCH64_LINUX_ANDROID_OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=OPENSSL_INCLUDE_DIR
OPENSSL_INCLUDE_DIR unset
cargo:rerun-if-env-changed=AARCH64_LINUX_ANDROID_OPENSSL_DIR
AARCH64_LINUX_ANDROID_OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_DIR
OPENSSL_DIR unset
cargo:rerun-if-env-changed=OPENSSL_NO_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-linux-android
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_linux_android
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64-linux-android
cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_linux_android
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64-linux-android
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_linux_android
cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR
cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR
run pkg_config fail: pkg-config has not been configured to support cross-compilation.

Install a sysroot for the target platform and configure it via
PKG_CONFIG_SYSROOT_DIR and PKG_CONFIG_PATH, or install a
cross-compiling wrapper for pkg-config and set it via
PKG_CONFIG environment variable.

--- stderr
thread 'main' panicked at /Users/jianshuzhao/.cargo/registry/src/index.crates.io-6f17d22bba15001f/openssl-sys-0.9.103/build/find_normal.rs:190:5:

Could not find directory of OpenSSL installation, and this -sys crate cannot
proceed without this knowledge. If OpenSSL is installed and this crate had
trouble finding it, you can set the OPENSSL_DIR environment variable for the
compilation process.

Make sure you also have the development packages of openssl installed.
For example, libssl-dev on Ubuntu or openssl-devel on Fedora.

If you're in a situation where you think the directory should be found
automatically, please open a bug at https://github.com/sfackler/rust-openssl
and include information about your system as well as this message.

$HOST = aarch64-apple-darwin
$TARGET = aarch64-linux-android
openssl-sys = 0.9.103

note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
warning: build failed, waiting for other jobs to finish...

Any idea how I can solve it?

Thanks,

Jianshu

@jianshu93 jianshu93 added the bug Something isn't working label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

1 participant