You set the variable “no_check_targets“ here and it was unused before it went out of scope.

I haven’t compiled a new version of CEF for a long time. Recently, chrome mentioned that there is a 23% performance improvement in version 91 https://blog.chromium.org/2021/05/chrome-is-faster-in-m91.html Is there such a big improvement?So I want to have a try. As a matter of course, I used my own script to compile. As a result, I encountered a “wonderful” problem. Here is a brief record.

When compiling CEF 4472 (chromium 91) with auto git.py, an error is suddenly reported after the script finishes executing CEF patch apply

Generating CEF project files...
Creating D:\google\cef_new\chromium\src\out\Debug_GN_x86 directory.
ERROR at //.gn:65:20: Assignment had no effect.
no_check_targets = [
                   ^
You set the variable "no_check_targets" here and it was unused before it went
out of scope.
Traceback (most recent call last):
  File "D:\google\cef_new\chromium\src\cef\tools\gclient_hook.py", line 146, in <module>
    RunAction(src_dir, cmd)
  File "D:\google\cef_new\chromium\src\cef\tools\gclient_util.py", line 35, in RunAction
    gclient_utils.CheckCallAndFilter(
  File "D:\google\cef_new\depot_tools\gclient_utils.py", line 673, in CheckCallAndFilter
    raise subprocess2.CalledProcessError(
subprocess2.CalledProcessError: Command 'gn gen out\\Debug_GN_x86 --ide=vs2019 --sln=cef --filters=//cef/*' returned non-zero exit status 1 in D:\google\cef_new\chromium\src
Traceback (most recent call last):
  File "D:\google\cef_new\automate-git.py", line 1462, in <module>
    run('%s %s' % (python_exe, tool), cef_src_dir, depot_tools_dir)
  File "D:\google\cef_new\automate-git.py", line 69, in run
    return subprocess.check_call(
  File "C:\Python39\lib\subprocess.py", line 373, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['D:\\google\\cef_new\\depot_tools\\python3.bat', 'D:\\google\\cef_new\\chromium\\src\\cef\\tools\\gclient_hook.py']' returned non-zero exit status 1.

No is defined in chromium. Src. GN_ check_ Targets, but not used. At first, I thought it was my own depot_ Tools version is wrong (I have many depots on my machine_ Tools), and then switch the various branches, commit or not. So, it’s better to add some logs in the python script to see what’s going on.

Through the above error prompt, an error is reported when executing GN Gen , and then through reading CEF/tools/gclient_ hook.py、gclient_ Util.py, to Depot_ In this file, the main function looks for the GN executable file in these two locations:

gclient_ paths.GetPrimarySolutionPath()gclient_ paths.GetBuildtoolsPlatformBinaryPath()

I made up these two paths in gn.py. The first result is:

D:\google\cef_new\chromium\src\third_party\gn\gn.exe

Take a look, third_ There is no GN or gn.exe under Party, so we will use the second method to get the path. The second result is:

D:\Electron\electron\src\buildtools\win\gn.exe

Hey, hey, hey?How did you get under electron?So that's the problem.

The next troubleshooting is relatively simple. Check the implementation of getbuildtools platform binarypath (located in depot)_ Gclient in tools folder_ Paths. Py), the original path is controlled by an environment variable chromium_ BUILDTOOLS_ Path (see function getbuildtoolspath ), and then check the windows system environment variables. I really don't know when there is such an environment variable. I can't remember. Was it manually added when I compiled the electron source code a few months ago

up to now, we have finally come to the conclusion that we have deleted chromium_ BUILDTOOLS_ Path, recompile. Under normal circumstances, the GN to be used should be located under - chromium - SRC - buildtools - win \ . All right, call it a day~

Read More: