rustup target add aarch64-unknown-linux-gnu is not enough. Cross compiling to linux on windows is not a good choice. just as bjorn3's reply, if you configure your system correctly, rust-lld will work well. I also recommend to use zig cc as linker for cross-compilation. cargo-zigbuild is a crate wh… Answer from c00t on users.rust-lang.org
Discussions

How to cross compile Rust program for non-Linux OS with gcc toolchain for aarch64?
Our Rust program mainly targets for aarch64-unknown-linux-gnu However, we have demands from our partners to cross compile for their own Operating System. The OS runs on the same hardware, so the CPU is still aarch64. The OS is not listed anywhere in https://doc.rust-lang.org/rustc/platform... More on users.rust-lang.org
🌐 users.rust-lang.org
6
0
June 4, 2023
Rust Bare-Metal Cross-Compilation for AArch64: can't find crate for `core` - Stack Overflow
I am trying to cross-compile an example rust code as library for bare-metal AArch64 on Linux (KDE-Neon). Unfortunately it does not work. This is my example rust code (lib.rs): #![no_std] #[no_mang... More on stackoverflow.com
🌐 stackoverflow.com
[Solved] Cross compile to aarch64 from windows10
Greetings, using rust for a while, and I just got myself some few orangepi devices lately.. I am trying to compile from windows10 machine(MINGW64_NT-10.0) a simple hello world and try to run it in a aarch64 system(and hopefully other devices too like omega 2+). it works obviously in cargo run ... More on users.rust-lang.org
🌐 users.rust-lang.org
0
0
November 29, 2018
Compiling with `cross-rs` to `aarch64-unknown-linux-gnu`
In any case, do you have any instructions on how to cross-compile this crate to aarch64-unknown-linux-gnu? ... ❯ RUST_BACKTRACE=full cross build --target=aarch64-unknown-linux-gnu -vv + cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu + rustc --print sysroot + ... More on github.com
🌐 github.com
6
April 30, 2023
🌐
GitHub
github.com › cross-rs › cross
GitHub - cross-rs/cross: “Zero setup” cross compilation and “cross testing” of Rust crates
This Just Works $ cross build --target aarch64-unknown-linux-gnu # EVEN MORE MAGICAL! This also Just Works $ cross test --target mips64-unknown-linux-gnuabi64 # Obviously, this also Just Works $ cross rustc --target powerpc-unknown-linux-gnu ...
Starred by 8.1K users
Forked by 451 users
Languages   Rust 58.8% | Shell 20.0% | Dockerfile 12.8% | Python 7.3%
🌐
Stack Overflow
stackoverflow.com › questions › 70559555 › rust-bare-metal-cross-compilation-for-aarch64-cant-find-crate-for-core
Rust Bare-Metal Cross-Compilation for AArch64: can't find crate for `core` - Stack Overflow
rustup component add rust-std-aarch64-unknown-none error: toolchain 'stable-x86_64-unknown-linux-gnu' does not contain component 'rust-std-aarch64-unknown-none' for target 'x86_64-unknown-linux-gnu' note: not all platforms have the standard library pre-compiled: https://doc.rust-lang.org/nightly/rustc/platform-support.html
🌐
Rust Programming Language
users.rust-lang.org › help
[Solved] Cross compile to aarch64 from windows10 - help - The Rust Programming Language Forum
November 29, 2018 - Greetings, using rust for a while, and I just got myself some few orangepi devices lately.. I am trying to compile from windows10 machine(MINGW64_NT-10.0) a simple hello world and try to run it in a aarch64 system(and hopefully other devices too like omega 2+). it works obviously in cargo run ...
🌐
GitHub
github.com › twistedfall › opencv-rust › issues › 457
Compiling with `cross-rs` to `aarch64-unknown-linux-gnu` · Issue #457 · twistedfall/opencv-rust
April 30, 2023 - ... ❯ RUST_BACKTRACE=full cross build --target=aarch64-unknown-linux-gnu -vv + cargo metadata --format-version 1 --filter-platform aarch64-unknown-linux-gnu + rustc --print sysroot + ...
Author   shtrophic
🌐
Stack Overflow
stackoverflow.com › questions › 78845548 › rust-cross-compile-aarch64-unknown-linux-gnu-linker-error
gcc - Rust cross compile aarch64-unknown-linux-gnu linker error - Stack Overflow
FROM rust:bookworm RUN rustup toolchain install stable RUN rustup default stable RUN apt-get update && apt-get install -y multistrap curl gcc-aarch64-linux-gnu libgtk-4-dev debian-archive-keyring libglib2.0-dev libc6-dev-arm64-cross RUN rustup target add aarch64-unknown-linux-gnu COPY multistrap.conf / RUN multistrap -f multistrap.conf -d /usr/aarch64-linux-gnu ENV RUSTC_LOG="rustc_codegen_ssa::back::link=info" ENV RUSTFLAGS="-C link-arg=--sysroot=/usr/aarch64-linux-gnu -C link-arg=-Wl,--verbose" ENV PKG_CONFIG_SYSROOT_DIR="/usr/aarch64-linux-gnu" ENV PKG_CONFIG_LIBDIR=/usr/aarch64-linux-gnu/u
Find elsewhere
🌐
Rust Programming Language
users.rust-lang.org › help
Cross compiling arm - help - The Rust Programming Language Forum
July 5, 2023 - Hi, I'm trying to cross compile raylib(essentially glfw w/ extras) from my host x86 archlinux to arm64 linux /usr/lib/gcc/aarch64-linux-gnu/13.1.0/../../../../aarch64-linux-gnu/bin/ld: cannot find -lX11: No such file or directory collect2: error: ld returned 1 exit status ^ with cargo build --target aarch64-unknown-linux-gnu , I presume I need the arm64 version of x11 installed or something? and the following is done with cross --- stderr CMake Error at /usr/local/share/cmake-3....
🌐
Tangram Vision
tangramvision.com › blog › cross-compiling-your-project-in-rust
Tangram Vision Blog | Cross-Compiling Your Project in Rust
February 13, 2024 - [toolchain] channel = "1.75.0" components = ["clippy", "rustfmt", "rust-std"] targets = [ # Linux Targets "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", # Apple Targets "x86_64-apple-darwin", "aarch64-apple-darwin", # Etc... ] profile = "default" This provides a clear and easy way to reference what targets are supported, but also makes it easy to always use a consistent toolchain for compiling and cross-compiling to different targets.
🌐
FreeBSD
forums.freebsd.org › non-i386/amd64 and embedded › embedded
Cross-compiling Rust for aarch64 from amd64 | The FreeBSD Forums
May 6, 2024 - [target.aarch64-unknown-freebsd] linker="aarch64-unknown-freebsd14.0-gcc12" Then I'm adding nightly toolchain rustup +nightly component add rust-src And then I execute cargo +nightly build -Z build-std --target aarch64-unknown-freebsd Where I am seeing that all dependencies compiled but then linker is throwing error
🌐
Reddit
reddit.com › r/rust › cross compiled binary for aarch64 architecture not running
r/rust on Reddit: Cross compiled binary for aarch64 architecture not running
October 6, 2022 -

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

🌐
Stack Overflow
stackoverflow.com › questions › 72583828 › cross-compiling-rust-on-win10-for-aarch64-linux
windows - Cross-compiling Rust on Win10 for aarch64/Linux - Stack Overflow
I think it's a problem with freetype because it requires installing a library first. Maybe it's not possible to cross-compile at all because of this. ... You might have more joy using WSL to build the cross-tools. I built musl-cross-make (to target the RG351 handheld) without issue under WSL and am moving onto rust next.
🌐
Heaths
heaths.dev › rust › 2025 › 05 › 11 › cross-compiling-x64-on-aarch64.html
Cross-compiling x64 on Aarch64 | Heath Stewart’s Blog
May 11, 2025 - The last line was just for convenience, which apt did for aarch64-linux-gnu-gcc and, originally, when I installed gcc-13-x86-64-linux-gnu standalone. I was finally able to cross-compile openssl-sys: cargo build PKG_CONFIG_SYSROOT_DIR=/usr/lib/x86_64-linux-gnu cargo build --target x86_64-unknown-linux-gnu · Tags: gcc, rustlang, tips, wsl
🌐
Reddit
reddit.com › r/rust › [help] rust cross-compile for aarch64 error `libdbus-sys v0.2.2`
r/rust on Reddit: [HELP] Rust cross-compile for aarch64 error `libdbus-sys v0.2.2`
December 11, 2022 -

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.

🌐
Krinkinmu
krinkinmu.github.io › 2020 › 12 › 13 › adding-rust-to-aarch64.html
Adding a little bit of Rust to AARCH64 | Welcome to the Mike’s homepage!
December 13, 2020 - First things first, we need the toolchain to cross compile for the target platform. Rust toolchain is based on LLVM, so I didn’t expect any problems with that. One difference between default distribution of Clang/LLVM I have in Ubuntu and Rust/Cargo is that Clang somehow comes with the built-in support for all the architectures supported by LLVM, but in case of Rust I had to install it: ... It’s rather hard to find what is the exact configuration of the aarch64-unknown-none target, but we can see some basic configuration parameters of the target using nightly version of the toolchain:
🌐
Rust
rust-lang.github.io › rustup › cross-compilation.html
Cross-compilation - The rustup book
When you first install a toolchain, rustup installs only the standard library for your host platform - that is, the architecture and operating system you are presently running. To compile to other platforms you must install other target platforms. This is done with the rustup target add command.
🌐
Kerkour
kerkour.com › rust-cross-compilation
Cross-compilation in Rust
April 3, 2025 - This post contains excerpts from my book Black Hat Rust Now we have a mostly secure RAT, it's time to expand our reach. Until now, we limited our builds to Linux. While the Linux market is huge server-side, this is another story client-side, with a market share of roughly 2.5%
🌐
Konifay
konifay.io › blog › 2026-0001-cross-compile-rust-fedora
Cross-Compiling a rust app for target aarch64 on host x86_64 using Fedora 42 - konifay
February 5, 2026 - Sets up a compilation environment (rust, cargo, gcc, ..) as well as the aarch64 sysroot within the container itself, so you'll need to modify it to your specific project needs! FROM fedora:42 # Install build dependencies (including C++ cross-compiler and CMake) RUN dnf install -y \ gcc \ gcc-c++ \ gcc-aarch64-linux-gnu \ gcc-c++-aarch64-linux-gnu \ sqlite-devel \ make \ curl \ pkg-config \ clang \ cmake \ git \ && dnf clean all # Copy rust-toolchain.toml to read the version COPY rust-toolchain.toml /tmp/rust-toolchain.toml # Install Rust using rustup with version from rust-toolchain.toml RUN R