Get the latest tech news

Packaging Swift Apps for Alpine Linux


While trying to build my Age Apple Secure Enclave plugin, a small Swift CLI app, on Alpine Linux, I realized that the Swift toolchain doesn’t run on Alpine Linux. The upcoming Swift 6 will support (cross-)compilation to a static (musl-based) Linux target, but I suspect an Alpine Linux version of Swift itself isn’t going to land soon.

This script implements the APK package specification in pure Go, and creates and signs an.apk without relying on external tools (such as abuild). On Linux, Swift Crypto uses BoringSSL, which is linked statically into the binary (contrary to CryptoKit on macOS, which is a dynamic system library). I’m not sure why the package is so much larger (maybe some link-time optimizations and dead-code elimination that isn’t done), and I don’t think there’s a good reason in theory for it to be this way.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of alpine linux

alpine linux

Photo of swift apps

swift apps

Related news:

News photo

Fancy climbing the peaks of Alpine Linux? 3.20 is out

News photo

USB disk as /dev/sda on a not-rooted smartphone using Termux, QEMU, Alpine Linux

News photo

Alpine Linux 3.20 Released With Initial 64-bit RISC-V Support