TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

How statically linked programs run on Linux

145 pointsby ptypeover 11 years ago

4 comments

mickeypover 11 years ago
The interesting contrast here is how things are done on Windows.<p>The reason most C++ programs ran on all Windows computers (and with such a tiny file size) is Windows shipped with the common libraries (C++ runtime) required to run the programs.<p>When Borland came out with Delphi they wanted Microsoft to include some of their own common libraries to reduce the footprint of the executable -- but Microsoft said no, meaning Delphi&#x27;s executables had to have everything linked into it statically, resulting in files that were an order of magnitude bigger. Aside from the stigma from larger file sizes in an era (the 90s) when this mattered, they arguably came out ahead in this department as Delphi by default avoided &quot;DLL hell&quot; (until MS solved it more or less definitively with Windows 2000) and would run anywhere, on anything, with no additional dependencies.
fiatmoneyover 11 years ago
Is it actually practical to statically compile &amp; link large parts of a modern C &#x2F; C++ based software environment? The last time I tried to do that with a nontrivial C program and GCC it felt like an ultimately unsuccessful snipe hunt.<p>Incidentally, cross-compiling static binaries is a hugely productive feature of Go.
评论 #6750699 未加载
评论 #6750536 未加载
评论 #6750715 未加载
nemo1618over 11 years ago
The suckless.org people (creators of dwm) are working on a fully static Linux distro[1]. I&#x27;m quite interested to see how it turns out, but at this point it&#x27;s starting to look like vaporware.<p>[1]: <a href="http://sta.li" rel="nofollow">http:&#x2F;&#x2F;sta.li</a>
Timmmmbobover 11 years ago
TL;DR: Good luck! At least until recently it was virtually impossible to actually do this - Autopackage used to have a list of things that prevented making decently portable binary packages for Linux. I believe they resorted to shipping a modified linker to get things to work.<p>Unfortunately there is a lot of hostility to making binary distribution easier on Linux because of the &quot;you should be using shared libraries and why would you ever want to distribute binaries when you can just distribute the source code?&quot; attitude that prevails.<p>Having said that, GCC did finally add a <i>real</i> option to link statically (i.e. not `-static`) a few years ago. And I believe the linker finally supports symbol versioning.