A Small Update on Swift For Raspberry Pi Zero/1/2/3

Posted by Umberto Raimondi on September 6, 2017

Since some time has passed since the last update, here is a recap of the current status of Swift on ARM/Linux. You’ll find the previous episodes of the Swift On ARM saga here, check them out if you need additional pointers on how to run or compile Swift.

With the release of Raspbian Stretch a few weeks ago, Swift now builds correctly with support for SPM. You can grab the full build here for ARMv7 Raspberry Pi 2 and 3 or here for ARMv6 Pis like the original Raspberry or the new Zero/W.

Or you can always build it on your own with the buildSwiftOnARM scripts.

You’ll notice that compiling 3.1.1 on Raspbian Stretch will require an additional libdispatch patch that will need to be applied manually.

It’s available under swift-corelibs-libdispatch.diff/raspbian/, and to apply it just run patch -p1 < ../swift-corelibs-libdispatch.diffs/raspbian/c01599944879e58556a6e34585ac6539f5e83000_no_membarrier.diff from the libdispatch directory.

As usual, 3.1.1 have been tested on Raspbian with SwiftyGPIO and everything, finally including SPM, appears to work.

Swift 3.2 and 4.0 Status

While building 3.2 for Linux/ARM shouldn’t be a problem once it’s finalized with the release of Xcode 9.0, there are still some issues with Swift 4.0 that need to be adressed.

Even if the compiler seem to build correctly on Ubuntu Mate or Raspbian/Stretch without SPM, you’ll likely won’t be able to produce working binaries most of the times, since as shown by some failing tests, there are a few major issues related to error handling and weak references among others.

You can follow the developments on the 4.0 front subscribing to SR-5845 and SR-5846, or as usual, waiting for further updates from this blog or on twitter.

Did you like this article? Let me know on Twitter or subscribe for updates!

This is the blog of Umberto Raimondi, you can reach me at me@this domain.

I'm also on Twitter and GitHub.

Subscribe via RSS or email.