Skip to content

Commit 3da48c1

Browse files
authored
fix(desktop): prepare server bytecode on Linux ARM64 (#33050)
Enable prepared server bytecode on native Linux ARM64 desktop builds and install the Electron runtime libraries required to generate it on headless Linux runners. Keep host compatibility checks and extend the existing tests. Document the native ARM64 command and supported build prerequisites. Validated with check:changed, native ARM64 tests, AppImage and .deb builds, and packaged Electron accepting the prepared CLI and server bytecode after extraction. CI and bot reviews passed on 8f89392. Implemented and verified by GPT 6.1 Sol through the Codex harness.
1 parent f558007 commit 3da48c1

4 files changed

Lines changed: 25 additions & 15 deletions

File tree

‎.github/workflows/release-desktop.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ jobs:
478478
shell: bash
479479
run: |
480480
sudo apt-get update
481-
sudo apt-get install -y libsecret-1-dev pkg-config
481+
sudo apt-get install -y libsecret-1-dev pkg-config libgtk-3-0t64 libnss3 libasound2t64 libgbm1
482482
if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then
483483
sudo apt-get install -y imagemagick
484484
fi

‎docs/operations/development.md‎

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,19 @@ vp run dist:desktop:linux
264264
vp run dist:desktop:win
265265
```
266266

267+
`dist:desktop:linux` targets x64. For a native Linux ARM64 build, run:
268+
269+
```sh
270+
vp run dist:desktop:artifact --platform linux --target AppImage --arch arm64
271+
```
272+
267273
DMGs default to the host architecture. Use `--arch` to choose another target and `--keep-stage`
268274
to retain packaging files for inspection. Run `vp run dist:desktop:artifact --help` for other
269275
options.
270276

271277
### Prepared server bytecode
272278

273-
Native macOS and Windows desktop artifact builds, and native Linux x64 builds, generate server
279+
Native macOS and Windows desktop artifact builds, and native Linux x64 and ARM64 builds, generate server
274280
bytecode with the packaged Electron executable, after ASAR creation and before signing. Generation imports the CLI and server
275281
module declarations without launching server services; worker-only modules compile normally.
276282
AppImage backends use temporary links for each mount and remove them on normal exit. Later launches
@@ -296,25 +302,30 @@ keeps the explicit flush needed when Windows force-kills the backend.
296302
### Linux AppImage prerequisites
297303

298304
Build on Linux because the browser-secret helper links against the host's libsecret. Install
299-
Rust, C/C++ build tools, libsecret development headers, pkg-config, and ImageMagick.
305+
C/C++ build tools, libsecret development headers, pkg-config, and ImageMagick.
306+
Bytecode preparation also runs packaged Electron and requires GTK, NSS, ALSA, and GBM runtime libraries.
307+
Install Rust 1.95 or newer through [rustup](https://rust-lang.org/install), using the stable
308+
toolchain as release CI does.
300309

301-
Ubuntu and Debian:
310+
Ubuntu 24.04 and Debian 13:
302311

303312
```sh
304313
sudo apt-get update
305-
sudo apt-get install cargo rustc build-essential libsecret-1-dev pkg-config imagemagick
314+
sudo apt-get install build-essential libsecret-1-dev pkg-config imagemagick libgtk-3-0t64 libnss3 libasound2t64 libgbm1
306315
```
307316

317+
On Ubuntu 22.04 and Debian 12, use `libgtk-3-0` and `libasound2` instead of the `t64` packages.
318+
308319
Fedora:
309320

310321
```sh
311-
sudo dnf install rust cargo gcc gcc-c++ make libsecret-devel pkgconf-pkg-config ImageMagick
322+
sudo dnf install gcc gcc-c++ make libsecret-devel pkgconf-pkg-config ImageMagick gtk3 nss alsa-lib mesa-libgbm
312323
```
313324

314325
Arch Linux:
315326

316327
```sh
317-
sudo pacman -S rust base-devel libsecret pkgconf imagemagick
328+
sudo pacman -S base-devel libsecret pkgconf imagemagick gtk3 nss alsa-lib mesa
318329
```
319330

320331
The C toolchain, pkg-config, and libsecret headers are also needed for Linux desktop development.

‎scripts/lib/server-compile-cache.test.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import { cacheKey, seedPreparedCache } from "./server-compile-cache.ts";
88

99
it.each([
1010
{ platform: "freebsd", hostArch: "x64", arch: 1, reason: "unsupported target freebsd" },
11-
{ platform: "linux", hostArch: "arm64", arch: 3, reason: "unsupported Linux architecture arm64" },
11+
{ platform: "linux", hostArch: "x64", arch: 3, reason: "unexecutable target linux/arm64" },
12+
{ platform: "linux", hostArch: "arm64", arch: 1, reason: "unexecutable target linux/x64" },
1213
])(
1314
"skips unsupported $platform/$hostArch cache generation",
1415
async ({ platform, hostArch, arch, reason }) => {
@@ -36,11 +37,13 @@ it.each([
3637
{
3738
platform: "darwin",
3839
hostArch: "arm64",
40+
arch: 1,
3941
resources: "Fixture.app/Contents/Resources",
4042
executable: "Fixture.app/Contents/MacOS/Fixture",
4143
},
42-
{ platform: "linux", hostArch: "x64", resources: "resources", executable: "fixture" },
43-
])("prepares $platform x64 cache", async ({ platform, hostArch, ...layout }) => {
44+
{ platform: "linux", hostArch: "x64", arch: 1, resources: "resources", executable: "fixture" },
45+
{ platform: "linux", hostArch: "arm64", arch: 3, resources: "resources", executable: "fixture" },
46+
])("prepares $platform/$hostArch cache", async ({ platform, hostArch, arch, ...layout }) => {
4447
const { spawnSync } = await import("node:child_process");
4548
const root = NodeFS.realpathSync(
4649
NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-hook-cache-")),
@@ -76,7 +79,7 @@ it.each([
7679
Object.defineProperty(process, "platform", { value: ${JSON.stringify(platform)} });
7780
Object.defineProperty(process, "arch", { value: ${JSON.stringify(hostArch)} });
7881
require(${JSON.stringify(hook)})({
79-
appOutDir: ${JSON.stringify(root)}, electronPlatformName: ${JSON.stringify(platform)}, arch: 1,
82+
appOutDir: ${JSON.stringify(root)}, electronPlatformName: ${JSON.stringify(platform)}, arch: ${arch},
8083
packager: { appInfo: { productFilename: "Fixture" }, executableName: "fixture" }
8184
}).catch(error => { console.error(error); process.exitCode = 1; });
8285
`,

‎scripts/prepare-server-compile-cache.cjs‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ module.exports = async ({ appOutDir, electronPlatformName, arch, packager }) =>
1111
return;
1212
}
1313
const targetArch = ["ia32", "x64", "armv7l", "arm64", "universal"][arch];
14-
if (electronPlatformName === "linux" && targetArch !== "x64") {
15-
console.log(`[server-compile-cache] Skipping unsupported Linux architecture ${targetArch}`);
16-
return;
17-
}
1814
const runsWithRosetta =
1915
electronPlatformName === "darwin" &&
2016
process.platform === "darwin" &&

0 commit comments

Comments
 (0)