# Swift for Debian Armv7

**URL:** <https://forums.swift.org/t/swift-for-debian-armv7/57738>\
**Category:** Compiler\
**Tags:** linux, arm, dispatch, stdlib\
**Created:** [May 31, 2022, 11:06pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738 "2022-05-31T23:06:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![ColemanCDA](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/colemancda/32/2454_2.png) [@ColemanCDA](https://forums.swift.org/u/ColemanCDA)\
**Post date:** [May 31, 2022, 11:06pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/1 "2022-05-31T23:06:22Z")

</div>

I have been working previously on Buildroot support for [Swift on Armv5](https://forums.swift.org/t/linux-armv5-support/56278) since Swift 5.4, and I'm excited to share that work has culminated into a set of scripts and distributable binaries to cross compile the Swift runtime (and SwiftPM packages) for Debian 11 Armhf. This binary distribution can be used with existing toolchains from [Swift.org](http://Swift.org) and @futurejones [swiftlang.xyz](https://forums.swift.org/t/new-swift-package-repository-for-ubuntu-debian-linux-distributions/50412).

> **[GitHub - colemancda/swift-armv7: Swift runtime for Linux Armv7](https://github.com/colemancda/swift-armv7)**
>
> Swift runtime for Linux Armv7. Contribute to colemancda/swift-armv7 development by creating an account on GitHub.

I have also provided [Docker images](https://hub.docker.com/repository/docker/colemancda/swift-armv7) to quickly cross compile for Debian 11 Armhf

- [latest](https://hub.docker.com/layers/218600481/colemancda/swift-armv7/latest/images/sha256-4f69dcbba773487c9707d90b42add293ce58aa97c482add77ea5cfc710b58d98?context=repo): this is the bare minimum environment needed to cross compile the Swift runtime for Armv7. Includes Swift 5.6.1 compiler, Cmake 3.22 and LLVM headers. The `build.sh` script can be used to cross compile the runtime. Takes about 5 minutes to compile Swift, Dispatch, Foundation and XCTest.
- [5.6.1-prebuilt](https://hub.docker.com/layers/222220293/colemancda/swift-armv7/5.6.1-prebuilt/images/sha256-12dfb17f0dfd6376f6bd5637ae30c6bdb74370f53fb5e887705cb6d009e7b811?context=repo): This image builds on `latest` as a base, but also includes the Debian 11 sysroot needed to cross compile Swift packages and the Swift runtime already compiled for Armv7. The `generate-swiftpm-toolchain.sh` and `build-swift-package.sh` scripts can be used to cross compile packages.

Example of Docker image usage:

> <https://github.com/PureSwift/Bluetooth/actions/runs/2402034283>

In this example, the `colemancda/swift-armv7:5.6.1-prebuilt` Docker image is used to cross compile the package in a x86 CI environment. The `-prebuilt` suffix means the image contains the Debian 11 Armhf sysroot with the Swift runtime librares. The next GitHub Action takes the compiled `.xctest` executable and runs it in a self hosted Armv7 environment (Orange Pi Zero 2 development board).

v0.3.0 binaries

- [Swift 5.6.1 runtime](https://github.com/colemancda/swift-armv7/releases/download/0.3.0/swift-armv7.tar.gz) with Dispatch, Foundation and XCTest cross compiled for Debian 11 Armhf

- [Debian 11 Armhf sysroot](https://github.com/colemancda/swift-armv7/releases/download/0.3.0/bullseye-armv7.tar.gz)

---

<div class="post-metadata">

**Author:** ![sroebert](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sroebert/32/17860_2.png) [@sroebert](https://forums.swift.org/u/sroebert)\
**Post date:** [June 29, 2022, 1:04pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/2 "2022-06-29T13:04:02Z")

</div>

Great work!

I am not super familiar with similarities between Debian and OpenWRT, but I see you have mentioned OpenWRT before. Have you been to compile any Swift application for OpenWRT and if so, can you give some direction on how I can achieve this, possibly using your prebuilt docker images.

---

<div class="post-metadata">

**Author:** ![sroebert](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/sroebert/32/17860_2.png) [@sroebert](https://forums.swift.org/u/sroebert)\
**Post date:** [July 5, 2022, 7:09am UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/3 "2022-07-05T07:09:33Z")

</div>

Ok, after a lot of trial and error, I seem to have got it working by creating a new buildroot package for the target platform I am building for and updating a lot of library and include paths. Some more info can be found on the fork I created here: [GitHub - sroebert/swift-armv7: Swift runtime for Linux Armv7](https://github.com/sroebert/swift-armv7)

---

<div class="post-metadata">

**Author:** ![ColemanCDA](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/colemancda/32/2454_2.png) [@ColemanCDA](https://forums.swift.org/u/ColemanCDA)\
**Post date:** [July 5, 2022, 5:29pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/4 "2022-07-05T17:29:48Z")

</div>

I also have a Buildroot fork that integrates Swift as proper Buildroot packages.

> **[GitHub - MillerTechnologyPeru/buildroot at 2022.02-swift](https://github.com/MillerTechnologyPeru/buildroot/tree/2022.02-swift)**
>
> 2022.02-swift

---

<div class="post-metadata">

**Author:** ![ColemanCDA](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/colemancda/32/2454_2.png) [@ColemanCDA](https://forums.swift.org/u/ColemanCDA)\
**Post date:** [November 3, 2022, 8:41pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/5 "2022-11-03T20:41:43Z")

</div>

@sroebert I updated the repo for Swift 5.7.1. Also I have Buildroot external for proper Swift support

> **[GitHub - MillerTechnologyPeru/buildroot-swift: Buildroot external to support...](https://github.com/MillerTechnologyPeru/buildroot-swift)**
>
> Buildroot external to support the Swift programming language - GitHub - MillerTechnologyPeru/buildroot-swift: Buildroot external to support the Swift programming language

---

<div class="post-metadata">

**Author:** ![ColemanCDA](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/colemancda/32/2454_2.png) [@ColemanCDA](https://forums.swift.org/u/ColemanCDA)\
**Post date:** [November 5, 2022, 9:12am UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/6 "2022-11-05T09:12:20Z")

</div>

Updated for Swift 5.7.1

Debian 11 Armhf

> **[Release v0.4.3 · colemancda/swift-armv7](https://github.com/colemancda/swift-armv7/releases/tag/0.4.3)**
>
> Updated to Swift 5.7.1

Buildroot

> **[Release v0.1.1 · MillerTechnologyPeru/buildroot-swift](https://github.com/MillerTechnologyPeru/buildroot-swift/releases/tag/0.1.1)**
>
> Updated to Swift 5.7.1

Yocto

> **[Release v0.1.2 · MillerTechnologyPeru/meta-swift](https://github.com/MillerTechnologyPeru/meta-swift/releases/tag/0.1.2)**
>
> Updated to Swift 5.7.1

---

<div class="post-metadata">

**Author:** ![xtremekforever](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/xtremekforever/32/43018_2.png) [@xtremekforever](https://forums.swift.org/u/xtremekforever)\
**Post date:** [December 11, 2024, 5:00pm UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/7 "2024-12-11T17:00:31Z")

</div>

I've taken all this a step further and built Swift for different versions of Debian and Ubuntu:

> **[Releases · xtremekforever/swift-armv7](https://github.com/xtremekforever/swift-armv7/releases)**
>
> Swift runtime for Linux Armv7. Contribute to xtremekforever/swift-armv7 development by creating an account on GitHub.

My hope is that we as a community can keep supporting armv7 for new releases of Swift, until no one is using arm32 anymore.

---

<div class="post-metadata">

**Author:** ![ColemanCDA](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/colemancda/32/2454_2.png) [@ColemanCDA](https://forums.swift.org/u/ColemanCDA)\
**Post date:** [July 30, 2026, 4:12am UTC](https://forums.swift.org/t/swift-for-debian-armv7/57738/8 "2026-07-30T04:12:54Z")

</div>

Musl support added [Add musl libc support by colemancda · Pull Request #21 · MillerTechnologyPeru/buildroot-swift · GitHub](https://github.com/MillerTechnologyPeru/buildroot-swift/pull/21)
