I've updated my Swift for ARM scripts to Swift 5.7
This new version requires the LLVM headers from Swift to be locally compiled, and using the built in Debian / Ubuntu ones is deprecated.
I've added scripts to build LLVM and uploaded a prebuilt Docker image so Swift packages on GitHub can cross compile to ARM without building everything.
This is an example of a GitHub Action for cross compiling the unit tests of a SwiftPM library with the provided docker image that can later be run on Debian 11 armhf on real hardware. You don't have to worry about building Swift, the compiler, or LLVM.
This is the compiled Swift 5.7 runtime you can install into /usr/lib, only 35 MB download
Thank you so much for putting this together. I am not sure if I am missing something or miss understanding what this is, but I downloaded the tar.gz from the link and when I expanded it, there isn't any "swift" or "swiftc" executables.
I do apologize if I am missing understanding, I am really not that familiar with cross compiling or building Swift.
I also wanted to share scripts I've updated for Buildroot and Yocto Linux, for embedded systems. I want to thank @William_Dillon2 for spearheading these efforts years ago and sponsoring the maintenance of various Swift for Armv7 toolchains over the years, as well as @uraimo@futurejones and @Buttaface . I'd also like to invite developers interested in Swift on 32-bit ARM development to join our Slack .
Just released newly cross compiled runtime with compiler and SwiftPM. This means you can build on device with swift build in addition to cross compiling from Linux and macOS. It's recommended you cross compile for release builds and build on-device for debug builds and testing. SourceKit-LSP is also built and working with VS Code on Armv7. This is the first release of Swift compiler for Armv7 since Swift 5.1.5. Previous releases after Swift 5.2 were cross compiled runtime only.
While the Swift runtime on Armv7 itself has no issues, several new Swift compiler optimization passes introduced since 5.2 are in the process of being fixed for 32-bit and some even rewritten in Swift on the latest development builds. Until those fixes and rewrites for swiftc are complete, you can reliably build debug builds, but some projects will cause swiftc to crash on Armv7 when building for release depending on which optimizations passes are run by the compiler. I am working with Apple to get swiftc crash free on Armv7 and i386. Hence why I am cross compiling everything in the first place.
I have docker images readily available both for the Armv7 runtime and development, as well as x86 image to cross compile. See this GitHub action for an example of building natively and cross compiling:
colemancda/swift-armv7:latest-runtime Debian 11 armhf with Swift runtime and compiler
colemancda/swift-armv7:latest-prebuilt Ubuntu Jammy x86_64 with Swift compiler and cross compilation environment