Beautiful, AI-native markdown IDE and LLM wiki
TypeScript 2nd-brainagent-skillsclaudecodexcompany-braindocsknowledge-knowledge-baseknowledge-managementllmllm-wikillm-wiki-karpathymarkdownmarkdown-editormdmdxnotespkmsecond-brainskills
fix(desktop): skip @electron/rebuild on Linux (unblocks the Linux draft build) (#2899)
mike-inkeepfd3e904b5741
diff --git a/.github/workflows/desktop-build-win-linux.yml b/.github/workflows/desktop-build-win-linux.ymlindex 3c534a206..8c0c3f390 100644--- a/.github/workflows/desktop-build-win-linux.yml+++ b/.github/workflows/desktop-build-win-linux.yml@@ -281,20 +281,13 @@ jobs:working-directory: packages/desktoprun: pnpm run build:desktop- # node-liblzma (a transitive native dep) links against the system liblzma- # via pkg-config during @electron/rebuild; ubuntu-latest ships the runtime- # library but not the -dev headers / .pc file, so node-gyp fails with- # "Package 'liblzma' ... not found". macOS provides it in the SDK, which is- # why the DMG build never hit this. Install the dev package before packaging.- - name: Install native build deps (liblzma for node-liblzma)- run: sudo apt-get update && sudo apt-get install -y liblzma-dev-- # x64 only. An arm64 deb makes @electron/rebuild cross-compile every native- # dep (node-liblzma, node-pty, @mongodb-js/zstd, @parcel/watcher) for- # aarch64 on this x64 host, which needs a full cross toolchain plus arm64- # system libs — impractical here. arm64 Linux is deferred to a native arm64- # runner (ubuntu-*-arm) follow-up; electron-builder.yml keeps deb:[x64,arm64]- # as the intended end state, and AppImage is already x64-only there.+ # x64 only. The Linux native rebuild is skipped (electron-builder.yml+ # beforeBuild), so an arm64 deb would package but ship the x64+ # @parcel/watcher prebuild (pnpm installs only the host arch), degrading+ # file-watching to chokidar on arm64. Keep the draft clean at x64; arm64+ # Linux is deferred to a native arm64 runner follow-up that can stage the+ # arm64 prebuilds. electron-builder.yml keeps deb:[x64,arm64] as the intended+ # end state, and AppImage is already x64-only there.- name: Package AppImage + deb (x64)working-directory: packages/desktoprun: pnpm exec electron-builder --linux AppImage:x64 deb:x64 --publish neverdiff --git a/packages/desktop/electron-builder.yml b/packages/desktop/electron-builder.ymlindex 2d19f2197..6fcdd064e 100644--- a/packages/desktop/electron-builder.yml+++ b/packages/desktop/electron-builder.yml@@ -11,6 +11,13 @@ copyright: Copyright © 2026 Inkeep# electron-rebuild / native-module ABI compilation cannot drift.electronVersion: "41.2.1"+# Gate @electron/rebuild per platform: mac/win rebuild native deps (mac needs+# node-pty's ABI; win cross-builds per-arch binaries), Linux skips it (all shipped+# Linux natives are N-API prebuilds; the only node-gyp deps are unused, unbuilt-by-+# design transitive server deps that fail to compile against Electron's v8 headers+# under GCC -Werror). See scripts/before-build.mjs for the full rationale.+beforeBuild: scripts/before-build.mjs+directories:output: dist-desktopbuildResources: builddiff --git a/packages/desktop/scripts/before-build.mjs b/packages/desktop/scripts/before-build.mjsnew file mode 100644index 000000000..ddc25ab89--- /dev/null+++ b/packages/desktop/scripts/before-build.mjs@@ -0,0 +1,28 @@+/**+ * electron-builder `beforeBuild` hook.+ *+ * Return value contract (app-builder-lib Packager.installAppDependencies):+ * `false` skips the @electron/rebuild native-dependency pass; any other value+ * lets it run. We gate it on the build host platform (each platform packages on+ * its own native runner, so host === target here).+ *+ * macOS + Windows → run the rebuild. macOS ships node-pty (a node-gyp/nan addon,+ * NOT N-API) which must be rebuilt for Electron's ABI; Windows cross-builds the+ * per-arch native binaries (its arm64 installer needs them) and compiles cleanly+ * under MSVC.+ *+ * Linux → skip it. Every native module that actually ships in the Linux package+ * is N-API and loads in Electron straight from its prebuilt `.node` with no+ * rebuild: @napi-rs/keyring, @inkeep/open-knowledge-native-config, and+ * @parcel/watcher. node-pty is excluded from the Linux `files`. The only reason+ * @electron/rebuild has anything to compile is unused node-gyp transitive deps+ * dragged in through the bundled server (node-liblzma via just-bash,+ * @mongodb-js/zstd) — pnpm ignores their build scripts, so they are unbuilt in+ * every normal install and the app already runs without them. Compiling them+ * adds nothing and hard-fails on Linux GCC: node-liblzma's binding.gyp forces+ * `-Werror`, and Electron's bundled v8 headers trip `-Wcomment` (ASCII-art+ * comments ending in `\`). Skipping the pass keeps the Linux draft build green.+ */+export default async function beforeBuild() {+ return process.platform !== 'linux';+}