-->

Error when try to compile Chromium

2020-07-05 06:53发布

问题:

I try to use the command ninja -C out/Debug chrome to compile Chromium.

However the error msg says that:

ninja error loading 'build.ninja': the system cannot find the file specified 
ninja Entering dictory 'out/Debug'

Could I know what's the problem?

Thanks.

回答1:

The out directory and its contents (including build.ninja) are created by running

python build\gyp_chromium

or

gclient runhooks

Executing either command from within /src should allow your compile to proceed.



回答2:

On Windows machine!

When I was running gn gen out/Default it also gave me an error:

ERROR at //build/config/win/visual_studio_version.gni:27:7: Script returned non-zero exit code.
      exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
      ^----------
Current dir: D:/Chromium/src/out/Goma/
Command: C:/Python27/python.exe -- D:/Chromium/src/build/vs_toolchain.py get_toolchain_dir
Returned 1 and printed out:




Please follow the instructions at https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md

I did the following steps and it worked for me.

  1. Set this variable. Reference (not sure about its purpose yet)

set DEPOT_TOOLS_WIN_TOOLCHAIN=0

  1. Run the command gn gen out/Default

  2. Run the build command again

autoninja -C out/Default chrome

It is also recommended to run gclient sync from out/Default directory.



回答3:

After the switch to "gn" you could try:

gn gen out/Debug