Could not start 'hl' process, executable was not found in PATH.
OS: Fedora 33
Hi there! :wave:
I'm trying to launch Hashlink via vscode launch.json to easily utilize the debugger, but for whatever reason it doesn't seem to be able to find my binary.



launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": {
"type": "haxe",
"args": "active configuration"
}
}
]
}
compiler.hxml
-cp src
-lib heaps
-lib hlsdl
-hl hello.hl
-main Main
Maybe vscode runs with another user that does not have the same path ?
Le lun. 15 févr. 2021 à 12:17, Joseph Manley [email protected] a écrit :
OS: Fedora 33
Hi there! 👋
I'm trying to launch Hashlink via vscode launch.json to easily utilize the debugger, but for whatever reason it doesn't seem to be able to find my binary.
[image: image] https://user-images.githubusercontent.com/21203171/107936359-8dae2880-6f50-11eb-8796-14ec47eaf147.png
[image: image] https://user-images.githubusercontent.com/21203171/107936369-91da4600-6f50-11eb-917b-46800a60823f.png
[image: image] https://user-images.githubusercontent.com/21203171/107936555-cc43e300-6f50-11eb-9242-ec53354d88a1.png
launch.json
{
"version": "0.2.0",
"configurations": [
{ "name": "HashLink", "request": "launch", "type": "hl", "cwd": "${workspaceFolder}", "preLaunchTask": { "type": "haxe", "args": "active configuration" } }]
}
compiler.hxml
-cp src
-lib heaps
-lib hlsdl
-hl hello.hl
-main Main
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vshaxe/hashlink-debugger/issues/95, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQFR5NT6N5AJUF2KNXLS7D7F3ANCNFSM4XUQFT4Q .
Maybe vscode runs with another user that does not have the same path ?
I wouldn't say it's impossible, but I run vscode directly from the terminal code [dir] with the same user as the terminal.


I know dev containers are sometimes ran as the user vscode by default, but I have no vscode user in /etc/passwd
hashlink-debugger launches hl process using nodejs ChildProcess.spawn() (as it should) but, for whatever reason, spawned process does not seem to be getting environment set up correctly, or at least part of it, which may very well be an issue with nodejs in VSCode (didn't investigate that one further).
After installing HashLink from source build, hl ends up in /usr/local/bin folder, which is ok, and I can run it from terminal:
$ hl
HL/JIT 1.12.0 (c)2015-2020 Haxe Foundation
Usage : hl [--debug <port>] [--debug-wait] <file>
and I can also compile my Haxe code to HL bytecode and run that with hl, no issues there.
None of this works when using VSCode launch.json configuration of the hl type.
The workaround goes like this:
- add
"hl"property to your launch config and set it to full path to the hl executable, which should be/usr/local/bin/hl, i.e.:
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": "Build",
"hl": "/usr/local/bin/hl"
}
]
- if your Haxe code uses any of the HashLink libraries (hlsdl, hlopenal, etc) chances are you will get error message like
src/module.c(360) : FATAL ERROR : Failed to load library fmt.hdll, in which case you need to add env variableLD_LIBRARY_PATHto your launch.json, like so:
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": "haxe: compile.hxml",
"hl": "/usr/local/bin/hl",
"env": {
"LD_LIBRARY_PATH": "/usr/local/lib"
}
}
]
- and, finally, if you are coding for Heaps.io or just using hlsdl library, you will have to add two more env variables to the launch.json, like so:
"configurations": [
{
"name": "HashLink",
"request": "launch",
"type": "hl",
"cwd": "${workspaceFolder}",
"preLaunchTask": "haxe: compile.hxml",
"hl": "/usr/local/bin/hl",
"env": {
"LD_LIBRARY_PATH": "/usr/local/lib",
"XDG_RUNTIME_DIR": "/run/user/1000",
"DISPLAY": ":0"
}
}
]
XDG_RUNTIME_DIR and DISPLAYmay be different for you, just get them from "regular" terminal with:
$ echo $XDG_RUNTIME_DIR
/run/user/1000
$ echo $DISPLAY
:0
Once I had all of these set up I was able to run a simple hello world Heaps.io code in VSCode HashLink debugger.
What's your OS and arch?
Linux Mint 20.2 x86_64