ZBLOG

subprocess.CalledProcessError: Command '['D:\\webrtc\\windows\\webrtc\\webrtc\\depot_tools\\bootstrap-3_8_0_chromium_8_bin\\python\\bin\\python.exe', 'D:\\webrtc\\windows\\webrtc\\webrtc\\webrtc-checkout\\src\\third_party\\depot_tools\\win_toolcha...

这个错误表明 WebRTC 的 Windows 工具链配置出现了问题。以下是详细的解决方案:

根本原因分析

  1. 工具链获取失败get_toolchain_if_necessary.py 脚本未能成功获取或验证 VS 工具链
  2. Python环境冲突:depot_tools 自带的 Python 与系统 Python 可能存在冲突
  3. VS版本不匹配:当前配置可能无法识别已安装的 Visual Studio

完整解决方案

第一步:强制使用本地 VS 工具链

  1. # 设置环境变量(PowerShell)
  2. $env:DEPOT_TOOLS_WIN_TOOLCHAIN = "0"
  3. $env:GYP_MSVS_VERSION = "2019" # 根据你的VS版本修改

第二步:手动指定工具链路径

  1. 查找你的 VS 安装路径

    • VS2019默认路径:C:\Program Files (x86)\Microsoft Visual Studio\2019\Community
    • Windows SDK路径:C:\Program Files (x86)\Windows Kits\10
  2. 创建覆盖配置文件: 在 src/build 目录下创建 win_toolchain.json,内容如下(需替换实际路径):

  1. {
  2. "path": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community",
  3. "version": "16.0",
  4. "sdk_version": "10.0.19041.0",
  5. "toolchain_version": "16.0"
  6. }

第三步:清理并重新生成

  1. # 删除旧配置
  2. rm -r out/X64Debug
  3. # 更新depot_tools
  4. gclient sync --force
  5. # 重新生成(添加详细日志)
  6. gn gen out/X64Debug --args="is_debug=true target_cpu=\"x64\" use_rtti=true" --verbose

Alternative方案:完全跳过工具链检查(开发环境用)

  1. # PowerShell中设置跳过标志(不推荐生产环境使用)
  2. $env:WINDOWS_EXPORT_ALL_SYMBOLS = "1"
  3. $env:LLVM_FORCE_HEAD_REVISION = "1"
  4. # Then regenerate with:
  5. gn gen out/X64Debug --args="use_custom_libcxx=false treat_warnings_as_errors=false"

Debug技巧

  1. 手动验证工具链
  1. # Run the toolchain verification manually:
  2. python src/build/vs_toolchain.py get_toolchain_dir --debug
  3. # Check Windows registry entries:
  4. reg query "HKLM\SOFTWARE\Microsoft\VisualStudio\Installation" /s | findstr InstallDir
  5. 2. **查看详细日志**:
  6. 在运行任何命令前添加:
  7. ```powershell
  8. $env:NINJA_SUMMARIZE_BUILD = "1"
  9. $env:GYP_GENERATORS = "ninja"

如果问题仍然存在,建议检查:

  • Visual Studio Installer中是否安装了”Desktop development with C++“组件
  • Windows SDK版本是否匹配(建议10.0.19041.x)
  • depot_tools是否为最新版(运行update_depot_tools.bat


    内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=23267

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?