Embedded Swift running on the Raspberry Pi Pico

This is fantastic work, thank you for sharing it on GitHub!

This should be possible with Swift SDKs. The build system used for SDK components has no impact on whether you can build software with those components using SwiftPM or not. You only have to assemble an artifact bundle in a format that SwiftPM can understand.

Yes, I would love this to happen. In fact, I'd encourage everyone interested to contribute to the Swift SDK Generator project so that anyone could generate such bundles in a reproducible way.

Correct, we're well aware of it and I'm working on fixing it right now.

Unfortunately, there's a non-trivial amount of preparatory effort required to make it work. SwiftPM previously used a single BuildParameters value for the whole build graph, which not only meant that the build system was using the same triple for building everything, but also implied sharing all of the build parameters. If you were using debug build configuration, all macros, plugins, and their dependencies (including Swift Syntax) were built in debug build configuration too. If you used DWARF debug information instead of CodeView when cross-compiling on Windows, your macros and plugins were built with DWARF as well. (Note that these caveats only apply to swift build and SourceKit-LSP, the way Xcode does this is completely different).

Fortunately, the foundational work to use separate build parameters for each build plan target has been merged recently, we just haven't completely wired it up yet. This also unblocks a lot of future fixes and improvements, potentially even allowing us to bring SwiftPM plugins into the build graph, as opposed to building and calling into plugins manually, which currently complicates or limits a lot of things in undesirable ways. But that's a long-term project if it's possible at all, fixing cross-compilation with macros is the immediate goal in the meantime.

7 Likes