4 ms·
Can you run ldd on any binary you currently have on your machine that is written in rust? I eagerly await the results!
by guappa 1y ago
Can you run ldd on any binary you currently have on your machine that is written in rust?
I eagerly await the results!
- tux3 1y agoI mean, sure, but what's your point? Here's nu, a shell in Rust: $ ldd ~/.cargo/bin/nu linux-vdso.so.1 (0x00007f473ba46000) libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007f47398f2000) libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007f4739200000) libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f473b9cd000) libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4739110000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4738f1a000) /lib64/ld-linux-x86-64.so.2 (0x00007f473ba48000) libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f473b9ab000) libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007f4738e50000) And here's the Debian variant of ash, a shell in C: $ ldd /bin/sh linux-vdso.so.1 (0x00007f88ae6b0000) libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f88ae44b000) /lib64/ld-linux-x86-64.so.2 (0x00007f88ae6b2000)
- guappa 1y agoWell seems I was wrong about linking C libraries from rust. The problem of increased RAM requirements and constant rebuilds are still very real, if only slightly less big because of dynamically linking C.
- deleted 1y ago[deleted]
- whytevuhuni 1y agoI’m genuinely curious now, what made you so convinced that it would be completely statically linked?
- IshKebab 1y agoI think people often talk about Rust only supporting static linking so he probably inferred that it couldn't dynamically link with anything. Also Go does produce fully static binaries on Linux and so it's at least reasonable to incorrectly guess that Rust does the same. Definitely shouldn't be so confident though!
- CamouflagedKiwi 1y agoGo may or may not do that on Linux depending what you import. If you call things from `os/user` for example, you'll get a dynamically linked binary unless you build with `-tags osusergo`. A similar case exists for `net`.
- guappa 1y agogo by default links libc
- IshKebab 1y agoIt doesn't. See the sibling comment.