В golang это делается очень просто:
$ GOOS=openbsd go build
cargo умеет кросс-компиляцию через ключ --target
, но:
$ cargo build --target=x86_64-unknown-openbsd
[...]
error[E0463]: can't find crate for `core`
|
= note: the `x86_64-unknown-openbsd` target may not be installed
= help: consider downloading the target with `rustup target add x86_64-unknown-openbsd`
For more information about this error, try `rustc --explain E0463`.
[...]
$ rustup target add x86_64-unknown-openbsd
error: toolchain 'stable-x86_64-unknown-linux-gnu' does not support target 'x86_64-unknown-openbsd'; did you mean 'x86_64-unknown-freebsd'?
note: you can see a list of supported targets with `rustc --print=target-list`
note: if you are adding support for a new target to rustc itself, see https://rustc-dev-guide.rust-lang.org/building/new-target.html
$ rustc --print=target-list | grep x86_64-unknown-openbsd
x86_64-unknown-openbsd
Что я делаю не так? Или я все делаю так, но там не осилили? Что происходит?
Версии:
$ uname -r
6.14.4-arch1-2
$ cargo --version
cargo 1.88.0 (873a06493 2025-05-10)