Raspberry Pi 2 anyone?

I just got a Raspberry Pi 2 and would love to test it with OpenFL / Lime. I’ve seen other people having success running some of the samples with the first model (i think).

How would i go about compiling it for Raspberry Pi 2 Model B?

Any help is very much appreciated.

1 Like

I would like to see Raspberry Pi 2 support as well :smile:

I believe that it supports the “armhf” architecture, which I have built from a desktop Ubuntu system using the additional GCC toolchain (I forget the package name) and the current lime rebuild linux -rpi command

I forget if it required modifications to HXCPP or not.

My big problem was no Haxe or Neko for armhf so I did not test on a real device. I think it would be neat to have something similar to “Python Games” and a ready-to-go package to work on the Pi :wink:

So, if i want to test this i should try to compile from Linux?

Or did i understand it wrong and currently there is no way to compile due to lack of support for armhf processors?

I believe I’ve built already using a desktop Ubuntu install, I think I also compiled using Ubuntu on the Raspberry Pi. If you can build Lime for armhf using -rpi, then it’s a matter of getting armhf builds of Neko and Haxe from somewhere, primarily

I started on this a while ago, but so far no luck on raspian wheezy.

I did manage to compile neko ( you will have to compile the targets from the makefile manually in a specific order) and dowloaded the haxe binary. I then got as far as installing haxelib. But I get some path errors ( weird double // in path) when trying to installing lime.

Maybe we can make it a joint effort. I’ll document what I’ve done and where I get stuck. If anyone else is willing to have a go…

Cheers

I can try the whole process here the next weekend - i’ll follow both of your recommendations and then post my results here. If we can find what is missing maybe we can make this work.

Thanks for the responses guys,

Cheers!

Here’s what I did to get haxelib working:
[ you’ll need basic ‘make’ tools, and some more dependencies like ‘libgc-dev’ ]

wget http://nekovm.org/media/neko-2.0.0.tar.gz
tar zxf neko-2.0.0.tar.gz
cd neko-2.0.0

I’m doing individual make steps because ‘make all’ won’t work for me

make std
make neko
make libneko
make compiler
make libs ( interactive, you will be asked to skip if a package is not avaiblable)
make tools
make test
sudo make install

wget http://haxe.org/download/file/3.1.3/haxe-3.1.3-raspi.tar.gz
tar zxf haxe-3.1.3-raspi.tar.gz
cd haxe-3.1.3
./haxelib

This all seems to work well and

haxelib install openfl

works ,but

haxelib run openfl setup

throws:

Uncaught exception - load.c(237) : Failed to load library : /usr/lib/haxe/lib/lime/2,5,2//ndll/Linux/lime.ndll (/usr/lib/haxe/lib/lime/2,5,2//ndll/Linux/lime.ndll: cannot open shared object file: No such file or directory)

note the double forwardslash before ndll.

Maybe this info helps you …

The openfl tool is trying to load the linux ndll, which even if it dit find it, wouldn’t work.

You’ll have to add -nocffi to the openfl command for now.

There’s a need to improve os detection to realise this is not a x86.

If you use a development version of lime do haxelib run lime rebuild linux -rpi works?

I did
git clone --recursive https://github.com/openfl/lime
and
haxelib run lime rebuild linux -rpi
but it fails:

arm-linux-gnueabihf-g++ -o …/ndll/RPi/lime.ndll -shared -fpic -fPIC -Xlinker --no-undefined @obj/linux-rpi-hfp//all_objs /usr/lib/haxe/lib/hxcpp/3,2,102/lib/RPi/liblinuxcompat.a -lpthread -lrt -ldl
arm-linux-gnueabihf-g++: error: /usr/lib/haxe/lib/hxcpp/3,2,102/lib/RPi/liblinuxcompat.a: No such file or directory
Error: error running arm-linux-gnueabihf-g++ -o …/ndll/RPi/lime.ndll -shared -fpic -fPIC -Xlinker --no-undefined @obj/linux-rpi-hfp//all_objs /usr/lib/haxe/lib/hxcpp/3,2,102/lib/RPi/liblinuxcompat.a -lpthread -lrt -ldl

there is no RPI dir in /usr/lib/haxe/lib/hxcpp/3,2,102/lib/
Do i need to install hxcpp with some other options?

[ Sorry if I’m asking noob questions, I’m new to all this ]

So hxcpp doesn’t ship with these.

In that case get a dev version of it and hopefully the architecture auto-detection will work.

git clone https://github.com/HaxeFoundation/hxcpp.git
haxelib dev hxcpp hxcpp
cd hxcpp/project
neko build.n

:frowning: got the dev version from git, but neko build.n goes into an endless loop:

Usage : neko build.n [clean] [link-]target[-arch][-arch] …] [-debug] [-verbose] [-D…]
target : ios, android, windows, linux, mac, mingw
default (=current system)
link : ndll- or static-
(none specified = both link types, mingw static only
arch : -armv5 -armv6 -armv7 -arm64 -x86 -x86_64 -m32 -m64
(none specified = all valid architectures
-D… : defines passed to hxcpp build system
eg: neko build.n clean ndll-mac-m32-m64 = rebuild both mac ndlls
Specify target or ‘default’ to remove this message

Using default = linux
neko run.n Build.xml -Dlinux -DHXCPP_M64 /home/pi/software/hxcpp/project/
This version of hxcpp (/home/pi/software/hxcpp/) appears to be a source/developement version.
Before this can be used, you need to:

  1. Rebuild the main command-line tool, this can be done with:
    cd tools/hxcpp
    haxe compile.hxml
  2. Build the binaries appropriate to your system(s), this can be done with:
    cd project
    neko build.n

Would you like to do this now [y/n]y
Compiling hxcpp tool…
Standard library not found
Building binaries…

after this it repeats itself

If you do cd tools/hxcpp && haxe compile.hxml manually you get Standard library not found?

Maybe it’s having trouble find haxe, there’s the HAXEPATH environment variable you could use to specify where is your haxe folder, worth a try.

1 Like

Hehe I was just typing this , it looks like I didn’t install Haxe properly on this SD-card (got too many) …
I have been trying to find a proper installation guide for haxe on rpi2 but no luck so far.
I just got the binaries and copied them over to /usr/local/bin/ .
Is there a default path for the std directory that Haxe looks for, or should I add a variable to my .profile ?
i.e.: export HAXE_STD_PATH=/SOME/PATH

By default it’ll look into /usr/lib/haxe/std/, /usr/share/haxe/std/ and /usr/local/lib/haxe/std/.
But HAXE_STD_PATH does exists.

Ok, it finds the standard library now.

neko build.n

tries to run neko run.n Build.xml -Dlinux -DHXCPP_M64
so it’s not finding the architecture ( looks like it thinks it’s 64bit)

neko build.n ndll-linux-armv7

does nothing: no errors, no output, it just returns to the prompt

neko build.n ndll-linux-m32

does start compiling (without errors), but I don’t know if this will build anything useful

Try:

lime rebuild hxcpp linux -rpi

and:

lime rebuild hxcpp linux -rpi -static

Ok Joshua, they both compile.

I can now even do: haxelib run lime rebuild linux -rpi without errors
but I still don’t know how to tie it all together.

I now have hxcpp and lime in a subdirectory in my home dir and I can see the lime ndlls and the libcompat.a from hxcpp.
When I just run lime I get:

Uncaught exception - load.c(237) : Failed to load library : lime.ndll (lime.ndll: cannot open shared object file: No such file or directory)

Do I need to copy some files or run an extra command?

By the way thanks for helping guys!

What is the folder where the ndll is located?

Looking at some code it seems the tools want you to specify -rpi for every commands.

So I guess retry with lime -rpi.

Hi Valentin,

At the moment it’s in /home/pi/software/lime/ndll/RPi/

and you’r right lime -rpi does run!

I was now able to do haxelib run openfl setup -rpi

Feels like we’re getting close

You can also try lime -nocffi if you want, so the tools don’t look for the RPi binary, only projects would.