Ohh, I see, it should be --swift-sdk, but the Swift.org - Getting Started with the Static Linux SDK page currently says just --sdk: the --sdk parameter is wrong on Linux, it doesn't compile the static binary, while the --swift-sdk compiles it under the x86_64-swift-linux-musl folder as expected!
Drat! I'll have to get that fixed. It's very confusing because there is also an --sdk option, but it doesn't do what we want here, and you'll just get the wrong behaviour.
To elaborate on the segfault problem, this isn't actually a problem with the Static SDK for Linux โ it's an issue with the toolchain where it's trying to use libraries from the OS, but because of a problem with the OS hosted libraries we end up thinking that things are marked with the in-development availability (9999) are available when in fact in the OS libraries they are not.
Sorry for the advertisement, but you can use Product | Archive for distribution menu command in Plain Swift. I simply cannot agree that Swift binaries are not portable.
You're replying to a post from five years ago. When he said that Swift binaries were not portable, he was correct in 2019. Obviously today static linking allows you to compile portable code, especially with the new Musl SDK.
Also, he was specifically talking about portability between different Linux distros.