2

I am a longtime iOS OS X developer who's switched most of his work to Swift.

Now that Swift is open source, it has been offered for non-Apple ARM devices like the Pi.

Based on my reading, it looks like you need to install Ubuntu on your Pi in order to get the Swift compiler up and running, so that's what I've done.

I then downloaded the latest Swift package for Pi and installed it, following the instructions on this page: http://dev.iachieved.it/iachievedit/swift-3-0-on-raspberry-pi-2-and-3/

However, when I try to create an run a simple hello world Swift app with the command "swift hello.swift" I get an error I don't understand:

/home/build/workspace/Swift-3.0-Pi3-ARM-Incremental/swift/lib/Serialization/ModuleFile.cpp:1031: swift::serialization::Status swift::ModuleFile::associateWithFileContext(swift::FileUnilt *, swift::SourceLoc): Assertion `getStatus() == Status::Valid && "Invalid module file"' failed.

And:

Stack Dump:
0.    Program Arguments: /home/ubuntu/swift-3.0/usr/bin/swift -frontend -interpret hello.swift -target arm7--linux-gnueabihf -disable-objc-interop -color-diagnostics -module-name hello
1.    While reading from /home/ubuntu/swift-3.0/usr/lib/swift/linux/arm7/Swift.swiftmodule

Can anybody tell me what's going wrong? I'm not super-strong with the UNIX command line I'm afraid. Conversant, but not fluent.

1 Answer 1

1

Swift does work out of the box on Ubuntu but only on Intel devices, so not on ARM. However, Uraimo has made some scripts to easily build the swift compiler on a raspberry with Raspbian. https://github.com/uraimo/buildSwiftOnARM#building-swift-on-arm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.