Help getting hello world to run (GNU/Linux, HashLink)

My Heaps hello-world program compiles, but when I run it it fails with this error:

$ hl out.hl 
src/module.c(321) : FATAL ERROR : Failed to load library fmt.hdll

This is on Debian Testing, with:

$ haxe --version
4.0.0-rc.2+77068e1

$ hl --version
1.10.0

$ haxelib list
format: [3.4.2]
hashlink: [0.1.0]
heaps: [1.6.1]
hlopenal: [1.5.0]
hlsdl: [1.10.0]
thx.core: [0.43.0]
thx.csv: [0.2.0]

(I’ve tried with Haxe 4.0.0-rc.3 as well, with the same result, though more warnings during the compilation step.)

I build with haxe hl.hxml and that hl.hxml file contains:

-p src
-m Main
--library heaps
--library hlsdl
--hl out.hl

I’m not using any IDE — just the command line and the hl.hxml file.

I have that fmt.hdll file:

$ ls -l /usr/local/lib/fmt.hdll 
-rwxr-xr-x 1 root staff 109408 Jul 10 04:47 /usr/local/lib/fmt.hdll
john@tarragon:~$ 

I had this problem. Found that the fmt.hdll file was in /usr/local/lib. So to fix, I just created LD_LIBRARY_PATH environment variable pointing to /usr/local/lib.
Interesting thing is that I have /usr/local/lib configured in ldconfig, but apparently that was not enough in my case. Had to use LD_LIBRARY_PATH