0

I am just starting to learn rust and I want to send my friend a little program I made. However, I am on windows and he is using an Arch based OS (I think one of the Manjaro KDE ones). How would I compile my cargo project to work on his OS? Or any other platform really.

Well I don't really know where to start. I'm not exactly an experienced professional.

DaFrancc
  • 21
  • 3

2 Answers2

0

Your question is essentially the same as Cross-compile a Rust application from Linux to Windows you just have to replace the target triple in this answer with x86_64-unknown-linux-gnu:

rustup target add x86_64-unknown-linux-gnu
cargo build --target x86_64-unknown-linux-gnu

and distribute the file target/debug/<your_crate_name>

cafce25
  • 15,907
  • 4
  • 25
  • 31
0

Specifically for Windows to Linux on the same architecture, you can use WSL. This is likely the easiest method.

Otherwise, you can use rustup target add from the other answer. You likely need to find the linker for the target platform.

The most flexible method is to use cross.

cafce25
  • 15,907
  • 4
  • 25
  • 31
drewtato
  • 6,783
  • 1
  • 12
  • 17