Build for Linux Mint



I’m just starting to learn Rust and a question on the use of Cargo.
I wrote a simple example (Hello world). Run the command on the Cargo build on Windows. The result was exe-file that I can carry on any machine.
When assembling on Linux Mint I get an executable file, but can not start it just by clicking a mouse. How to build to be able to be transferred to another computer?

P.S. Sorry for my bad English.



The build is relative to the machine and OS; so, you cannot just expect that a binary will work, especially on another OS. I guess there maybe tools out there to make binaries for other platforms but would expect mostly that devs build on the target platform to be sure it’ll work well.


I mean the transfer from machine to Linux Mint on another machine with the same operating system. The question of the necessary libraries.

That is, if run from the console a binary file, it works. But when you start an application from the window manager does not find the necessary libraries. Right?
Question: is it possible, together with a binary file and upload it to the necessary libraries to get a portable version?


There should be no runtime dependencies in binaries which would stop the program being run on another linux machine which doesn’t have rustc installed. The not opening from a windowed application is probably a different problem - unless you’ve gone out of your way to depend on system libraries, any binary produced by rustc on linux should work on any linux machine.


I think I know what he means. I’m just learning too and I can cargo run from the command line but actually clicking the binary file gives me this error:

Could not display “guessing_game”.

There is no application installed for “shared library” files.
Do you want to search for an application to open this file?

I’m on Ubuntu Gnome but I don’t think this has anything to do with distros. Being new to this kind of thing I think we just don’t understand how to make an application you can just click on.

I’m wondering if it’s maybe because our simple apps run in the terminal and the app doesn’t know to start a terminal? Just a guess. I’ll keep reading.

Oh and the application I made was the guessing game example from the Rust Docs