赞
踩
【1】depot_tools 下载与配置
git clone https://chromium.googlesource.com/chromium/tools/depot_tools
配置 depot_tools 解压路径到 path 环境变量中,确保在首位
配置环境变量 DEPOT_TOOLS_WIN_TOOLCHAIN 其值为 0,DEPOT_TOOLS_UPDATE 其值为 0
【2】window 编译环境构建
Visual Studio 2019 安装与配置
安装 Visual Studio 2019 时,勾选 使用 C++ 的桌面开发,勾选 C++ ATL 生成工具,其他项默认即可
配置环境变量 vs2019_install,其值为 Visual Studio 2019 安装路径,如 D:\Program Files (x86)\Microsoft Visual Studio\2019\Professional
Windows 10 SDK 安装与配置
SDK 下载地址,https://developer.microsoft.com/zh-cn/windows/downloads/sdk-archive/
安装时确保勾选 “Debugging Tools For Windows” 其他的选项默认
配置环境变量 WINDOWSSDKDIR 其值为 SDK 安装路径,如 D:\Windows Kits\10
【3】chrome 源码获取与编译
访问如下网址可以获取对应版本的 chrome 源码
https://chromium.googlesource.com/chromium/src.git/+/refs/tags/103.0.5060.66
访问如下网址可以获取对应版本的 chrome 源码编译指南
- github 仓库
- git clone --depth 100 -b 103.0.5060.66 https://chromium.googlesource.com/chromium/src.git src
-
- gitee 仓库
- git clone --depth 100 -b 103.0.5060.66 https://gitee.com/mirrors/chromium.git src
- 还原git仓库地址
- cd src
- git remote set-url origin https://chromium.googlesource.com/chromium/src.git
- cd ..
- 生成 .gclient 文件
- gclient config --unmanaged https://chromium.googlesource.com/chromium/src.git
-
- gclient sync
- 等同于
- gclient sync --nohooks
- gclient runhooks
- cd src
- 配置参数
- gn args out\Default --ide=vs2019
-
- 自动打开 out\Default\args.gn 并编辑文件为如下内容
-
- is_component_build = true
- is_debug = false
- symbol_level = 0
- enable_nacl = false
- #ffmpeg setting Support H264
- ffmpeg_branding = "Chrome"
- proprietary_codecs = true
-
- 生成方案
- gn gen out\Default --ide=vs2019
- 编译
- autoninja -C out\Default chrome
问题与解决方案
【1】UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 249: illegal multibyte sequence
- 问题 :
- UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf
- in position 249: illegal multibyte sequence
- 解决方案 :
- 在 gn args out/Default --ide=vs2019 生成 args.gen 配置文件时内部不要包含中文字符
要点说明
chrome 的编译需要确保网络环境稳定,可以正常访问 google 对应的仓库,建议可以在云服务器上进行构建,然后再将编译结果打包下载下来。
参考致谢
本博客为博主的学习实践总结,并参考了众多博主的博文,在此表示感谢,博主若有不足之处,请批评指正。
【1】win10 下载 Chromium 源码并编译(版本 103.0.5060.66)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。