惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
Martin Fowler
Martin Fowler
B
Blog RSS Feed
D
DataBreaches.Net
L
LangChain Blog
月光博客
月光博客
S
SegmentFault 最新的问题
阮一峰的网络日志
阮一峰的网络日志
V
Visual Studio Blog
美团技术团队
Jina AI
Jina AI
博客园 - 司徒正美
雷峰网
雷峰网
Last Week in AI
Last Week in AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
IT之家
IT之家
博客园 - 三生石上(FineUI控件)
WordPress大学
WordPress大学
小众软件
小众软件
罗磊的独立博客
博客园_首页
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
A
About on SuperTechFans
Engineering at Meta
Engineering at Meta

hsfzxjy 的博客

解决 VSCode + CMake + MSVC 编译器信息乱码的问题 使用 3090 部署 1.58bit 动态量化版 DeepSeek R1 671b 如何在 VS Code DevContainer 中配置 HTTP 代理 如何在跳板机背后的服务器上使用 VS Code Remote - Containers Cohesive Digests for Ints and Floats Rust 中的隐匿概念 —— Place(位置) 美术馆 一尺之槌,日取其半,1075日而竭 老生常谈:使用 Cloudflare 自选 IP 加速站点访问 辩义 State、Nation 与 Country 将 Base64 编码的数据快速转换为 Uint8Array 折腾 NPU·第1章 —— 搭建 Level Zero 开发环境 折腾 NPU·第0章 —— Intel NPU 概述与 Level-Zero 新增域名 monad.run CSS 中为特定字符设置不同字体 Arbitary Lifetime Transmutation via Rust Unsoundness Dijkstra 算法的延伸 Manacher 回文计数算法 硬卧 Go Fact: Zero-sized Field at the Rear of a Struct Has Non-zero Size Display *big.Rat Losslessly and Smartly in Golang 代码的仪式 中式亲属称谓研究之一:构建半群 Some Notes on Kotlin Coroutines Git sparse-checkout and partial clones for Mega-Repos 辩义“封建” Diving from the CUDA Error 804 into a bug of libnvidia-container Modern Cryptography, GPG and Integration with Git(hub) Move the Root Partition of Ubuntu A New Programmer Kicks a Roadblock
Building Electron From Scratch
2023-07-07 · via hsfzxjy 的博客

Last night I started a journey to build Electron completely from the ground up, for investigating a subtle issue in VSCode.

The journey appears as a really painful challenge for my disk storage as well as network condition. It has downloaded around 30 GiB contents from the Internet, and occupied 55 GiB of storage space on the disk after the binary file was fully compiled. I will suggest anyone to go through this journey should place his workspace on an SSD, and adopt a network proxy of good quality if in China.

Albeit it occupies a bunch of resources greedily, the Electron team provides a command line tool e (Electron build-tools) to hopefully simplify the building process. The guidance leading to this tool, however, is not obvious enough on the doc page. I’ve wasted two or three hours following the instructions in the doc that explicitly invokes gclient or gn or ninja, which yet resulted in a bunch of errors and a hell of mess. So here’s the first advice – DO NOT follow any instructions after section “GN files” in this page. Just go ahead to use Electron build-tools!

Things become easier once you’ve learned the existence of Electron build-tools. To install the tool you only have to type one command

$ npm i -g @electron/build-tools

This package manages for you all the necessary stuffs to build Electron, including Depot Tools for source code management and Rust/clang toolchains for building, which are exposed as a single command e. To fetch the source code and build Electron in one go, you need to run

$ 
$ export GIT_CACHE_PATH="/path/to/git-cache"
$ mkdir -p $GIT_CACHE_PATH
$
$ export DEPOT_TOOLS_UPDATE=0
$
$ export http_proxy=... https_proxy=...
$
$ mkdir -p $WORKSPACE && cd $WORKSPACE
$
$ e init --root=$PWD --bootstrap testing --fork hsfzxjy/electron --goma none

Some notes on these command:

  1. depot_tools respect the environment variable GIT_CACHE_PATH to cache up git database for all fetched dependencies. The variable is highly recommended to set as it could significantly speed up file synchronization next time.
  2. depot_tools will automatically check updates for itself and I don’t like it. Disable this behavior via DEPOT_TOOLS_UPDATE=0.
  3. depot_tools respect the http_proxy and https_proxy for network proxy, but proxychains might fail wierdly.
  4. The flag --goma none is necessary if you build Electron on your personal computer without using distributed building facility like Goma. Otherwise the building process will emit errors in the middle.

Author: hsfzxjy.
Link: .
License: CC BY-NC-ND 4.0.
All rights reserved by the author.
Commercial use of this post in any form is NOT permitted.
Non-commercial use of this post should be attributed with this block of text.