Posts Tagged bbb

Swift available for Beaglebone/RasPi

I was able to succeed in building Swift and Foundation for Ubuntu on ARMv7. This includes the Beagle Bone/Board, the Raspberry Pi, Tegra TK1, Cubox, and so much more…

This is more-or-less alpha-level at this point, but you should be able to compile and run basic swift programs that use the standard library, Glibc, or Foundation. Keep in mind that, even for x86_64, Foundation is far from complete.

To install, you can either un-tar in your root directory (which will install into /usr) or, create a new directory in /opt (for example /opt/apple, or /opt/swift) and update your paths. If you choose to install into /usr you’re running a much greater risk to your system, and you had better be willing to re-install if from scratch!! 🙂

Once it’s installed, give swiftc a try:

wdillon@arm:~$ cat hello.swift
print("Hello world!")
wdillon@arm:~$ swiftc hello.swift
wdillon@arm:~$ ./hello
Hello world!
wdillon@arm:~$ uname -a
Linux arm 4.1.12-ti-r29 #1 SMP PREEMPT Tue Nov 10 00:38:08 UTC 2015 armv7l armv7l armv7l GNU/Linux

You can download the file here.

If you want to contribute to the effort, there are still a few tests that fail in stdlib that could be addressed, the swift package manager still doesn’t work, lldb doesn’t work, Foundation isn’t finished, and it would probably be pretty great to have swift wrappers for GPIO pins and peripherals (such as SPI, I2C, etc.)

, , , , , ,