On my Debian system I downloaded and unpacked haxe-4.0.0-preview.4-linux64.tar.gz , then copied the
haxelib binaries to my ~/bin.
$ haxe --version
To complete the Haxe install, to where do I copy the “std” standard library directory so
haxe can see it? Where’s the customary location?
That is, after running:
$ cd path/to/my-proj
$ haxe -hl output.hl -main Main
it tells me
Standard library not found
The official debian package puts it in
/usr/share/haxe/std/ so it should work with this.
Otherwise you can put it anywhere and use the
HAXE_STD_PATH env var to point to it.
Whoops. Actually, although HL/JIT works for me, HL/C does not. I get files under src, but it errors out with:
$ cd my-proj
$ mkdir src
$ haxe -hl src/main.c -main Main
Error: Library hashlink is not installed
Error: Build failed
Is there something else I need to install?
After installing HashLink, I have in /usr/local/lib:
$ ls -1 /usr/local/lib
You might need the hashlink library:
haxelib install hashlink.
I don’t think i understand. I installed HashLink by downloading the latest 1.7 release and following the typical build instructions.
Hm… the github link at hashlink (0.1.0) just points to GitHub - HaxeFoundation/hashlink: A virtual machine for Haxe .
What is the difference between installing HashLink like I did, vs
haxelib install hashlink?
GitHub - HaxeFoundation/hashlink: A virtual machine for Haxe contains the virtual machine to run hashlink bytecode, and the required code to have the native compilation of hashlink/c.
hashlink (0.1.0) contains the build tools to make it all work, similar to the hxcpp/hxcs/hxjava haxelib libraries required to compile with the cpp/cs/java haxe targets.
So you need both.
Ah. Thanks. It works now, giving me:
$ haxe -hl out/main.c -main Main
Code generated in out/main.c automatic native compilation not yet implemented
Though, seems like an unfortunate overloading of the name hashlink. Seems like that ought to be named “hxhashlink”, to better go with hxcpp, hxcs, and hxjava, no?
Just wanted to add my experience here:
It looks like, for me, that the
hashlink haxelib library isn’t actually required to generate the C code. You just have to add the
no-compilation define (
-D no-compilation ) and it works without complaining. It still doesn’t do the native compilation for you, so you will have to write the makefiles or whatever you need, but it will generate the C code. Also the hashlink haxelib library hasn’t been published in two years so I think that it isn’t used anymore.
I found this out while testing and getting reference from the way that Armory3D uses HashLink.
Edit: Oops. Nevermind, now I get it. Like @ibilon said, the haxelib contains the build tools. They just aren’t implemented yet and the haxelib hasn’t been updated in a while.