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

相关推荐
简离2 天前
前端调试实战:基于 chrome://webrtc-internals/ 高效排查WebRTC问题
前端·chrome·webrtc
Ai老司机3 天前
Chrome浏览器驱动(ChromeDriver)官方下载 - 全平台高速镜像站 | chromedrive.cn
前端·chrome
电商API_180079052473 天前
如何将小红书评论数据封装到API实现自动化分析?测试API实战指南
运维·chrome·自动化
~远在太平洋~3 天前
debian系统已安装python3.12却无法执行python命令
chrome·python·debian
阿珊和她的猫3 天前
浏览器跨页签数据共享方案
前端·javascript·vue.js·chrome
阿珊和她的猫3 天前
Chrome性能测试关键参数解析
前端·vue.js·chrome
zhangfeng11333 天前
快速验证哪个文件坏了 模型文件损坏或不完整大语言模型开发 .llm
人工智能·chrome·语言模型
不光头强4 天前
Linux 系统中最常用的命令及具体使用方法
linux·运维·chrome
田里的水稻4 天前
OE_ubuntu24.04如何安装中文简体拼音输入法
运维·前端·chrome
前端嘣擦擦4 天前
避坑笔记:Chrome 144+ SVG 事件失效问题
前端·javascript·chrome·笔记·svg2