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 my understanding is that you might want to have greater control hence you staticaly link over optimising for (the lack of) space.
I undsrstand nothing about the subject tho
@neon version differences, possibly
@neon Don't BSD and Linux treat strings differently in their versions of libc?
@Canageek Quick googling revealed that apparently glibc has some functions that BSD libc doesn't. I'd definitely see this as a reason to statically link libc, just to avoid that mess.
@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
@neon (this is what i'm using in the distro i'm building)
@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.
@kurisu Does this have something missing? https://doc.rust-lang.org/1.9.0/book/advanced-linking.html#static-linking