WebRTC 不为 Windows 构建

WebRTC not building for Windows

每当我尝试为 Windows 构建 WebRTC 时,我都会在运行 gclient runhooks 时收到此错误:

    ________ running 'C:\path\to\depot_tools\python276_bin\python.exe src/build
/landmines.py' in 'C:\path\to\webrtc\src\chromium' Please follow the instructions
at http://www.chromium.org/developers/how-tos/bui ld-instructions-windows
Traceback (most recent call last):
File "src/build/landmines.py", line 215, in <module> 
    sys.exit(main())
File "src/build/landmines.py", line 202, in main
    gyp_environment.SetEnvironment()
File "C:\path\to\webrtc\src\chromium\src\build\gyp_environment.py", line 33, in
SetEnvironment
    vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs()
File "C:\path\to\webrtc\src\chromium\src\build\vs_toolchain.py", line 34, in
SetEnvironmentAndGetRuntimeDllDirs
    Update()
File "C:\path\to\webrtc\src\chromium\src\build\vs_toolchain.py", line 179, in
Update
    subprocess.check_call(get_toolchain_args)
File "C:\path\to\depot_tools\python276_bin\lib\subprocess.py", line 540, in
check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['C:\path\to\depot_tools\python276_bin\python.exe',
'C:\path\to\depot_tools\win_toolchain\get_toolchain_if_necessary.py', '--output-json',
'C:\path\to\webrtc\src\chromium\src\build\win_toolchain.json', 
'ee7d718ec60c2dc5d255bbe325909c2021a7efef']' returned non-zero exit status 1
Error: Command C:\path\to\depot_tools\python276_bin\python.exe src/build/landmines.py returned non-zero exit status 1 in C:\path\to\webrtc\src\chromium
Hook ''C:\path\to\depot_tools\python276_bin\python.exe' src/build/landmines.py' took 68.55 secs
Error: Command C:\path\to\depot_tools\python276_bin\python.exe - u src/sync_chromium.py --target-revision 271c6cca48a6cef32c0f3add3b17b700707deec 5 returned non-zero exit status 2 in C:\path\to\webrtc
Hook ''C:\path\to\depot_tools\python276_bin\python.exe' -u src/sync_chromium.py --target-revision 271c6cca48a6cef32c0f3add3b17b700707deec5' took 3842.34 secs

我使用的是安装了 VS 2013 的 64 位 Windows 7。我已经尝试设置以下变量:

GYP_DEFINES='windows_sdk_path="C:\path\to\windows\sdk" platform=win component=shared_library'
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=msvs
GYP_MSVS_VERSION=2013

尝试构建 chromium 也会出现同样的错误。使用 nohooks 抓取工作正常,只是在我尝试 gclient sync 或 runhooks 时发生错误。我也试过用 ninja 构建,但也失败了。我有所有 SDK 等都是最新的。如有任何帮助,我们将不胜感激。

我在 Google Code

找到了这个可能的解决方案

根据braveyao@webrtc.org的建议

Supporting msvs is not the focus of Chromium. You can try ninja which should always work. Also you could try to set the "GYP_GENERATORS=msvs-ninja,ninja". Then you could build with ninja and debug with VS2013.

此外,chromium 现在只有 64 位,因此您还需要更改 GYP_DEFINES

所以你的环境变量应该是:

GYP_DEFINES=target_arch=x64
DEPOT_TOOLS_WIN_TOOLCHAIN=0
GYP_GENERATORS=msvs-ninja,ninja
GYP_MSVS_VERSION=2013

当然,如果 2013 不是您安装的 Visual Studio 版本,请替换

您可能需要删除已经下载的内容,并在更改后重新 fetch webrtc 如果您考虑过

我还应该补充一点 Windows 必须是英文版本(如果你安装了其他语言包就可以,但它必须是英文的) - 我家里有一个 PT-PT 版本,那个当 运行 gclient sync 时,某些 python 文件总是会出错 - 在工作中虽然我最初有英文版本并安装了 PT-PT 语言包但它工作正常

这对我有用。这对你有用吗?