window编译chromium源码

启用proxy

创建chromium文件夹并进入该文件夹,然后克隆depot_tools

bash 复制代码
# 1. 创建目录并克隆 depot_tools
mkdir chromium
cd chromium
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

# 2. 添加 depot_tools 到系统 PATH
# 将 depot_tools 路径添加到用户环境变量 PATH 开头

出现错误fatal: unable to access 'https://chromium.googlesource.com/chromium/tools/depot_tools.git/': Failed to connect to chromium.googlesource.com port 443 after 21257 ms: Could not connect to server解决:

设置git proxy

bash 复制代码
# 设置 HTTP/HTTPS 代理
git config --global http.proxy http://127.0.0.1:2712
git config --global https.proxy http://127.0.0.1:2712

# 设置 socks5 代理
git config --global http.proxy socks5://127.0.0.1:2711
git config --global https.proxy socks5://127.0.0.1:2711

设置PowerShell proxy

bash 复制代码
# 设置 HTTP 代理
setx HTTP_PROXY http://127.0.0.1:2712
setx HTTPS_PROXY http://127.0.0.1:2712

# 或者设置 socks5 代理
setx ALL_PROXY socks5://127.0.0.1:2711

再次运行克隆命令

bash 复制代码
 git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git

成功克隆depot_tools

添加depot_tools到环境变量PATH

执行下面命令后,重启终端

bash 复制代码
setx DEPOT_TOOLS_WIN_TOOLCHAIN 0

重启终端后配置下面git属性

bash 复制代码
git config --global core.autocrlf false
git config --global core.filemode false
git config --global branch.autosetuprebase always

开始下载chromium源码

bash 复制代码
fetch chromium

源码开始下载中...

一共需要下载60.28GB

开始接收中...

中途网络问题,同步失败时,运行gclient sync -D重新同步

复制python为python3

继续同步

bash 复制代码
gclient sync --verbose --no-history

同步完成

同步完成后安装VS2026

设置环境变量

运行gclient runhooks

开始编译

进入src目录,创建编译输出目录out/Default

bash 复制代码
mkdir -p out/Default

编写构建文件

复制代码
gn args out\Default

添加内容并保存

出现下面错误表示没有安装vs2022

安装VS2022

生成编译配置

开始构建...

bash 复制代码
autoninja -C out\Default chrome -j 8

构建中...

正在链接中

构造成功,大约花费15个小时左右

成功生成chrome

相关推荐
John_ToDebug19 小时前
深入剖析 WebHostView:浏览器内核中的桌面级 Web 宿主
chrome
John_ToDebug19 小时前
隐于无形,触手可及:Chrome 互动滚动条的六个设计密码
chrome·windows·ui
John_ToDebug1 天前
WebHostView 与 TabStrip 交互机制深度解析
c++·chrome·windows
蜡台1 天前
H5使用Chrome 权限问题
前端·javascript·chrome
风曦Kisaki1 天前
# Linux Shell 编程入门 Day02:条件测试、if 判断、循环与随机数
linux·运维·chrome
John_ToDebug1 天前
Chrome 浏览器原生下载逻辑架构
chrome·架构·下载
modelmd1 天前
研究C语言的hello world输出
c语言·开发语言·chrome
fen_fen2 天前
下载Chrome浏览器对应的Driver
前端·chrome
用户6757049885022 天前
不装插件不写代码!教你一招搞定网页长截图!清晰且高效!
前端·chrome
kyriewen2 天前
别再乱装图片插件了!我手写了一个,能扒光整个网页(含背景/iframe/Shadow DOM)
前端·chrome·浏览器