Why does Rust produce shared libs rather than executables on Linux?


I’ve noticed that if you run file on a Rust executable it does not show a type of ELF 64-bit LSB executable like all other executables on my system. Instead, it shows ELF 64-bit LSB shared object. This means that executables produced by Rust can only be used from the command line, and do not work in gui file managers. Does anyone know why that is and if it is possible to change it?

Note: this is on all executables, including rustc and cargo that I got from rustup.sh

An example of what happens if I try to double click a Rust executable:

An example of executing from the command line:

file on Clang and Rust executables:


This is likely just a bug. Have you filed an issue on Github?


I have not, as I was not sure this is a bug, I thought it might be a setting I hadn’t configured or something. I will make an issue now.


Turns out my initial thought was right, it isn’t a bug. https://github.com/rust-lang/rust/issues/19688


Well, it is a bug. Just not in Rust :wink: