下载depot_tools
Google将用于代码下载、编译等的工具统一打包在 depot_tools中,需将它下载到本地。
depot_tools.zip 文件解压之后,将 depot_tools 目录地址添加到电脑的系统环境变量 PATH 里。
解决代理问题
略
在系统环境变量中设置如下的环境变量
set PATH=%PATH%;F:\Download\depot_tools //path中添加depot_tools到首位
set GYP_MSVS_OVERRIDE_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community
set GYP_GENERATORS=msvs-ninja,ninja
set DEPOT_TOOLS_WIN_TOOLCHAIN=0//使用本地的工具链
set http_proxy=127.0.0.1:7890
set https_proxy=127.0.0.1:7890
生成如下的.boto文件,并设置系统环境变量
[Boto]
proxy = 127.0.0.1
proxy_port = 7890
proxy_type = http
set NO_AUTH_BOTO_CONFIG=F:\Download\.boto
下载src源码
mkdir webrtc #这是创建一个目录
cd webrtc #进入到我们刚刚创建的目录中
gclient #下载src文件
fetch --nohooks webrtc
报错:
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件
1>['git.bat', 'config', 'cache.cachepath']
这是因为电脑安装的git工具的可执行文件名为git.exe而不是git.bat
处理方法:
class Mirror(object):
git_exe = 'git.exe' if sys.platform.startswith('win') else 'git' #git.bat改为git.exe
此后,花了几个小时下载完源码。
执行 gclient sync,
报错:
Error: Command 'python3 src/build/landmines.py --landmine-scripts src/tools_webrtc/get_landmines.py --src-dir src' returned non-zero exit status 9009 in F:\webrtc\webrtc-checkout
处理方法:
这是因为python的可执行文件为python.exe,而不是python3.exe,需要将python.exe复制为python3.exe.
gn gen out/Default --ide=vs2022
报错:
Exception: C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\VC\vcvarsall.bat is missing - make sure VC++ tools are installed.
处理方法:
修改环境变量,
GYP_MSVS_OVERRIDE_PATH=C:\Program Files\Microsoft Visual Studio\2022\Community
同时修改
setup_toolchain.py
script_path = os.path.normpath(os.path.join(os.environ['GYP_MSVS_OVERRIDE_PATH'],'VC/Auxiliary/Build/vcvarsall.bat'))
报错:
Exception: Path "C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared" from environment variable "include" does not exist. Make sure the necessary SDK is installed.
处理方法:
运行visual studio 2022的安装工具VisualStudioSetup.exe,并修改安装的visualstudio软件
报错:
You must install Windows 10 SDK version 10.0.22621.0 including the "Debugging Tools for Windows" feature.、
处理方法:
在应用中更新Windows 10的SDK,增加"Debugging Tools for Windows" 功能。
ninja -C out/Default