使用命令“python tools\dev\v8gen.py x64.release 时构建 v8 错误

build v8 error when using command " python tools\dev\v8gen.py x64.release "

我尝试按照以下步骤构建 v8:

  1. git 克隆 https://chromium.googlesource.com/chromium/tools/depot_tools.git

  2. 设置路径=C:\v8\depot_tools;%路径%

  3. 设置DEPOT_TOOLS_WIN_TOOLCHAIN=0

  4. 设置GYP_MSVS_VERSION=2017

  5. 获取 v8 6.cd v8

  6. python tools\dev\v8gen.py x64.release

  7. ninja -C out.gn\x64.release

我的电脑环境:

  1. Visual Studio 2017,社区
  2. Windows SDK (15063)
  3. python2.7

错误:

E:\work_space\Technology_related\V88888\v8>python tools\dev\v8gen.py x64.release -vv
################################################################################
C:\Python27\python.exe -u tools\mb\mb.py gen -f infra\mb\mb_config.pyl -m developer_default -b x64.release out.gn/x64.release

  Writing """\
  dcheck_always_on = false
  is_debug = false
  target_cpu = "x64"
  """ to E:\work_space\Technology_related\V88888\v8\out.gn\x64.release\args.gn.

  E:\work_space\Technology_related\V88888\v8\buildtools\win\gn.exe gen out.gn/x64.release --check
    -> returned 1
  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: E:/work_space/Technology_related/V88888/v8/out.gn/x64.release/
  Command: C:/Users/moush/AppData/Local/Microsoft/WindowsApps/python3.exe E:/work_space/Technology_related/V88888/v8/build/vs_toolchain.py get_toolchain_dir
  Returned 9009.
  See //build/config/win/BUILD.gn:11:1: whence it was imported.
  import("//build/config/win/visual_studio_version.gni")
  ^----------------------------------------------------
  See //build/config/BUILDCONFIG.gn:355:5: which caused the file to be included.
      "//build/config/win:lean_and_mean",
      ^---------------------------------
  GN gen failed: 1
Traceback (most recent call last):
  File "tools\dev\v8gen.py", line 309, in <module>
    sys.exit(gen.main())
  File "tools\dev\v8gen.py", line 303, in main
    return self._options.func()
  File "tools\dev\v8gen.py", line 169, in cmd_gen
    gn_outdir,
  File "tools\dev\v8gen.py", line 213, in _call_cmd
    stderr=subprocess.STDOUT,
  File "C:\Python27\lib\subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '['C:\Python27\python.exe', '-u', 'tools\mb\mb.py', 'gen', '-f', 'infra\mb\mb_config.pyl', '-m', 'developer_default', '-b', 'x64.release', 'out.gn/x64.release']' returned non-zero exit status 1
    

我不知道如何修复这个错误,有人可以帮助我吗?谢谢

从详细输出中,您可以看到命令 C:/Users/moush/AppData/Local/Microsoft/WindowsApps/python3.exe E:/work_space/Technology_related/V88888/v8/build/vs_toolchain.py get_toolchain_dir 失败。您可以尝试 运行 单独查看它是否报告任何其他详细信息,这可能有助于您找出问题所在以及如何解决。

仅从“它失败”这一事实来看,我猜测它以某种方式没有检测到您的 Visual Studio and/or Windows SDK 安装。 FWIW,关于如何安装 VS 的官方说明是 here (linked from the V8 docs)。看来您的 SDK 可能太旧了。

您也可以尝试基于 tools/dev/gm.py 的便利工作流程,看看是否可以避免这个问题,但我猜它可能 运行 会遇到同样的问题。