What's the point of statically linking libc? I've gotten the picture that there really aren't systems that don't have libc. Or is it just that dynamic linking is bad overall in some sense?

Pardon my possibly inaccurate wording, I'm still pretty new to low level stuff like this.

@neon many who push static linking propose that the latter is true, and that dynamic linking is harmful and should not be used in the majority of situations

on systems with a sanely designed libc (ie, not glibc) you often end up with better performance and lower memory usage than if you dynamically link (despite dynamic linking supposedly being better for those things)


@neon it also entirely removes the issue of dependency hell in a distro

you only need to deal with dependencies while compiling, not to install the application

@ky0ko Fair points. Is glibc bad because of the extensions it makes to standard or something deeper? I noticed while googling that it seems to have some functionality other libc implementations don't have, which seems weird for an implementation of a standard.

@neon it has a number of nonstandard extensions, and also behavior that is incompatible with a standard libc

it is, by many accounts, badly written, bloated, and does things that make you have to target its behavior explicitly

@neon an alternative to it is musl, which is designed to be 100% standards compliant, and correct

@ky0ko @neon doesn't musl keep around a lot of the gnu and linux extensions to ensure that software designed with only linux in mind actually still works

@scarlett @neon the fact that i've had to patch a bunch of stuff that expects glibc says no

@scarlett but it doesn't replicate the internal glibc headers that a lot of applications use even though they're not supposed to, it doesn't replicate a lot of gnu extensions

it does expect a compiler with __asm__

it does maintain a minor level of abi compatibility with glibc but all except the simplest applications will probably break if you try to drop it in place

@ky0ko Oh, that's good! When I first read about statically linking with Rust* I saw that you could statically link with musl, and wondered why that, not just your system libc. I guess that explains it!

* Well, it links rust dependencies statically by default, but like properly statically linking everything.

Sign in to participate in the conversation

cybrespace: the social hub of the information superhighway

jack in to the mastodon fediverse today and surf the dataflow through our cybrepunk, slightly glitchy web portal