GeezerVison is showing github.com — fix(desktop): prepare server bytecode on Linux ARM64 (#33050) · AndryHTC/t3code@3da48c1
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/release-desktop.yml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -478,7 +478,7 @@ jobs: | 478 | 478 | shell: bash | 479 | 479 | run: | | 480 | 480 | 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 | 482 | 482 | if ! command -v magick >/dev/null 2>&1 && ! command -v convert >/dev/null 2>&1; then | 483 | 483 | sudo apt-get install -y imagemagick | 484 | 484 | fi | |
Collapse file Copy file name to clipboardExpand all lines: docs/operations/development.md +17-6Lines changed: 17 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -264,13 +264,19 @@ vp run dist:desktop:linux | 264 | 264 | vp run dist:desktop:win | 265 | 265 | ``` | 266 | 266 |
| | 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 | + | 267 | 273 | DMGs default to the host architecture. Use `--arch` to choose another target and `--keep-stage` | 268 | 274 | to retain packaging files for inspection. Run `vp run dist:desktop:artifact --help` for other | 269 | 275 | options. | 270 | 276 |
| 271 | 277 | ### Prepared server bytecode | 272 | 278 |
| 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 | 274 | 280 | bytecode with the packaged Electron executable, after ASAR creation and before signing. Generation imports the CLI and server | 275 | 281 | module declarations without launching server services; worker-only modules compile normally. | 276 | 282 | 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. | 296 | 302 | ### Linux AppImage prerequisites | 297 | 303 |
| 298 | 304 | 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. | 300 | 309 |
| 301 | | -Ubuntu and Debian: | | 310 | +Ubuntu 24.04 and Debian 13: | 302 | 311 |
| 303 | 312 | ```sh | 304 | 313 | 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 | 306 | 315 | ``` | 307 | 316 |
| | 317 | +On Ubuntu 22.04 and Debian 12, use `libgtk-3-0` and `libasound2` instead of the `t64` packages. | | 318 | + | 308 | 319 | Fedora: | 309 | 320 |
| 310 | 321 | ```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 | 312 | 323 | ``` | 313 | 324 |
| 314 | 325 | Arch Linux: | 315 | 326 |
| 316 | 327 | ```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 | 318 | 329 | ``` | 319 | 330 |
| 320 | 331 | The C toolchain, pkg-config, and libsecret headers are also needed for Linux desktop development. | |
Collapse file Copy file name to clipboardExpand all lines: scripts/lib/server-compile-cache.test.ts +7-4Lines changed: 7 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,8 @@ import { cacheKey, seedPreparedCache } from "./server-compile-cache.ts"; | 8 | 8 |
| 9 | 9 | it.each([ | 10 | 10 | { 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" }, | 12 | 13 | ])( | 13 | 14 | "skips unsupported $platform/$hostArch cache generation", | 14 | 15 | async ({ platform, hostArch, arch, reason }) => { | @@ -36,11 +37,13 @@ it.each([ | 36 | 37 | { | 37 | 38 | platform: "darwin", | 38 | 39 | hostArch: "arm64", | | 40 | + arch: 1, | 39 | 41 | resources: "Fixture.app/Contents/Resources", | 40 | 42 | executable: "Fixture.app/Contents/MacOS/Fixture", | 41 | 43 | }, | 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 }) => { | 44 | 47 | const { spawnSync } = await import("node:child_process"); | 45 | 48 | const root = NodeFS.realpathSync( | 46 | 49 | NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-hook-cache-")), | @@ -76,7 +79,7 @@ it.each([ | 76 | 79 | Object.defineProperty(process, "platform", { value: ${JSON.stringify(platform)} }); | 77 | 80 | Object.defineProperty(process, "arch", { value: ${JSON.stringify(hostArch)} }); | 78 | 81 | 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}, | 80 | 83 | packager: { appInfo: { productFilename: "Fixture" }, executableName: "fixture" } | 81 | 84 | }).catch(error => { console.error(error); process.exitCode = 1; }); | 82 | 85 | `, | |
Collapse file Copy file name to clipboardExpand all lines: scripts/prepare-server-compile-cache.cjs -4Lines changed: 0 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -11,10 +11,6 @@ module.exports = async ({ appOutDir, electronPlatformName, arch, packager }) => | 11 | 11 | return; | 12 | 12 | } | 13 | 13 | 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 | | - } | 18 | 14 | const runsWithRosetta = | 19 | 15 | electronPlatformName === "darwin" && | 20 | 16 | process.platform === "darwin" && | |
|