-
Notifications
You must be signed in to change notification settings - Fork 32
Getting started
Protocol conformance tables are not correctly loaded from the main executable, causing any program containing an enum to immediately segfault. Will be fixed in the next release. (Issue 5 on the issue tracker)
You need Ubuntu 15.10 64-bit to run the prebuilt version. (Other versions of Linux are not supported at this time)
Install Clang and libbsd:
sudo apt-get install clang libbsd0
If you don't have Android SDK's ADB, sudo apt-get install android-tools-adb
Install Android NDK - version r10e Linux 64-bit
run
export ANDROID_NDK_HOME=/path/to/ndk
run
sudo ln -s $ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-ld.bfd /usr/bin/armv7-none-linux-androideabi-ld
Extract the downloaded file:
tar xf swift_android_2015-12-12.tar.xz
Write a simple Hello World program, and save it as hello.swift.
Now, try building the executable:
swiftandroid/bin/swiftc-android hello.swift
Push the executable and all its dependent libraries to the Android device.
There's a script that will do this for you: run
swiftandroid/bin/swift-android-push hello
to push hello and the libraries to /data/local/tmp
You also need to push libc++_shared.so (I forgot to include it in the script :( )
adb push $ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a/libc++_shared.so /data/local/tmp
Run the executable, passing LD_LIBRARY_PATH to where the executable and libraries are saved
adb shell LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/hello
Please report any issues to the issue tracker