4 ms·
Dynamic Linking
- davexunit 11y agoNo, dynamic linking isn't "harmful."
- overgard 11y agoGreat news everybody, after brilliant technologists like Rob Pike (contributor to the creation of unix, co-creator of Go) and John Carmack (creator of the most technologically innovative game engines of the time) weighed in on a subject with nuanced considerations of a complex technical issue, "davexunit" from the internet settled the issue by laying down the hammer. He didn't even need to explain his reasons because it was just like "BAM! TRUTH HAMMER DROPPED. PEACE OUT. mic dropped"
- quotemstr 11y agoGreat news everybody, a prominent technologist with strong opinions said something. Now we don't need to think for ourselves! Burn the ld.so! Burn the ld.so! Burn the ld.so!
- overgard 11y agoIf I said "Stephen Hawking was wrong about black holes", you would probably expect that statement to be followed with "because..". If I didn't write "because" then the only leg my argument would stand on would be my own credibility. Since "overgard from the internet" is not a world renowned physicist, you might be tempted to point out that Stephen Hawking has a track record for knowing what he's talking about when it comes to astrophysics and I do not.
- pjmlp 11y agoYeah, people are not allowed to think for themselves. Just because Rob Pike and John Carmack had successful careers, doesn't mean they are always right. As a side note, Plan9 and Inferno use dynamic linking a lot.
- anon4 11y agoTake it to its logical conclusion - statically compile the kernel in each executable. Build the task scheduler in the CPU. Make every program run on pure bare metal.
- TheLoneWolfling 11y agoIsn't this docker / etc in a nutshell? Albeit running on a VM as opposed to bare metal, and not actually currently statically linking everything.
- weland 11y agoThen watch the world burn at the CPU level :).
- bch 11y agohttp://www.techrepublic.com/article/unikernels-offer-a-stripped-down-alternative-to-linux/ http://www.techrepublic.com/article/unikernels-offer-a-strip... https://news.ycombinator.com/item?id=8606968 https://news.ycombinator.com/item?id=8606968
- ori_b 11y agoMirage OS, you mean? It seems like we're trying to head that way.
- 0x0 11y agoI'll take an "insecure" ldd over having to recompile every single binary when there is a glibc/libjpeg/libpng/libwhatever security fix, any day. I'm sure the ldd problem could be solved by writing a slightly smarter "ldd" that doesn't actually execute the ELF binary, as well.
- quotemstr 11y agoTry readelf -d. $ readelf -d ~/edev/trunk/src/emacs | grep NEEDED 0x0000000000000001 (NEEDED) Shared library: [libpthread.so.0] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x0000000000000001 (NEEDED) Shared library: [libtiff.so.5] 0x0000000000000001 (NEEDED) Shared library: [libjpeg.so.8] 0x0000000000000001 (NEEDED) Shared library: [libpng12.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgif.so.4] 0x0000000000000001 (NEEDED) Shared library: [libXpm.so.4] 0x0000000000000001 (NEEDED) Shared library: [libgtk-3.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgdk-3.so.0] 0x0000000000000001 (NEEDED) Shared library: [libpango-1.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libcairo.so.2] 0x0000000000000001 (NEEDED) Shared library: [libgdk_pixbuf-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgio-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgobject-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libglib-2.0.so.0] 0x0000000000000001 (NEEDED) Shared library: [libSM.so.6] 0x0000000000000001 (NEEDED) Shared library: [libICE.so.6] 0x0000000000000001 (NEEDED) Shared library: [libX11.so.6] 0x0000000000000001 (NEEDED) Shared library: [libXrender.so.1] 0x0000000000000001 (NEEDED) Shared library: [libXft.so.2] 0x0000000000000001 (NEEDED) Shared library: [libasound.so.2] 0x0000000000000001 (NEEDED) Shared library: [librsvg-2.so.2] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libacl.so.1] 0x0000000000000001 (NEEDED) Shared library: [librt.so.1] 0x0000000000000001 (NEEDED) Shared library: [libdbus-1.so.3] 0x0000000000000001 (NEEDED) Shared library: [libXfixes.so.3] 0x0000000000000001 (NEEDED) Shared library: [libxml2.so.2] 0x0000000000000001 (NEEDED) Shared library: [libgpm.so.2] 0x0000000000000001 (NEEDED) Shared library: [libtinfo.so.5] 0x0000000000000001 (NEEDED) Shared library: [libgconf-2.so.4] 0x0000000000000001 (NEEDED) Shared library: [libselinux.so.1] 0x0000000000000001 (NEEDED) Shared library: [libfreetype.so.6] 0x0000000000000001 (NEEDED) Shared library: [libfontconfig.so.1] 0x0000000000000001 (NEEDED) Shared library: [libz.so.1] 0x0000000000000001 (NEEDED) Shared library: [libotf.so.0] 0x0000000000000001 (NEEDED) Shared library: [libm17n-core.so.0] 0x0000000000000001 (NEEDED) Shared library: [libm17n-flt.so.0] 0x0000000000000001 (NEEDED) Shared library: [libgnutls-deb0.so.28]
- quotemstr 11y agoDynamic linking is a key innovation that we abandon at our own peril. Only those who are comfortable living in the world dynamic linking creates can agitate for its removal. In a way, advocates of pure static linking are like anti-vaccine advocates. Here's a killer application of dynamic linking: NSS. It's wonderful to be able to extend applications with new notions of names and addresses. Remember the bad old days when /etc/passwd parsing was hardcoded and you had a choice of either local users or NIS, and that choice was baked into every application? PAM is another good example. By the way: there's no such thing as static linking in Windows. All system calls go through ntdll.dll. (In fact, the actual system call numbers are scrambled with every service pack.) This property allows wonderful things, including a pure _userspace_ implementation of 32-bit compatibility for an otherwise pure 64-bit kernel.
- vezzy-fnord 11y agoIn a way, advocates of pure static linking are like anti-vaccine advocates. Holy fuck, this is one of the most absurd exaggerations I've read in some time. I'm assuming you have a very strong and convincing reason to justify this statement. Here's a killer application of dynamic linking: NSS. ... Really? NSS? OK, so static NIS/YP may not be good at all, but that doesn't change that NSS and the nscd (name server cache daemon) have been amongst the buggiest and most brittle components in glibc, on top of glibc's sequential DNS resolution. It's so bad the Busybox developers had to write a single-threaded fork-based alternative just to deal with its inherent resource exhaustion issues (see the comments in this software: http://busybox.net/~vda/unscd/ http://busybox.net/~vda/unscd/). And this: http://www.nico.schottelius.org/blog/nscd-bugs/ http://www.nico.schottelius.org/blog/nscd-bugs/ musl libc (ever growing in popularity in embedded and other fields for its standards compliance, robustness and implementation simplicity) doesn't support NSS and doesn't intend to, instead researching several alternative methods, the third one probably optimal: http://wiki.musl-libc.org/wiki/Open_Issues#NIS.2FLDAP.2Fother_user_databases http://wiki.musl-libc.org/wiki/Open_Issues#NIS.2FLDAP.2Fothe... And if you think this problem hasn't been solved so much more elegantly before, look into the details of Plan 9's ndb and factotum. PAM is another good example. bsd_auth is much better: http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/auth_approval.3?query=authenticate&sec=3 http://www.openbsd.org/cgi-bin/man.cgi/OpenBSD-current/man3/...
- snarfy 11y agoWhen Heartbleed hit, to fix your dynamically linked system, you replaced openssl and called it a day. With your statically linked system, you replace every single binary on your system that linked to openssl during build (if you can figure that out).
- shanemhansen 11y agoWith heartbleed I ran apt-get update && apt-get upgrade. With static linking I do the same. (I don't consider forcing the Debian build farm to rebuild dependencies an insurmountable challenge).
- quotemstr 11y agoAnd all the programs you compiled from source or got from other parties? Rebuilding the world on a whim is fantasy.
- shanemhansen 11y agoI disagree. Rebuilding the world on a whim is devops.
- overgard 11y ago
- gwu78 11y agoMost systems are actually a mix of statically linked and dynamically linked executables. For example, the systems I compile can all boot and function without the need for a dynamic linker. These static binaries are on a root filesystem that is in memory, not disk. Hence I can boot from removable media and then remove the media so the slot is open. If I need larger, complex, dynamically linked programs I mount a filesystem that has them along with the dynamic linker and then chroot. I build these filesystems separately, usually storing them on removable media.
- strictfp 11y agoI think it all depends on the granularity of dependencies and how you cope with multiple versions. If every app have their own version of a lib, you get problems with security updates and bloat. If you force a single version of each lib, you get a really slow testing and itegration cycle. If you choose something in between those extremes I think dynamic linking does have merit.
- ridiculous_fish 11y agoWhat exactly is being proposed here? Would every app statically link against some version of UIKit or the Android Java libs? How would the app run on different versions of the OS? How do you maintain forward compatibility? It's mystifying that the debate here centers around performance or RAM usage. The benefit of dynamic linking is architectural: it enables different components to evolve independently. I understand Plan 9 has an unusual approach, where things that are traditionally library calls (getMousePosition) are instead filesystem operations (read /dev/mouse). But this seems terribly rigid to me: we've just replaced structs with a static byte stream format. How do you evolve this?
- pjmlp 11y agoThe interesting bit is that Limbo on Inferno, Plan9's successor, only uses dynamic linking.