News for hackers. Stuff that matters.
Re:Swift Static Linux SDK by umanwizard on Tuesday June 11, 2024 @05:16PM (#40651593)
Dynamic linking works fine for software that is distributed by distros, but lots of software isn't.
Re:Swift Static Linux SDK by palata on Tuesday June 11, 2024 @05:30PM (#40651755)
Sure. It's great to have the possibility to link statically.

My beef with the "static linking trend" is that many people (or languages, e.g. Rust) don't want to let me link dynamically, for some reason. Just let me choose!

Re:Swift Static Linux SDK by tux3 on Tuesday June 11, 2024 @05:48PM (#40651980)
But they do. They do let you choose.

Debian's build of rust packages are linked dynanically, for instance. It's a build setting, you can turn it on.

Re:Swift Static Linux SDK by LtWorf on Tuesday June 11, 2024 @05:59PM (#40652087)
No, crates will be statically linked anyway in general.
Re:Swift Static Linux SDK by kibwen on Tuesday June 11, 2024 @08:51PM (#40653335)
Rust supports dynamic linking, it's just not the default, so you need to configure a given crate to use it at build time.
Re:Swift Static Linux SDK by LtWorf on Wednesday June 12, 2024 @12:40AM (#40654594)
Rust supports compiling each crate as a separate .so and then linking all of them?

That's not at all how debian packages written in rust are linked. So the person I replied to is incorrect.

I suspect you're incorrect as well and what you claim doesn't exist at all, but you're claiming a different thing.

Re:Swift Static Linux SDK by umanwizard on Wednesday June 12, 2024 @06:16AM (#40656438)
> Rust supports compiling each crate as a separate .so and then linking all of them?

Yes, by passing crate-type=dylib to the compiler.

Re:Swift Static Linux SDK by whytevuhuni on Wednesday June 12, 2024 @03:18PM (#40661874)
Due to the lack of ABI stability, the resulting dynamic library is tied to the exact binary hash of the Rust compiler (which includes the dependencies rustc was built from).

Those dynamic libraries will also not remain ABI stable if their code changes (because Rust's semver specifically applies to the public API, but the public API is free to pass around structs with private fields, which may alter the layout drastically even for minor semver-compatible changes).

So this helps with some aspects (such as libraries being reused between binaries, reducing disk usage).

But it does not help with the issue most discussed in this thread: that of security updates (all libraries have to be rebuilt whenever rustc changes or a dependency changes, all programs (potentially the entire operating system) have to be redownloaded by all users, etc).

Re:Swift Static Linux SDK by PaulDavisThe1st on Tuesday June 11, 2024 @09:52PM (#40653698)
For decades, Unix-y software has been distributed with dynamic linking made possible by the use of a startup script that also sets LD_LIBRARY_PATH (which means the dynamic linker will find the libs that come with the software in preference to system-provided ones.