Could not find gn executable (gn.exe)

9,235 views
Skip to first unread message

Kevin Steele

unread,
Oct 5, 2017, 4:28:07 PM10/5/17
to Chromium-dev
I want to test out QUIC on Windows; therefore, it seems I need to check out and build chromium.
I was following the instructions on this site: https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md

However, when I got to setting up the build, with this command:
gn gen out/Default
I get an erorr message about a missing gn executable.

Any suggestions for what to do?

C:\Users\Kevin\chromium\src>gn gen --ide=vs --filters=//chrome out\Default
C:\Users\Kevin\chromium\.gclient_entries missing, .gclient file in parent direct
ory C:\Users\Kevin\chromium might not be the file you want to use.
gn.py: Could not find gn executable at: C:\Users\Kevin\chromium\src\buildtools\w
in\gn.exe

Thanks! I saw someone post something similar to this topic last year, but I didn't see a good answer on that post.

Dirk Pranke

unread,
Oct 5, 2017, 4:35:13 PM10/5/17
to kevws...@gmail.com, Chromium-dev
Make sure you ran `gclient runhooks`, that will download the executable.

-- Dirk

--
--
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 view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/c05c88a3-aa83-42e3-9dfc-0f33e32a19bd%40chromium.org.

Kevin Steele

unread,
Oct 5, 2017, 5:11:24 PM10/5/17
to Chromium-dev, kevws...@gmail.com
Thanks for the reply. Alas, gclient runhooks does not work
I am not sure from which folder to run that command, but I have tried it in the src folder, chromium\src\
buildtools\win folder, and the chromium folder

Afterwards, I get the same message as before when I run gn gen out/Default from within the src folder

 Below, I have pasted what appears in the command prompt when I type in gclient runhooks.


C:\Users\Kevin\chromium\src>gclient runhooks

C:\Users\Kevin\chromium\.gclient_entries missing, .gclient file in parent direct
ory C:\Users\Kevin\chromium might not be the file you want to use.

________ running 'C:\Users\Kevin\Downloads\depot_tools\win_tools-2_7_6_bin\pytho
n\bin\python.exe src/build/landmines.py' in 'C:\Users\Kevin\chromium'



Please follow the instructions at https://www.chromium.org/developers/how-tos/bu
ild-instructions-windows


Traceback (most recent call last):
  File "src/build/landmines.py", line 148, in <module>
    sys.exit(main())
  File "src/build/landmines.py", line 135, in main
    gyp_environment.SetEnvironment()
  File "C:\Users\Kevin\chromium\src\build\gyp_environment.py", line 30, in SetEn
vironment
    vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
  File "C:\Users\Kevin\chromium\src\build\vs_toolchain.py", line 44, in SetEnvir
onmentAndGetRuntimeDllDirs
    Update()
  File "C:\Users\Kevin\chromium\src\build\vs_toolchain.py", line 405, in Update
    subprocess.check_call(get_toolchain_args)
  File "C:\Users\Kevin\Downloads\depot_tools\win_tools-2_7_6_bin\python\bin\lib\
subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\\Users\\Kevin\\Downloads\\depot_too
ls\\win_tools-2_7_6_bin\\python\\bin\\python.exe', 'C:\\Users\\Kevin\\chromium\\
src\\third_party\\depot_tools\\win_toolchain\\get_toolchain_if_necessary.py', '-
-output-json', 'C:\\Users\\Kevin\\chromium\\src\\build\\win_toolchain.json', '9b
c7ccbf9f4bd50d4a3bd185e8ca94ff1618de0b']' returned non-zero exit status 1
Error: Command 'C:\\Users\\Kevin\\Downloads\\depot_tools\\win_tools-2_7_6_bin\\p
ython\\bin\\python.exe src/build/landmines.py' returned non-zero exit status 1 i
n C:\Users\Kevin\chromium

Dirk Pranke

unread,
Oct 5, 2017, 5:28:54 PM10/5/17
to kevws...@gmail.com, Chromium-dev
Make sure you're following the other directions on

https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md

specifically, "add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0".

I think that will get you past that failure, and hopefully the rest of things will work.

-- Dirk

Андрей Кадацкий

unread,
Oct 6, 2017, 3:30:16 AM10/6/17
to Chromium-dev, kevws...@gmail.com
There should be hidden file .gclient and the src folder. You should run `gclient runhooks` from that folder. 
I'm not sure, but in my case gn appears after I executed `gclient sync`

Kevin Steele

unread,
Oct 6, 2017, 11:02:12 AM10/6/17
to Chromium-dev, kevws...@gmail.com
Alas, it is still not working. I think I was following the instructions from that website...

I have tried the following:

specifically, "add a DEPOT_TOOLS_WIN_TOOLCHAIN system variable in the same way, and set it to 0".

On my windows computer, I went to control panel, then to system, then to advanced system settings, then environment variables, and then added "New'..." to add that system variable and I set the value to 0.
Still got the same error when I tried to run gn gen out/Default from within my src folder.

I also run gclient runhooks and gclient sync from within the folder that contains .gclient and src.
Then, I went into the src folder to try the gn gen out/Default command and I got the same error message from before about not being able to find the gn.exe.

Sorry - any other suggestions?


Андрей Кадацкий

unread,
Oct 6, 2017, 12:36:18 PM10/6/17
to Chromium-dev, kevws...@gmail.com
Does gn.exe physically exist in path src/buildtools/win ?

bruce...@chromium.org

unread,
Oct 6, 2017, 2:18:44 PM10/6/17
to Chromium-dev, kevws...@gmail.com
Setting DEPOT_TOOLS_WIN_TOOLCHAIN=0 at the end is too little too late. The initial "fetch chromium" step will, unfortunately, have failed partway through if it can't find a compiler and that causes it to not create .gclient_entries. You could try recreating that file but your best bet is to delete the chromium directory and start over.

To put it another way:
  • gn isn't found because gclient runhooks is failing
  • gclient runhooks is failing because "fetch chromium" failed
  • fetch chromium failed because DEPOT_TOOLS_WIN_TOOLCHAIN wasn't set (yes, this should probably be fixed)
Also note that existing command prompts do not see environment changes. You should close the existing command prompt and open a new one. You can type "set depot" to verify that DEPOT_TOOLS_WIN_TOOLCHAIN is set correctly.

Rafael Alejandro Escoto Hernández

unread,
Jul 17, 2018, 3:03:57 PM7/17/18
to Chromium-dev
I think i just ran into this... My DEPOT_TOOLS_WIN_TOOLCHAIN was set, but i didn't restarted my computer, so i am wondering this might be my problem...

Darcy Liu

unread,
Sep 26, 2018, 1:10:13 PM9/26/18
to Chromium-dev, kevws...@gmail.com
Hi,
 I just got the same error, but it's on mac, so is there a corresponding parameter to DEPOT_TOOLS_WIN_TOOLCHAIN

在 2017年10月7日星期六 UTC+8上午2:18:44,bruce...@chromium.org写道:
Reply all
Reply to author
Forward
0 new messages