That issue appears to have been fixed months ago, but you can only check that with the trunk snapshots that have the fix. Unfortunately, there haven't been any trunk Static Linux SDK snapshots shipped since then for you to use with that trunk compiler, so you could only verify it by compiling for macOS or directly on linux, ie without cross-compiling using the Static Linux SDK.
What you may be seeing if you downloaded snapshot SDKs too is that the version of the compiler and the SDK must exactly match, and the tools currently don't track that for you. Otherwise, if you are seeing random flakes, try running swift package clean and starting over: report an issue if you see an error fairly consistently.
You build for the different architectures by supplying different target triples, that is clear in the doc. The tools do a bad job of telling you what architectures are supported by each SDK: I have an open pull to fix that. Swift SDKs do not currently support fine-grained versioning of Glibc and Debian and so on, at least if they use the same target triple and you want some way to specify those other versions to the compiler.
The tool currently assumes that --swift-sdk is only invoked when cross-compiling, not when natively compiling.
Based on that above assumption, there isn't a single command you could use: you'd have to factor in the host arch and pass in different flags based on that.
Good point, if you replace that error with #error("Unknown platform"), it will work.
It isn't, but it was the easiest to implement.
I believe most cross-platform languages that expose the platform C library punt on this problem and do not provide a cross-platform C API or wrapper, because it's a lot of work to do otherwise. There has been some discussion about providing something like what you want, but it hasn't led to anything you can use.
Swift has its own terminology, that you can read in the SDK spec, if you're interested.
Some of this stuff you list is clear in the tutorial, some of it is bugs and errors, some of it is specific to Swift's insular world. Swift is still going cross-platform, and you'll have to pardon our dust while we make these SDKs more robust.
Keep reporting your problems in this forum and on GitHub: they will help us improve these SDKs and tools. And since most of it is open source, you can always pitch in and help fix them, of course. ![]()