4

I am hoping to use my new Pi 2 Model B+ as a development platform, using HAXE as my JavaScript generator.

I have downloaded Haxe 3.1.3 Raspberry Pi binaries from haxe home site.

pi@mark ~ $ haxe
Haxe Compiler 3.1.3 - (C)2005-2014 Haxe Foundation)

MY ERROR On trying to use haxelib to install libraries

pi@mark ~ $ haxelib
haxelib: error while loading shared libraries: libneko.so: cannot open shared object file: No such file or directory

(usr/lib/neko does not contain any .so files) (libneko.so not found anywhere)

pi@mark ~ $ neko
NekoVM 1.8.1 (c)2005-2009 Motion-Twin
  Usage : neko <file>

Neko is the version from the Pi repository installed with apt-get. I see the Neko site shows they are at version 2, but no Raspberry binary in the downloads.

Can anyone help me to get Haxe 3.1.3 working?

Aurora0001
  • 6,198
  • 3
  • 21
  • 37
mark
  • 49
  • 3

2 Answers2

2

I realize this post is fairly old. But today I installed the July 2019 Raspbian (on my old Raspberry PI 1 Model B), and per Andy Li's comment, installed haxe & neko with the simple:

sudo apt-get install haxe

That was it, and both the Haxe compiler and NekoVM just worked!

pi@raspberrypi:~
$ haxe -version
3.4.7
$ neko -version
2.2.0
$ echo "class Main { static function main() trace(2); }" > Main.hx
$ haxe -main Main -neko hello.n
$ neko hello.n
Main.hx:1: 2

Additional performance note wrt nodejs:

I will also add that the neko hello.n command above completed in 77 milliseconds. I was testing Haxe because I was shocked to see that the same "hello world" code took 2.5 seconds in Ruby, and a shocking 25 seconds in nodejs (my twitter thread.) If you plan to use nodejs on the RPI, run some tests first:

$ echo "console.log(2)" > hello.js
$ time nodejs hello.js
2
real 0m26.471s   <--- yes, that's 26 seconds!!
$ nodejs -v
v10.15.2

It seems it is a known issue, though my experience is even worse than that one.

Jeff Ward
  • 121
  • 4
1

I'm presuming you are using Raspbian Wheezy.

There's a /usr/lib/libneko.so.0 in libneko0. If you don't have that installed, do, and try haxe again.

If that doesn't work, I'm guessing that a libneko.so symlink may be needed. Make sure it doesn't exist:

stat /usr/lib/libneko.so

Then create it:

cd /usr/lib
sudo ln -s libneko.so.0.1 libneko.so
sudo ldconfig

I can't promise that will work but it probably will and is worth a try.


The haxelib binary appears to work on the Pi 2 with Fedora 21:

>./haxlib
Haxe Library Manager 3.1.0-rc.4 - (c)2006-2013 Haxe Foundation
Usage: haxelib [command] [options]
[...]

But I don't think it will work on raspbian unless (perhaps) if you compile neko from source -- which, although it is small, looks to be a real PITA because there is no .configure -- I tried a few of the make targets and they flunked, but you might have better luck or more patience.

Here's what I tried on a wheezy pi WRT the jessie packages:

wget http://archive.raspbian.org/raspbian/pool/main/n/neko/libneko0_2.0.0-3_armhf.deb
dpkg -i libneko0_2.0.0-3_armhf.deb

Turns out we need the jessie libgc, too:

wget http://archive.raspbian.org/raspbian/pool/main/libg/libgc/libgc1c2_7.2d-6.4_armhf.deb
dpkg -i libgc1c2_7.2d-6.4_armhf.deb
dpkg -i libneko0_2.0.0-3_armhf.deb

But :(

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

So I don't think upgrading to Jessie will help. You could try Ubuntu Snappy Core, if you can figure out how to make it work with a normal read-write filesystem...or the Fedora 21 Pi 2 re-mix (much less hassle than my method, and should be all the same software).

Of course, getting libneko to compile would be the best option, if that's the issue and haxelib then works.

goldilocks
  • 56,430
  • 17
  • 109
  • 217
  • thanks goldilocks but new error pi@mark /usr/lib $ sudo ldconfig pi@mark /usr/lib $ haxelib Uncaught exception - std@module_read – mark Mar 12 '15 at 15:47
  • Okay, I've edited in my findings above. Again, it seems possible, it just depends how far you are willing to go. – goldilocks Mar 12 '15 at 16:39
  • thanks for help yesterday, I installed pidora and updates, but failed to get synergy to work so will look more into that. Back to Wheezy, I also ran make on the source for neko which complained about gc, which is installed. For the moment i will live with haxe on my ubuntu laptop and wheezy for workstation. – mark Mar 13 '15 at 13:56