Webrtc (1) - Windows 编译

最近项目上遇到webrtc wgc 的几个test case无法通过,与webrtc人员沟通后决定要自行修复一下(因为他们不想管...)

参考文档

以上两个够了,一个是webrtc的,一个是chromium的,他俩亲兄弟,一套体系

正常流程

他的常规要求比如git, vs,硬盘大小什么的不再赘述,自行阅读,但一般开发电脑都OK,重中之重,一个稳定可靠的 科学上网工具 ,如果没有,就不要往下看了,以下的所有步骤,都认为你开了科学上网工具,而且认为你已经正确的开了全局代理或运行在设置了proxy的命令行中~

下载工具包 depot_tools

他的使用手册在 depot_tools_tutorial,刚开始没必要看,下载安装即可,当然里面也描述了一些问题的解决方法,但我这一步都没遇到过
*

配置 depot_tools

Add depot_tools to the front of your PATH (must be ahead of any installs of Python). Assuming you unzipped the bundle to C:\workspace\depot_tools:

解压到指定目录里,随意,然后添加到环境变量中,为了避免工具链与你的其他工具冲突,请把它上移最顶部或者最前面。
*

运行gclient

  1. 新建一个文件夹,比如,webrtc
  2. 打开这个文件夹,并且将你命令行的工作目录设置到这里或者简单 cd 过来
  3. 输入 gclient
  4. 没什么错的话他会经过一会儿更新之类的,然后给你打印出来一些选项,这就ok了

拉取代码

  1. 还是在上一步的文件夹内,输入 fetch --nohooks webrtc
  2. 然后就是漫长的等待,大概有几百MB的代码和一些工具要同步
  3. 上一步没有失败最好不过了,有了也不怕,任何报错后再次输入gclient sync, fetch只是在第一次时使用,随后都用gclient sync, 然后看错误解决错误吧,我只遇到过让我对git做一些配置以及一个proxy的报错,说是检查到你用了代理,但是没有检测到代理配置文件(他应该是有工具可以读这个配置文件,这样他的工具链可以走你的代理)
  4. 在上一步的文件夹内新建文件.boto, 并写入以下内容
bash 复制代码
 [Boto]
 proxy = 127.0.0.1
 proxy_port = 7890
 proxy_type = http

5.重新运行 gclient sync直到没有任何报错而且资源都下载完成即可~
*

构建代码

参考 https://webrtc.googlesource.com/src/+/main/docs/native-code/development/#generating-ninja-project-files

bash 复制代码
cd src
gn gen out/Default --args="is_debug=false" --ide=vs
autoninja -C out/Default

其中 is_debug=false表示要编译release,--ide=vs表示要生成vs的项目文件,不出意外的话还是会有意外,比如我碰到四个个问题

  1. vs版本低了,更新即可

Chromium requires Visual Studio 2022 (>=17.0.0) to build. Visual Studio can also be used to debug Chromium.

  1. WINDOWS SDK版本低了,通过vs installer去更新安装对应版本即可

Windows 11 SDK version 10.0.22621.2428. This can be installed separately or by checking the appropriate box in the Visual Studio Installer.

  1. WINDOWS SDK版本够了,但是debugger组件没有,通常是因为你是通过vs installer安装的

(Windows 11) SDK Debugging Tools 10.0.22621.755 or higher. This version of the Debugging tools is needed in order to support reading the large-page PDBs that Chrome uses to allow greater-than 4 GiB PDBs. This can be installed after the matching Windows SDK version is installed, from: Control Panel -> Programs and Features -> Windows Software Development Kit version -> Change -> Debugging Tools for Windows. If building on ARM64 Windows then you will need to manually copy the Debuggers\x64 directory from another machine because it does not get installed on ARM64 and is needed, whether you are building Chromium for x64 or ARM64 on ARM64.

4.让你设置DEPOT_TOOLS_WIN_TOOLCHAIN用来生成工程时,用本地的vs 而不是从Google下载,他也不给外人下载

Also, add a DEPOT_TOOLS_WIN_TOOLCHAIN environment variable in the same way, and set it to 0. This tells depot_tools to use your locally installed version of Visual Studio (by default, depot_tools will try to use a google-internal version).

需要注意的是如果你的host机器是arm64架构的,这个安装程序还是会缺少x64架构的debugger,没办法只能从别的机器里面copy一个过来~
*

运行test case

经过漫长的等待,5000多个文件的编译完成后,可以在out/Default中查看你所编译好的一切,随便运行点什么吧。

相关推荐
执子星海2 小时前
Registry Win32 API详解
c++·windows·microsoft·visualstudio·微软
defrag2572 小时前
Win9x下用Win32程序调用Win16函数
windows
me8322 小时前
【Tool】Windows 计划任务 + VBScript 弹窗提醒:从零到一的完整指南
windows
2601_962201724 小时前
Java进阶,集合,Colllection,常见数据结构
java·数据结构·windows
loong_XL5 小时前
Windows WSL2 Ubuntu 搭建 Xvfb 虚拟桌面环境,完美支持多 Agent 隔离
linux·windows·ubuntu
DogDaoDao14 小时前
Windows 开发提效工具全景指南:60+ 工具的工程化分层配置
windows·git·程序员·开发工具·powershell·everything·msys2
水饺编程19 小时前
第5章,[Win32 章节] :Polygon 函数和多边形填充模式
c语言·c++·windows·visual studio
百事牛科技19 小时前
文档不想再加密了?Word打开密码移除的两种方法
windows·word
软件资深者1 天前
千千静听典藏修复版 使用教程:经典本地音乐播放器回归,歌词同步、皮肤皮肤自由换,音乐播放器怀旧新手 5 分钟上手(2026)
windows
captain3761 天前
文件与IO(2)
java·开发语言·windows·java-ee