This is a thing that's having work done, but still too large depending:
https://www.swift.org/documentation/articles/static-linux-ge...
See here for sizes of various languages as of August 2024 when I'm commenting, but this is Swift 5.10 for Windows:
https://github.com/MichalStrehovsky/sizegame
Build actions here:
https://github.com/MichalStrehovsky/sizegame/blob/master/.gi...
What you want, instead, is Swift 6 for Linux, while e.g. Alpine, as of summer, still too large:
https://mko.re/blog/swift-alpine-packaging/#:~:text=Package%....
In this thread on Swift for AWS Lambda, a dev gets a Linux static build to 5.9 megabytes:
"Then, I stripped it and it's now 5.9Mb. That's an impressive 86% reduction. Given that musl libc.a is 2.4Mb and libc++.a is 10Mb, I find that 5.9Mb for an executable that contains both libc and the Swift runtime is not that bad :-)"
https://forums.swift.org/t/aws-lambda-functions-and-the-linu...
> They probably have too much technical dept already due to the support of XXX edge cases Apple need for iOS/MacOS development.
See also embedded Swift:
"Apple explains that Embedded Swift is a subset of the Swift programming language with a much smaller footprint (the binary can be around 10KB..."
https://www.cnx-software.com/2024/06/13/embedded-swift-esp32...