[Pitch] Package Manager: Statically link Swift runtime libraries by default on supported platforms

Running the same commands with the last trunk snapshot toolchain from Dec. 6, the statically-linked executable is surprisingly much smaller, around 7.5 MB (I don't know what optimization is done differently in trunk, or if that small size would stick for non-trivial executables). Further, a subsequent trunk pull removed the libicu dependency for the stdlib, though not for swift-corelibs-foundation, so the static linking penalty keeps diminishing.

How does this affect a package like SwiftPM itself, which has a half dozen executables?

@SDGGiesbrecht, while this does not affect your question in any way, I just wanted to mention that your chosen example of SPM no longer ships a half-dozen executables but a single combo executable, swift-package, and several symbolic links to it. Run this command with recent trunk snapshots to see what I mean, ls -l swift-DEVELOPMENT-SNAPSHOT-2021-12-06-a-centos8/usr/bin/swift-*.

4 Likes