Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not start 'hl' process, executable was not found in PATH. #95

Open
yeslayla opened this issue Feb 15, 2021 · 5 comments
Open

Could not start 'hl' process, executable was not found in PATH. #95

yeslayla opened this issue Feb 15, 2021 · 5 comments

Comments

@yeslayla
Copy link

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

image

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
@Gama11 Gama11 transferred this issue from vshaxe/vshaxe Feb 15, 2021
@ncannasse
Copy link
Member

ncannasse commented Feb 15, 2021 via email

@yeslayla
Copy link
Author

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.
image

image

I know dev containers are sometimes ran as the user vscode by default, but I have no vscode user in /etc/passwd

@zagortenej
Copy link

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 variable LD_LIBRARY_PATH to 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.

@rcstuber
Copy link
Contributor

What's your OS and arch?

@zagortenej
Copy link

Linux Mint 20.2 x86_64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants