I developed a program on windows, and I need to deploy it on the Raspberry Pi, how do I compile it,i just know need add armv7-unknown-linux-musleabihf (target add armv7-unknown-linux-musleabihf)
Rust by itself is only capable of cross-compiling static libraries. Anything else requires extra dependencies and configuration. You will also need a linker capable of creating Linux binaries, Linux version of libc, and most likely also Linux-compatible C compiler and Debian libraries that dependencies use. Installing Debian libraries on Windows is fiddly, so an easier alternative is to use a virtual machine instead:
Another option is to use cargo-zigbuild
, because Zig has much better cross-compilation out of the box than Rust/Cargo:
Thanks for your reply, but after using cargo zigbuild --target armv7-unknown-linux-musleabihf still reports an error
failed to run custom build command for openssl-sys v0.9.82
failed to run custom build command for zstd-sys v2.0.7+zstd.1.5.4
But I will not achieve similar problems by running directly or cargo build --release
You will have to install Debian's dev
versions of these libraries and pkg-config
, or install build-essential
Debian package and use vendored
feature of openssl.
I'm sorry, I don't quite understand what you mean, do you mean to install the debian library on windows, and what is open.devpkg-configvendored
No, you won't be able to install it on Windows. You will need to install it inside a Linux virtual machine, e.g. by editing Dockerfile.
ok,thank you help me,
Maybe "wsl2" will help you if you work in "windows"
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.