Is there an easy way to cross compile rust?
I have recently started learning rust and it seems like there isn't an easy way to cross compile. Did I miss something in the documentation?
Why is that?
I have recently started learning rust and it seems like there isn't an easy way to cross compile. Did I miss something in the documentation?
Why is that?
For example, a lot of Rust projects are totally fine wrapping a C library to get the job done. This means you don’t just need Rust set up to cross compile, but also C. There’s a very strong push for pure-Go code bases in Go for this reason. Go also attempts to not use libc if possible, though they’ve weakened that a bit over the years. We use the system linker, and so cross compiling to x86_64-pc-windows-msvc is tough, because link.exe won’t run outside of Windows, for example.
That being said, some combinations are easy. Compiling to embedded targets is a piece of cake, as the other comment explains. Cross compiling between UNIXes is easy, and cross compiling to Linux is easy.
cargo build --target <arch>
You can also set it by default:
https://stackoverflow.com/questions/49453571/how-can-i-set-d...