How to cross compile Rust program for non-Linux OS with gcc toolchain for aarch64?
Rust Bare-Metal Cross-Compilation for AArch64: can't find crate for `core` - Stack Overflow
[Solved] Cross compile to aarch64 from windows10
Compiling with `cross-rs` to `aarch64-unknown-linux-gnu`
Does anyone have a good docs on how to cross-compile Rust for aarch64 Android target? I have to run it on CI as well as locally. Thanks!
I am trying to cross compile rust. I am able to build and compile the binary successfully, however when i run this binary on aarch64 architecture, i get the following error
```
./crossed: /lib/libc.so.6: version `GLIBC_2.33' not found (required by ./crossed)
./crossed: /lib/libc.so.6: version `GLIBC_2.32' not found (required by ./crossed)
./crossed: /lib/libc.so.6: version `GLIBC_2.34' not found (required by ./crossed)
```
I am not sure what i did wrong. can you please help me out.
I have used the cross-rs tool and it works properly and generates a binary that is working but i am not sure what i am doing wrong. I am using aarch64-unknown-linux-gnu as target compiler
I'm trying to compile Rust code on ubuntu 22 for my Orange Pi zero2 (ubuntu 22 server ARM). As a target, I'm using first-tier support aarch64-unknown-linux-gnu.
My cargo.toml
[package]
name = "pitest"
version = "0.1.0"
edition = "2021"
[dependencies]
actix-web = "4"
btleplug = "0.10.4"
tokio = { version = "1.23.0", features = ["full"] }
local-ip-address = "0.4.9"
openssl = { version = "0.10", features = ["vendored"] }
[[bin]]
edition = "2021"
name = "pi"
path = "src/main.rs"Compile command:
cargo build --target aarch64-unknown-linux-gnu
Error:
Compiling libdbus-sys v0.2.2 Compiling openssl v0.10.44 Compiling actix-http v3.2.2 error: failed to run custom build command for `libdbus-sys v0.2.2` Caused by: process didn't exit successfully: `/home/lukasz/Documents/rust/orange/pitest/target/debug/build/libdbus-sys-f70e45626a3460eb/build-script-build` (exit status: 101) --- stdout cargo:rerun-if-env-changed=DBUS_1_NO_PKG_CONFIG cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_ALLOW_CROSS_aarch64_unknown_linux_gnu 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-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_aarch64_unknown_linux_gnu 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-unknown-linux-gnu cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR_aarch64_unknown_linux_gnu cargo:rerun-if-env-changed=TARGET_PKG_CONFIG_SYSROOT_DIR cargo:rerun-if-env-changed=PKG_CONFIG_SYSROOT_DIR --- stderr pkg_config failed: 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. One possible solution is to check whether packages 'libdbus-1-dev' and 'pkg-config' are installed: On Ubuntu: sudo apt install libdbus-1-dev pkg-config On Fedora: sudo dnf install dbus-devel pkgconf-pkg-config thread 'main' panicked at 'explicit panic', /home/lukasz/.cargo/registry/src/github.com-1ecc6299db9ec823/libdbus-sys-0.2.2/build.rs:16:9 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
I would like to point out, that I have installed libdbus-1-dev pkg-config
I found on some Chinese websites, that missing dbus-devel may be the problem but there is no such package to download on ubuntu... also hello-world app worked fine.