因为之前已经在 Windows 和 Mac 上搞过一轮,加上有 AI 老师傅指点,我以为这次只是跑两个脚本那么简单。没想到一开始就翻了车。
首先是确定使用哪个 Linux 版本。按照 GPT 老师的建议,最好用 Electron 1.8.0 发布时的官方环境 —— Ubuntu 16.04。可惜我手头那台 Linux 机器早几年就升到了 20.04,不太想为了这个重装系统。而且 Electron 编译起来非常庞大,放 VM 里跑也不现实。
这时 GPT 老师突然灵光一闪:为什么不用 Docker? 我以前没怎么碰过 Docker,以为它只是 Linux 的进程隔离工具。结果发现连 Mac 上也能跑,于是就装了一下。很顺利地创建了一个 Ubuntu 16.04 的环境——这算是 VM 吗?还是进程隔离?搞不清楚,但总之新买的 M2 机器终于有了用武之地。
于是退回 Python 2.7,再次运行 build.py,这次终于顺利进入构建流程。前期编译过程很快,毕竟历史中间文件还在。可没想到,等到了 link 阶段,机器突然开始变卡,几分钟后系统直接重启了。
我试了几次,都是在 link 阶段死机。最初还怀疑是老机器硬件出问题了。但联想到死机总发生在同一阶段,我猜可能是资源耗尽。打开任务管理器观察,果然在崩溃前有异常磁盘写入,某个系统进程(kernel什么的)在短时间内写了三十多个 G数据。但编译目录并没有生成相应的大文件,看起来不是 link 阶段输出的问题。
“The value of Rp shall indicate an advertisement of Default USB Power (See Table 4-24), even though the cable itself can carry 3 A. This is because the cable has no knowledge of the capabilities of the power source, and any higher current is negotiated via USB BC 1.2.”
“I directly analyzed the Surjtech cable using a Type-C breakout board and a multimeter, and it appears that they completely miswired the cable. The GND pin on the Type-A plug is tied to the Vbus pins on the Type-C plug. The Vbus pin on the Type-A plug is tied to GND on the Type-C plug,” Leung described.
// 合并批次之后的顶点数据:
// mul( GetCanvasTransform(this.RectTransform) , Mesh顶点 )
Matrix4x4 GetCanvasTransform(Transform t)
{
Matrix4x4 current = Matrix4x4.identity;
while (true)
{
var canvas = t.gameObject.GetComponent<canvas>();
if (canvas != null && canvas.isRootCanvas)
return current;
var m = Matrix4x4.TRS(t.localPosition, t.localRotation, t.localScale) * current;
if (t.parent == null)
return m;
current = m;
t = t.parent;
}
}