"spawn gn ENOENT" with VS Code ChromiumIDE extension on Windows.

201 views
Skip to first unread message

Erik Jensen

unread,
Nov 18, 2024, 6:12:13 PM11/18/24
to Chromium-dev
I'm attempting to use Visual Studio Code with the ChromiumIDE extension on Windows for Chromium development. I have everything set up and building works fine. However, in the “Chromium: Output Directions” section of the “Explorer Tab”, I see “Failed to load gn.args” next to my output directory. If I then click “View args.gn error”, I see “Error: "gn args 'c:\src\chromium\src\out\debug' --list --short --json" failed: spawn gn ENOENT”. If I run that command manually in the VS Code terminal, however, it works appears to work fine, spitting out a bunch of JSON, as expected.

This issue seems to be inhibiting the automatic generation of compile_commands.json by the extension. Instead, I have to manually run “python3 tools\clang\scripts\generate_compdb.py -p out/current_link | out-file -encoding utf8 compile_commands.json” update the compilation database every time I make a relevant change or update my source tree. This isn't the end of the world, obviously, but it is annoying. Is this a known / expected issue, or is there something wonky with my setup that is preventing the ChromiumIDE extension from operating correctly?

Greg Thompson

unread,
Nov 19, 2024, 4:22:41 AM11/19/24
to Erik Jensen, Chromium-dev
Could it be that `gn` isn't within PATH as seen by VS?

On Tue, 19 Nov 2024, 00.13 Erik Jensen, <rkj...@chromium.org> wrote:
I'm attempting to use Visual Studio Code with the ChromiumIDE extension on Windows for Chromium development. I have everything set up and building works fine. However, in the “Chromium: Output Directions” section of the “Explorer Tab”, I see “Failed to load gn.args” next to my output directory. If I then click “View args.gn error”, I see “Error: "gn args 'c:\src\chromium\src\out\debug' --list --short --json" failed: spawn gn ENOENT”. If I run that command manually in the VS Code terminal, however, it works appears to work fine, spitting out a bunch of JSON, as expected.

This issue seems to be inhibiting the automatic generation of compile_commands.json by the extension. Instead, I have to manually run “python3 tools\clang\scripts\generate_compdb.py -p out/current_link | out-file -encoding utf8 compile_commands.json” update the compilation database every time I make a relevant change or update my source tree. This isn't the end of the world, obviously, but it is annoying. Is this a known / expected issue, or is there something wonky with my setup that is preventing the ChromiumIDE extension from operating correctly?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/ffb46028-c4c7-499e-95a1-a35ecd99ede9n%40chromium.org.

Erik Jensen

unread,
Nov 19, 2024, 3:29:40 PM11/19/24
to Greg Thompson, Chromium-dev, cmf...@chromium.org
Well, I've added depot_tools to my path, and can run `gn` both in the from which I am launching `code` and from the terminal within VS Code, so I'm not sure how that would be. However, I noticed that on Windows, the `gn` wrapper provided by depot tools is a batch file (gn.bat). Unfortunately, batch files are not directly executable on Windows, only via shell, and it looks like the ChromeIDE extension does not specify `shell: true` when invoking child_process.spawn(). As such, it makes sense that it wouldn't work. The code also includes the comment, “TODO(cmfcmf): Test whether this also works on Windows.” so I guess this was never tested?

In any event, it seems the solution would be to either replace `gn.bat` in depot_tools with a `gn.exe` that does the same thing, or set `shell` to true in ChromiumIDE (at least on Windows) when invoking commands that are provided as .bat files.

In the meantime, I guess I'll keep manually regenerating the compilation database.

Erik Jensen

unread,
Nov 19, 2024, 6:10:35 PM11/19/24
to Greg Thompson, Chromium-dev, cmf...@chromium.org
Upon further investigation, I think the “Failed to load gn.args” error may be tangential to the failure to automatically generate compile_commands.json. It appears the latter may instead be due to the extension attempting to invoke `tools\clang\scripts\generate_compdb.py` rather than invoking `python3 tools\clang\scripts\generate_compdb.py`.

I guess ChromiumIDE is just completely untested / unsupported on Windows at the moment.

Jesse McKenna

unread,
Nov 21, 2024, 7:04:02 PM11/21/24
to rkj...@chromium.org, Greg Thompson, Chromium-dev, cmf...@chromium.org
Re: ChromiumIDE being unsupported on Windows, I was told earlier this year on a similar bug that the project is in maintenance mode and is only tested on Linux. I think I ran into the same issue as you also, and there were too many bugs on Windows so I sadly stopped using it.

Jesse McKenna | she/her


Reply all
Reply to author
Forward
0 new messages