Failed to run Hashlink debugger in VS Code on MacOS

Hi, I’m having issue when setting up haxe project in vs code, particularly running hashlink debugger has failed on my machine.
The error pop up shows this


:
However, I have installed the latest version from github master branch:

haxelib git hashlink https://github.com/HaxeFoundation/hashlink.git master other/haxelib/
Installing hashlink from https://github.com/HaxeFoundation/hashlink.git branch: master
Development directory set to /usr/local/lib/haxe/lib/hashlink/git/other/haxelib/

I am not sure why it’s still pointing to 1.11 version when running from VS code, anyone knows how to fix this issue?

Hello,

you need to build HL binary, follow OSX installation instructions from the hashlink.git

And on OSX:

brew bundle to install the dependencies listed in Brewfile.

Once dependencies are installed you can simply call:

make

To be able to use hashlink binary with the debugger you can then call:

sudo make codesign_osx

To install hashlink binaries on your system you can then call:

make install

2 Likes

Hello, thank you for the response,
I managed to run brew bundle and installed Brewfile dependencies, however, when running make:
I got lots of errors related to XCode dev tools:

cc -Wall -O3 -I src -msse2 -mfpmath=sse -std=c11 -D LIBHL_EXPORTS -m64 -I include -I /usr/local/include -I /usr/local/opt/libjpeg-turbo/include -I /usr/local/opt/jpeg-turbo/include -I /usr/local/opt/sdl2/include/SDL2 -I /usr/local/opt/libvorbis/include -I /usr/local/opt/openal-soft/include -Dopenal_soft  -DGL_SILENCE_DEPRECATION -o src/std/date.o -c src/std/date.c
src/std/date.c:49:14: error: implicit declaration of function 'time' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
        return (int)time(NULL);
                    ^
src/std/date.c:54:12: error: variable has incomplete type 'struct tm'
        struct tm t;
                  ^
src/std/date.c:54:9: note: forward declaration of 'struct tm'
        struct tm t;
               ^
src/std/date.c:55:2: error: unknown type name 'time_t'; did you mean 'size_t'?
        time_t d = (time_t)(unsigned)date;
        ^~~~~~
        size_t
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/13.1.6/include/stddef.h:46:23: note: 'size_t' declared here
typedef __SIZE_TYPE__ size_t;
                      ^

Sorry if this is getting out of scope, I’ve been trying to find solutions from the internet, but there are lots of different contexts related to this problem. Would appreciate if anyone could at least point me to the right direction.

Hello,

it seems time header is not included, e.g .

#include <time.h>
1 Like

haxelib git hashlink https://github.com/HaxeFoundation/hashlink.git master other/haxelib/

This command only installs some tools related to compiling haxe code to hashlink, not the actual hashlink vm. The instructions to build from source given by Ilir-Liburn should work.

You can also install it via homebrew, but you’d have to use the development version (because it doesn’t have the 1.12 release yet):
brew install hashlink --HEAD

For the time error, you can open an issue here: Issues · HaxeFoundation/hashlink · GitHub

1 Like

Apparently, FFmpeg library put its time.h inside my /usr/local/include, so #include <time.h> is referring to the wrong header :frowning:
I managed to fix it by copying the correct time.h from /Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk/usr/include/time.h
So, I think this is an issue on my machine, not hashlink’s code.
Now I can run the debugger from VS code just fine, after following those installation instructions.
Thanks for the help!