【问题标题】:How do you compile V8 with Visual Studio?如何使用 Visual Studio 编译 V8?
【发布时间】:2016-02-02 05:18:20
【问题描述】:

我一直在尝试编译 V8。我从 GitHub 获得了 v8-master 文件夹的副本,但我不知道如何编译它。我可以在网上找到的很多文档都是相互矛盾的。

从我收集到的信息来看,似乎我最好的编译它的机会(在我找到的各种方法中,虽然我无法让它们中的任何一个工作)是创建项目通过调用 gyp_v8 脚本(位于 v8-master 的 build 文件夹中)来创建文件。但它只是给了我File "gyp_v8", line 86print 'Error running GYP'SyntaxError: Missing parentheses in call to 'print'。从那里,我尝试安装 Gyp(因为根据文档,我被认为是导致错误的原因)。这需要我安装 depot_tools 并执行gclient sync。失败并出现错误Error: client not configured; see 'gclient config'。并且gclient config 失败并出现错误gclient.py: error: Inconsistency arguments. Use either --spec or one or 2 args

老实说,我现在迷路了。有什么办法可以只使用 CMake 或其他东西吗?或者至少是一个构建教程,假设您没有涉及一堆 Google 特定的构建工具?

【问题讨论】:

    标签: c++ visual-studio v8 gyp


    【解决方案1】:
    1. 确认 Git 已安装。推荐 git 2.2.1+。
    2. 暂时禁用 Windows 索引。
    3. 安装“Microsoft Visual C++ 2008 Redistributable Package”
    4. 以管理员身份运行bat文件

    蝙蝠文件:

    @echo on
    
    CD /D %~dp0
    SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
    SET DEPOT_TOOLS=%CD%/depot_tools
    SET PYTHONHOME=%DEPOT_TOOLS%/python276_bin
    SET PYTHONPATH=%CD%/v8/build/gyp
    SET PATH=%DEPOT_TOOLS%;%PYTHONHOME%;%PATH%
    
    SET GYP_DEFINES=target_arch=x64
    REM SET GYP_DEFINES=target_arch=x64 component=shared_library v8_use_snapshot=false
    REM About GYP_DEFINES: https://github.com/v8/v8/wiki/Building-with-Gyp
    
    IF EXIST %DEPOT_TOOLS% (
      ECHO Updating depot_tools
      CD %DEPOT_TOOLS%
      CALL git pull
      CD ..
    ) ELSE (
      ECHO Getting depot_tools
      CALL git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    )
    
    CALL gclient
    CALL gclient config https://chromium.googlesource.com/v8/v8.git
    CALL gclient sync
    

    【讨论】:

    • 在最后一行我收到错误gyp: Call to 'cd .. && python -c "import os; print os.getcwd()"' returned exit status 1 in v8\build\all.gyp(它显示了完整的文件路径,但它很长,所以我缩短了它)。
    • 我更新了一个答案。我的酋长使用了这个解决方案。在 v8\build 中会出现 all.sln
    【解决方案2】:

    我之前从 Visual Studio 2010 的源代码构建了 V8,然后又为 Visual Studio 2013 构建了 V8。这两种情况下的任务都非常耗时。但是对于 Visual Studio 2017,我发现 NuGet 提供了头​​文件和预构建库。我不再需要从源代码构建。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多