5 ms·
Fun fact... Many Windows programs generally do some sort of 'hybrid static linking' (this is my own terminology) where programs are distributed with the `.dll`
by delta_p_delta_x 2y ago
Fun fact... Many Windows programs generally do some sort of 'hybrid static linking' (this is my own terminology) where programs are distributed with the `.dll` libraries just next to the binary. There is no concept of RPATH on Windows—the loader looks for dynamically-linked libraries in a fixed set of locations which includes the binary's directory.
Windows programs generally do link dynamically to core Windows libraries—which users are never expected to mess with anyway—and the C and C++ runtimes, but even these can be statically linked against with `cl.exe /MT`. Some programs even distribute newer versions of the C/C++ runtimes; that's where the famous Visual C++ Redistributables come from.
I agree, though—static linkage should be the default for end-user programs. I long for a time when Linux gets 'libc' redistributables and I can compile for an old-hat CentOS 6 distribution on a modern, updated, rolling-release Arch Linux without faffing with a Docker container.
- GoblinSlayer 2y agoCompiling for CentOS 6 is a linking problem, and any linker lets you link with whatever you want, it's a matter of running the linker with the right arguments.
- int_19h 2y ago> There is no concept of RPATH on Windows—the loader looks for dynamically-linked libraries in a fixed set of locations which includes the binary's directory. This is not true - you can control the DLL path via manifests. There's also a "known DLLs" list in registry which can globally redirect basically any DLL system-wide.
- kazinator 2y agoMany programs link various libraries of theirs statically, but then dynamically link to the system C library. For instance, GNU Make uses some of GNULib. https://git.savannah.gnu.org/cgit/make.git https://git.savannah.gnu.org/cgit/make.git (gl subdirectory)
- sunshowers 2y agoFor Rust, cargo zigbuild lets you compile against arbitrary old glibc. Probably can get that working with C as well.
- forrestthewoods 2y ago> I long for a time when Linux gets 'libc' redistributables and I can compile for an old-hat CentOS 6 distribution on a modern, updated, rolling-release Arch Linux without faffing with a Docker container. The Linux linking model is so bad. So extremely very bad. Build systems should never rely on whatever garbage happens to be around locally. The glibc devs should be ashamed.
- anacrolix 2y agoNoice
- aqueueaqueue 2y agoThere was a time when 200Mb was a big HDD. Can forgive for that reason.
- porridgeraisin 2y agoCan you explain more? Curious and not able to google and understand this thread. Specifically, what is stopping libc redistributables from being possible? And why disk size limitations from back then caused this situation.
- forrestthewoods 2y agoOnce upon a time hard drive space mattered and so it was arguably better to use shared libraries to reduce duplication. This is no longer relevant.
- forrestthewoods 2y agoI can’t. At some point you simply have to move on.
- torstenvl 2y agoIt's true. I keep an Ubuntu 16 LTS VM around for making binary redistributables on Linux. It's the only way to ensure compatibility.
- torginus 2y agoImo this is a much saner solution for a system that supports precompiled applications. Every time I tried to get a third-party binary app running on Linux, I discovered what the vendor did is they shipped half their dependencies as blobs, and relying on the system for the other half - which is an incredibly brittle system that breaks constantly. The entry point usually is a script that sets LD_LIBRARY_PATH and then calls into the executable.