Why target "aarch64-unknown-freebsd" cannot be installed on the Debian GNU/Linux platform?

Why can target aarch64-unknown-freebsd not be installed?

me@debian:~/dev/proxy-server$ rustup target add aarch64-unknown-freebsd
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not support target 'aarch64-unknown-freebsd'
note: you can see a list of supported targets with `rustc --print=target-list`

When I run rustc --print=target-list, as suggested, it does show up as supported :thinking:

me@debian:~/dev/proxy-server$ rustc --print=target-list | grep freebsd
aarch64-unknown-freebsd
armv6-unknown-freebsd
armv7-unknown-freebsd
i686-unknown-freebsd
powerpc-unknown-freebsd
powerpc64-unknown-freebsd
powerpc64le-unknown-freebsd
riscv64gc-unknown-freebsd
x86_64-unknown-freebsd

Note that x86_64-unknown-freebsd and i686-unknown-freebsd install just fine!

At the moment, I can successfully cross-compile from Linux to x86_64-unknown-freebsd and i686-unknown-freebsd as well as aarch64-apple-darwin and x86_64-apple-darwin. It would be very cool, if x86_64-unknown-freebsd could somehow be made working too :sweat_smile:


My system info:

me@debian:~/dev/proxy-server$ cargo version
cargo 1.85.0 (d73d2caf9 2024-12-31)
me@debian:~/dev/proxy-server$ uname -a
Linux debian 6.12.16-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.16-1 (2025-02-22) x86_64 GNU/Linux

See Platform Support - The rustc book

Rust's own infrastructure only produces builds for Tier 1 and 2 platforms. For Tier 3 like aarch64-unknown-freebsd, the code is there but you have to build it yourself, including the standard library.

1 Like

What is the rationale to make i686, which is pretty much an obsolete architecture (everybody who uses "x86" processor today almost certainly uses x86_64), a "Tier 2" platform, but make aarch64, which everybody seems to be moving to right now, only a "Tier 3" platform :confused:

If I were to build aarch64-unknown-freebsd myself, how complicated is that? Can it be cross-compiled on a Linux (x64) machine, or do I need a "native" FreeBSD running on aarch64?

I would guess that's just historical momentum. We have Tier 1 aarch64 Linux and macOS targets, and we're starting to demote some i686 targets. I suppose nobody has bothered to figure out how to get aarch64-unknown-freebsd building in Rust CI yet. There's also a more specific page where you can find the current maintainers, and maybe even join them:

https://doc.rust-lang.org/nightly/rustc/platform-support/freebsd.html

In general, you can use the nightly toolchain with Cargo's -Zbuild-std option, but you'll still have to get the C toolchain for cross-compilation. Maybe Debian has that target already? The script in Rust CI is here:

1 Like