Adding these 2 environments worked for me:

export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc
export CC=aarch64-linux-gnu-gcc
Answer from lu ji on Stack Overflow
🌐
musl libc
wiki.musl-libc.org › porting › aarch64
musl libc - Porting/AArch64
Use Rich Felker’s musl-cross-make and just set ARCH to aarch64 to build the stage1 toolchain for testing (build errors will happen as soon as stage1 gcc is compiled and kernel headers are installed, that is expected.)
🌐
GitHub
github.com › rust-lang › rust › issues › 46651
Cannot cross-compile aarch64-musl on x86_64 linux · Issue #46651 · rust-lang/rust
December 11, 2017 - C-bugCategory: This is a bug.Category: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateO-muslTarget: The musl libcTarget: The musl libcT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue. ... asonix@asonix-boxes-16-04:~/hello-world-rust$ cat src/main.rs fn main() { println!("Hello, world!"); } I'm compiling the default hello-world application, and it works fine for aarch64-unknown-linux-gnu in addition to working fine for arm-unknown-linux-musleabihf.
Author   asonix
🌐
Arch Linux
aur.archlinux.org › packages › aarch64-linux-musl
AUR (en) - aarch64-linux-musl
[Y/n] Y :: Importing keys with ... 56BCDB593020450F: no user ID gpg: Total number processed: 1 -> problem importing keys · aarch64-linux-gnu-gcc is a runtime dependency and should be moved from makedepends to depends....
🌐
Arch Linux
archlinux.org › packages › extra › x86_64 › musl-aarch64
Arch Linux - musl-aarch64 1.2.5-6 (x86_64)
aarch64-linux-gnu-gcc (make) riscv64-linux-gnu-gcc (make) rust (make) View the file list for musl-aarch64 · View the soname list for musl-aarch64 · Copyright © 2002-2026 Judd Vinet, Aaron Griffin and Levente Polyák. The Arch Linux name and logo are recognized trademarks.
🌐
Musl
musl.cc
musl libc toolchains | static cross/native toolchains
../ SHA512SUMS 06-Feb-2023 19:45 17033 aarch64-linux-musl-cross.tgz 23-Nov-2021 04:34 108096828 aarch64-linux-musl-native.tgz 23-Nov-2021 04:43 85323901 aarch64_be-linux-musl-cross.tgz 23-Nov-2021 04:34 109388665 aarch64_be-linux-musl-native.tgz 23-Nov-2021 04:43 86177030 arm-linux-musleabi-cross.tgz 23-Nov-2021 04:34 102611361 arm-linux-musleabi-native.tgz 23-Nov-2021 04:44 78803789 arm-linux-musleabihf-cross.tgz 23-Nov-2021 04:34 102391022 arm-linux-musleabihf-native.tgz 23-Nov-2021 04:44 78565379 armeb-linux-musleabi-cross.tgz 23-Nov-2021 04:34 103654098 armeb-linux-musleabi-native.tgz 23-N
🌐
Alpine Linux
pkgs.alpinelinux.org › contents
Package index - Alpine Linux packages
Contents filter · Alpine Linux | Privacy Policy | Apkbrowser Project
Find elsewhere
🌐
GitHub
github.com › lovell › aarch64-linux-musl-crosstools
GitHub - lovell/aarch64-linux-musl-crosstools: Cross-compiler toolchain to produce linuxmusl-arm64v8 binaries on linuxmusl-x64 · GitHub
Cross-compiler toolchain to produce linuxmusl-arm64v8 binaries on linuxmusl-x64 - lovell/aarch64-linux-musl-crosstools
Author   lovell
🌐
GitHub
github.com › chase535 › aarch64-linux-musl-gcc
GitHub - chase535/aarch64-linux-musl-gcc: aarch64-linux-musl-gcc
开启GitHub Actions,协调世界时每周一的1点左右自动clone最新的binutils、gcc、musl源码并下载最新的Release版gmp、mpfr、mpc、isl源码进行CI构建并推送
Starred by 23 users
Forked by 9 users
Languages   C++ 51.2% | C 35.9% | Roff 11.2% | Python 0.4% | Linker Script 0.4% | XC 0.3% | C++ 51.2% | C 35.9% | Roff 11.2% | Python 0.4% | Linker Script 0.4% | XC 0.3%
🌐
Debian
packages.debian.org › sid › arm64 › musl-dev › filelist
File list of package musl-dev in sid of architecture arm64
skip the navigation · Packages · About Debian · Getting Debian · Support · Developers' Corner · / Packages / sid / musl-dev / arm64 / File list · /usr/bin/aarch64-linux-musl-gcc /usr/include/aarch64-linux-musl/aio.h /usr/include/aarch64-linux-musl/alloca.h /usr/include/aarch64-linux-musl/ar.h /usr/include/aarch64-linux-musl/arpa/ftp.h /usr/include/aarch64-linux-musl/arpa/inet.h /usr/include/aarch64-linux-musl/arpa/nameser.h /usr/include/aarch64-linux-musl/arpa/nameser_compat.h /usr/include/aarch64-linux-musl/arpa/telnet.h /usr/include/aarch64-linux-musl/arpa/tftp.h /usr/include/aarch64-
🌐
GitHub
github.com › rust-lang › stacker › issues › 80
`aarch64-unknown-linux-musl` target on amd64 Linux fails? · Issue #80 · rust-lang/stacker
May 15, 2023 - $ export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc $ cargo build -p prqlc --release --target=aarch64-unknown-linux-musl Compiling cfg-if v1.0.0 Compiling once_cell v1.17.1 Compiling bitflags v1.3.2 Compiling linux-raw-sys v0.1.4 Compiling libc v0.2.140 Compiling utf8parse ...
Published   May 15, 2023
Author   eitsupi
🌐
Stack Exchange
unix.stackexchange.com › questions › 619233 › how-to-get-aarch64-version-of-musl-on-debian-for-qemu-user-mode
windows subsystem for linux - How to get aarch64 version of musl on Debian for qemu user mode - Unix & Linux Stack Exchange
I have qemu user mode and I try running it with qemu-aarch64 -L /usr/aarch64-linux-gnu/ binary_name but I get the error · /lib/ld-musl-aarch64.so.1: No such file or directory ... sudo apt-get install install gcc-arm-linux-gnueabihf libc6-dev-armhf-cross qemu-user-static libc6-dev-arm64-cross gcc-aarch64-linux-gnu
🌐
Arch Linux ARM
archlinuxarm.org › packages › aarch64 › musl
musl (aarch64) | Packages | Arch Linux ARM
The Arch Linux™ name and logo are used under permission of the Arch Linux Project Lead.
🌐
GitHub
github.com › briansmith › ring › issues › 1414
Can't compile ring with target aarch64-unknown-linux-musl · Issue #1414 · briansmith/ring
October 13, 2021 - --- stderr running "aarch64-linux-musl-gcc" "-Os" "-ffunction-sections" "-fdata-sections" "-fPIC" "-I" "include" "-Wall" "-Wextra" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" ...
Author   ghost
🌐
Bootlin
toolchains.bootlin.com › releases_aarch64.html
Cross-compilation toolchains for Linux - aarch64 toolchains
toolchains.bootlin.com · About · Toolchains · All aarch64 toolchains · Tests passed Build test failed Test system did not boot Can not test · glibc · uclibc
🌐
musl libc
wiki.musl-libc.org › getting-started.html
musl libc - Getting started
Whether building your own or downloading binaries, you need to select the appropriate GCC-style tuple for the architecture/ABI you want to target. It takes the form [arch]-linux-musl[abi_modifiers]. For example, ARM is arm-linux-musleabi for standard soft-float EABI and arm-linux-musleabihf ...
🌐
Jensd's I/O buffer
jensd.be › 1126 › linux › cross-compiling-for-arm-or-aarch64-on-debian-or-ubuntu
Cross compiling for arm or aarch64 on Debian or Ubuntu | Jensd's I/O buffer
January 26, 2021 - After downloading and extracting the source code, we need to run the configure-script for libpcap first. Only this time, we need to set our compiler to the musl-compiler for our cross compilation by setting CC to: aarch64-linux-musl-gcc: