<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><div><br></div>I've noticed that the standard "swift build" binaries are dynamic (which makes sense), and there are quite a few dependencies. For a trivial hello world, the hello binary depends on:<br></div>libswiftCore.so<br></div>libstdc++.so.6<br></div>libm.so<br></div>libgcc_s.so.1<br></div>libc.so.6<br><br></div>and libswiftCore.so further depends on:<br></div>libpthread.so.0<br></div>libdl.so.2<br></div>libicuuc.so.55<br></div>libicui18n.so.55<br></div>libbsd.so.0<br></div>libstdc++.so.6<br></div>libm.so.6<br></div>libgcc_s.so.1<br></div>libc.so.6<br></div>ld-linux-x86-64.so.2<br><br></div>If I want to build something I can hope will run on other linux machines with potentially arbitrary distributions, it'd be really nice to be able to build fully static, or at least more self-contained binaries. <br><br>Both license-wise and operationally, linking glibc staticly is problematic, but at least glibc has very strong backward compatibility with itself. libstdc++ on the other hand is something I'd always want staticly linked to not be at the whim of ABI breakages from release to release.<br><br></div>I'm curious about the libstdc++ dependency, since I was under the impression the swift runtime was written in swift. What part of the runtime or generated code causes this dependency to exist?<br><br></div>The libc dependency could be simplified by supporting musl-libc (small, MIT licensed, pretty source-compatible with glibc).<br><br></div>Given that libbsd and libicu are under permissive licenses and libstdc++ (if it's needed) has a linkage exception), it'd be nice to have a way to include those staticly (in either libswiftCore.so or final binaries), resulting in the only remaining dependencies being on libc/libc/libpthread/libdl which have extremely robust and well maintained API/ABI backward compatibility.<br><br></div>This should allow for linux binaries which have significantly better chances of working correctly on an arbitrary linux machine.<br></div>