-
Notifications
You must be signed in to change notification settings - Fork 94
Description
This text in the guide is incorrect:
"To produce statically linked binaries, Rust provides two targets: x86_64-unknown-linux-musl and i686-unknown-linux-musl. The binaries produced for these targets are statically linked to the MUSL C library."
The reality is more complex.
$ cargo build --target=x86_64-unknown-linux-musl
Finished dev [unoptimized + debuginfo] target(s) in 0.82s
$ ldd target/x86_64-unknown-linux-musl/debug/danish-rust
linux-vdso.so.1 (0x00007ffc876d5000)
libpcap.so.0.8 => /usr/lib/x86_64-linux-gnu/libpcap.so.0.8 (0x00007fef24af2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fef24931000)
/lib/ld64.so.1 => /lib64/ld-linux-x86-64.so.2 (0x00007fef24d3f000)
$ file target/x86_64-unknown-linux-musl/debug/danish-rust
target/x86_64-unknown-linux-musl/debug/danish-rust: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld64.so.1, BuildID[sha1]=c39a38306ce6f311f961c3477136f33c1b76bd10, with debug_info, not stripped
This is the project I'm compiling.
https://github.com/smutt/danish-rust
I suspect my problem is the dependency on libpcap. But I don't understand why this also results in libc being dynamically linked. What I would like to do either 1) produce a statically linked binary, or 2) dynamically link to libpcap on the target system.