Posted by Umberto Raimondi on February 10, 2016 也可以阅读中文版
Update December 2016: Swift 3.0.2 for all the RaspberryPi boards is now available here.
UPDATE: Swift 3.0 (snapshot) is now available, more info here
After a few hundred hours of compilation, various attempts and some broken usb pen drives, i can finally share an initial build of Swift 2.2 for ARMv6 (built on Raspbian):
This will work with every RaspberryPi 1 (A,B,A+,B+) and the RaspberryPi Zero. This package is based on the same sources of the ARMv7 build but lacks Foundation, XCTest, LLDB and the REPL.
This should not be a problem in the vast majority of cases, I’m in the process of compiling a new build from Swift:master (now that William Dillon’s ARM port has been merged, read about other ports here), that likely will be more complete.
Once you have installed clang, that is the only dependency we need, to use the swift compiler, just download and decompress the archive:
sudo apt-get update sudo apt-get install clang wget https://www.dropbox.com/s/he47c47bywm10nv/swift-armv6.tgz tar xzf swift-armv6.tgz
To compile a helloworld.swift:
If you have a RaspberryPi 2 or any other ARMv7 board remember you can find pre-built Swift binaries here.
Did you like this article? Let me know on Twitter!