How to compile Mac with Linux?

I wrote a small game using Rust, and I used cargo build --releaseto compile the release version on Mac.

I tried to share this with my friend who uses Ubuntu, but when he tried to run the binary, he got the following error:

cannot execute binary file: Exec format error

I searched for this but did not find the answers. Does Rust claim to be "lack of runtime"? Can't it work in binary form?

+4
source share
2 answers

, , , , (, -). (.. ), MacOS Linux.

, -. rustup, - :

# Install the toolchain to build Linux x86_64 binaries
rustup target add x86_64-unknown-linux-gnu

:

cargo build --release --target=x86_64-unknown-linux-gnu

: OS X, ; , , !

+6

, , Rust ( Java JVM), , ; , , -. Rust, , , - Rust GitHub repo.

+2

Source: https://habr.com/ru/post/1667346/


All Articles