Closed
Description
I'm new with rust, just started playing around with it.
Output of rustc --version --verbose
:
rustc 1.48.0 (7eac88abb 2020-11-16)
binary: rustc
commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4
commit-date: 2020-11-16
host: x86_64-unknown-linux-gnu
release: 1.48.0
LLVM version: 11.0
Basically I'm not getting an executable-format(it's still executable tho, more like a lib) output binary when I specify x86_64-unknown-linux-musl
as the target. This is what I ran:
cargo build --release --target x86_64-unknown-linux-musl
After that on checking the output executable with file
, I get the following:
ruston: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=be7ffcac4063277b96b8eeeba2adf0d3a02fcfe3, stripped
Also on running ldd
:
statically linked
While if I run cargo build --release --target i686-unknown-linux-musl
, I kinda get my expected results.
file output:
ruston: ELF 32-bit LSB executable, Intel 80386, version 1 (GNU/Linux), statically linked, BuildID[sha1]=5160d9b8fb9616aba4ecb05ce9e9d56638fdf187, stripped
ldd output:
not a dynamic executable
I'm sorry if I've misunderstood anything and thanks in advance :)
Tl;dr: x86_64-unknown-linux-musl
build target is generating ELF LSB shared object (dynamically linked)
while i686-unknown-linux-musl
is making ELF LSB executable (statically linked)
binary.