Do I need to compile it for Raspberry Pi 5
myself?
If you run Ubuntu on your RPi 5, you can install just install Swift. Easiest solution is using the Swift packages on: https://swiftlang.xyz (what I use) or using Swifty (GitHub - swiftlang/swiftly: A Swift toolchain installer and manager, written in Swift.)
Or do you have specific needs, not solved with the regular Swift distribution?
Hi,
I plan to run Raspberry Pi OS
on Pi 5. I will try your advice.
Thanks
Good luck!
I don't have any experience with Raspberry PI OS, so I'm curious to learn from your experiences.
Thanks, I got it.
Raspberry Pi OS is based on Debian, so the arm64 Debian build should work. Swiftly doesn't seem to support Debian yet, so usually, I use swiftenv, which makes it as simple as running
swiftenv install https://download.swift.org/swift-5.10.1-release/debian12-aarch64/swift-5.10.1-RELEASE/swift-5.10.1-RELEASE-debian12-aarch64.tar.gz
Please note that this requires a recent Raspberry Pi OS that is based on Debian 12 (bookworm). If you have an older version that's based on Debian 11 (bullseye), there is no official build. One that has worked for me was futurejones' arm64 build using
swiftenv install https://github.com/futurejones/swift-arm64/releases/download/v5.10.0-RELEASE/swiftlang-5.10-debian-11-release-arm64-01.tar.gz
Running swift —version results in some swift runtime: unable to protect environment for swift-backtrace at… for me.
Are you getting this as well?
Are you running Raspberry Pi OS or Ubuntu?
Pi OS (aka debian) - the Messages do not only appear using the Swift tooling, but Running the resulting executable also
Affraid I can't help you then, as I only run Ubuntu Server on RPis.
This is because Raspberry Pi OS has its page size configured to 16KB rather than 4KB, but the Swift build system doesn't know that, so the data structures used by the backtracer aren't page aligned and cannot be protected against overwrite — and that makes the backtracer disable itself (otherwise it would be unsafe to use), hence the warning.
From my personal experience, installing swift-toolchain 5.10.1 on my Pi 5 8GB of raspbian (aka Raspberry Pi OS)
, using Debian installation methods is soild.
Loaded the toolchain with VS code + swift extension, works like a charm with a simple "Hello World" program, syntax highlighting, and std library imports.
Haven't tried on nightly builds yet.