hashlink: HashLink output not working
Hi I’m trying to compile to native using HashLink and I can’t make it work I’m using Ubuntu 17.10, Haxe 4.0.0.preview.3 and HashLink 1.5
I can compile to C but compiling using GCC throws a bunch of errors and fails commands haxe -hl output.c -cp src -lib heaps -lib hlsdl -main Main gcc -o myapp -I. -D INCLUDE_ALL -std=c11 output.c -Lhl
also compiling to .hl works but running that throws another error
haxe -hl output.hl -cp src -lib heaps -lib hlsdl -main Main
hl output.hl src/module.c(296) : FATAL ERROR : Invalid signature for function sdl@gl_options : Piiiii_v required but Piiiiii_v found in hdll
I’m following compilation instructions from here: https://hashlink.haxe.org/
So basically can’t make it work in any way, please help
thanks
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (6 by maintainers)
In summary I used
haxelib dev hlsdl path/to/hashlink/libs/sdlto compile, which I did on Kubuntu 17.10, installed the dependencies, GCC, SDL, OpenAL, OpenGL etc. then to compile I used this commands
To generate the C source haxe -hl output.c -cp src -lib heaps -lib hlsdl -main Main
To compile the native app gcc -o myapp output.c -I. sdl.hdll ui.hdll fmt.hdll openal.hdll ui.hdll uv.hdll -lhl -lSDL2 -lm -lopenal -lGL
order of those options are REALLY important, have all those libs after the *.hdll
and that should work, I only did this on Linux so, windows and Mac would be a bit different
let me know if there are any issues
Good luck.
@ncannasse thanks for the reply. It helped a lot.
nm sdl.hdllstill wont find the lib. After some trials and readingman nmI found it wont use thePATHorLD_LIBRARY_PATHeven if they set correctly. It just need the full path to object file or to be called in the same directory.I’ve created a simple bash script. Could be an inline command but this reads better and can be reused if put in parent of ./out directory. Also turns out there’s no matter where to put
main.c -o main. You just need to set full paths to*.hdllfiles.Now the code is compiling and running well.
I’ve ended with these scripts to compile:
$ cat compile-hl-c.hxmland
$ cat compileI asked on behalf on all users. I will try again but probably not at the moment.