Feature request: Cross-compilation out of the box!

Swift looks pretty cool! I would love to write more systems applications in Swift, however for my purposes, I tend to use Go instead, as Go includes built-in, easy-as-hell cross-compiler support for building macOS binaries, Linux binaries, Windows binaries, and binaries for many other environments, without requiring the user to setup complicated toolchains. Could Swift get something like this?

I really want the software I write to feature ports for different operating systems. For Go projects, this is as easy as looping over the target parameters with gox. For other systems languages like Swift, Rust, and C/C++, the best we can do right now is either dual boot or lug around hardware for the different OS's (yuck!), or setup virtual machines (also yuck). What do you think of bundling the compiler and linker into Swift itself, so that it knows natively how to compile Linux binaries from macOS, macOS binaries from Linux, Windows binaries from macOS, and so on?

12 Likes