Tom and I went through and installed Haxe 3 and OpenFL on our machines today. OpenFL is the updated Haxe 3 version of NME. These are a few notes, updating from my Haxe 2 comments, some of which are still applicable. All in all, the process seems smoother than it was for Haxe 2/NME on Arch… I’m excited!
First install Neko out of the AUR:
sudo packer -S neko
Then Haxe 3:
sudo packer -S haxe
Note that you can do those two steps at once. If you receive an error about an incorrect Neko package version, it’s because the Haxe package doesn’t denote the version dependency. Running them separately as above will force Neko to be updated first, and then Haxe.
At this point you should setup haxelib:
Tom sets the haxelib location to be in his home directory, which is most proper. I leave it in the default
/usr/lib/haxe, for no good reason. In that case you need to modify the install directory to be owned by your user:
sudo chown -R joe .
Next, install OpenFL following their instructions:
haxelib install openfl && haxelib run openfl setup
When it asks for sudo permission, it’s installing a simple script aliasing
haxelib run openfl to just
openfl, so you can skip it if you wish.
Now set HAXE_STD_PATH:
After that you should be able to create and run a demo:
openfl create DisplayingABitmap
openfl test linux
openfl test flash
Next, try to set up OpenFL’s Android support:
openfl setup android
That script will pull down the Android NDK, SDK, Apache Ant, and Java, but if you already have all that installed simply say no to each download request and enter the path manually. You can then try to build a sample:
openfl create DisplayingABitmap
openfl test android
If you’re using a recent 64 bit android NDK, that will fail with a root cause of not finding g++:
sh: arm-linux-androideabi-g++: command not found
To begin with, in your haxelib directory, edit
build-tool/BuildTool.hx. Specifically, the Linux parameter by line 1355 in the Android block should be altered from just the value
linux-x86 to the following:
m64 ? "linux-x86_64" : "linux-x86"
The block will then look like:
else if (defines.exists("android"))
if ( (new EReg("mac","i")).match(os) )
else if ( (new EReg("window","i")).match(os) )
else if ( (new EReg("linux","i")).match(os) )
m64 ? "linux-x86_64" : "linux-x86");
throw "Unknown android host:" + os;
ANDROID_HOST setting is what matters; as shipped, it does not point to the 64 bit toolchain correctly.
build-tool/android-toolchain.xml, edit the toolchain version to 4.6. Edit line 7 setting
TOOLCHAIN_VERSION as follows:
<set name="TOOLCHAIN_VERSION" value="4.6" unless="TOOLCHAIN_VERSION" />
build-tool/ then run:
OpenFL, specifically openfl-tools, defaults to Android API 8. If you have that installed, you should then be able to build the OpenFL samples for Android. You will though need to stipulate 64 bit hxcpp:
openfl test -DHXCPP_M64 android
To change the target Android API, in your haxelib directory edit
and change the target property on line 7, e.g., from:
<property name="target" value="android-::ANDROID_TARGET_SDK_VERSION::"/>
<property name="target" value="android-16"/>
OpenFL should then build, push, and run the target on your phone using this API version, stipulating the 64 bit toolchain as above. Hooray!
Success on my S3!