3 ms·
I have a project to rebuild a complete alpine to make static binaries, glibc does not like static for political reasons, the feature to make static binaries is
by zoobab 4y ago
I have a project to rebuild a complete alpine to make static binaries, glibc does not like static for political reasons, the feature to make static binaries is broken, and undocumented on purpose. Long life musl!
http://stalinux.wikidot.com http://stalinux.wikidot.com
- mort96 4y agoGNU may have a political opposition to static linking, but there are major practical issues too. For features like nsswitch, the libc has to dlopen shared libraries, which themselves link against libc. Static linking means you'll end up with (at least) 2 different libc versions in the address space at the same time, operating on the same data structures. GNU (and some other libc implementors) try to make that work as well as possible, but it's necessarily an unholy mess.
- zoobab 4y ago28 years of using linux, never used nsswitch.conf. I learned about it's existence when a colleague of mine asked a question about it during an recruiting interview of a candidate.
- jackweirdy 4y agoI feel like someone has opened a jet engine and showed me there’s a hamster wheel in there; I had no idea this even existed
- InvaderFizz 4y agoJust a matter of where and how you worked. I would expect anyone doing sysadmin work on Linux in any sort of centrally managed network would have exposure to it. It is certainly relevant any time you are messing with NIS/LDAP configs and troubleshooting. Your typical developer, even doing C app development I wouldn't expect to have interacted with nsswitch unless their local name resolution was broken somehow and they were trying to fix their own problems.
- anthk 4y agoI tought LDAP/YP already configured that upon proper configuration.
- pxc 4y agoCame up in my first few years of using Linux, as a kid, at home, to get NetBIOS and Avahi name resolution working so my device could access Windows network shares and other things by name. No fancy enterprise use case required; just being able to ping a computer on the LAN by name involves nsswitch.conf!
- Ferret7446 4y agoShouldn't dbus solve this issue?
- mort96 4y agoNot until someone does the work of transitioning all uses of dlopen in glibc to dbus communication with a service. I don't think that's currently a plan, and building a dbus client into glibc doesn't seem very plausible.
- aidanhs 4y agoI didn't believe you that it was broken, but you're right - very disappointing. For anyone interested, the bug for it being is at [1] (reported mid 2021). The build failure is easy to fix, so I created a repo at [2] which builds a program against a glibc with static nss. I verified with strace that it does indeed check nsswitch.conf and try and load dynamic libraries (I'd at least submit my patch [3] for the build failure but I find mailing lists to be a hassle) All this said, I wouldn't call it undocumented - it's documented in the `configure --help` itself as well as the online version [4], and it has an FAQ entry [5]. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=27959 https://sourceware.org/bugzilla/show_bug.cgi?id=27959 [2] https://github.com/aidanhs/gcc-static-linking https://github.com/aidanhs/gcc-static-linking [3] https://github.com/aidanhs/gcc-static-linking/blob/1f04425e2890ce38773a20bfbd40c788df012f23/script.sh#L14 https://github.com/aidanhs/gcc-static-linking/blob/1f04425e2... [4] https://www.gnu.org/software/libc/manual/html_node/Configuring-and-compiling.html https://www.gnu.org/software/libc/manual/html_node/Configuri... [5] https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked...