Repository navigation
fix: check Linux system deps before native rebuild - #5134
rkristelijn wants to merge 2 commits into
Conversation
- Add pre-flight check in postinstall.ts for libx11-dev, libxkbfile-dev, libsecret-1-dev, pkg-config on Linux (dpkg-based distros) - Clear error message with exact apt-get command on failure - Add Makefile for dev workflow shortcuts (deps, install, dev, build)
Jocs
left a comment
There was a problem hiding this comment.
Thanks for picking this up — the cryptic node-gyp error is a real papercut. But the check as written blocks installs that would succeed, which is why CI is red.
1. CI failure: build-essential is a meta-package the GitHub runner doesn't have (blocking)
Both PR Build (linux) and E2E Test fail in Run postinstall:
✖ Missing system dependencies: build-essential
ubuntu-latest ships gcc/g++/make but not the build-essential meta-package, so dpkg -s build-essential fails and the script exits 1 before electron-rebuild — which passes on the same runner in every other PR. Any Debian/Ubuntu machine whose toolchain was installed piecemeal hits the same false failure. website-deploy.yml would break too after merge: it runs pnpm install with only libx11-dev libxkbfile-dev libsecret-1-dev installed.
2. Package names are not what the build needs (blocking)
- Fedora has no package named
pkg-config; it is a Provides ofpkgconf-pkg-config.rpm -qmatches package names only, so the check fails on every Fedora install — and running the suggestedsudo dnf install -y pkg-config(dnf resolves Provides) doesn't make the next run pass. - Ubuntu 24.04 / Debian 13:
pkg-configis a transitional package, so a machine with onlypkgconffails. python3from pyenv/conda/asdf is invisible to dpkg/rpm.- A Fedora box that happens to have
dpkginstalled is checked against Debian names; openSUSE is rpm-based but uses zypper, not dnf. process.exit(1)on a heuristic leaves no way to proceed.
Suggestion: check the capabilities node-gyp actually uses. The error in #5133 comes from pkg-config x11 xkbfile --libs, so something like:
pkg-config --exists x11 xkbfile libsecret-1
command -v make && command -v "${CXX:-g++}" && command -v python3That is distro-agnostic and has no meta-package problem. The failure message can then list the apt/dnf/pacman commands (packages/website/content/docs/dev/BUILD.md already has them) instead of branching on the detected package manager. Alternatively, skip the pre-check and print the hint only when electron-rebuild fails — then a working setup can never be blocked.
3. Please drop the Makefile from this PR
make cleanrunsrm -rf packages/desktop/build(and again viapnpm --filter marktext exec, which runs in the same directory).packages/desktop/build/is tracked: electron-builder icons, entitlements, NSIS scripts,THIRD-PARTY-LICENSES.txt. The real outputs —dist/at the repo root andpackages/desktop/out/— are left alone.depsis apt-only, andinstall/dev/buildare one-line aliases for existing pnpm scripts.
Linux setup instructions live in packages/website/content/docs/dev/BUILD.md and LINUX_DEV.md; that's the place for anything missing.
Minor
- The branch is 392 commits behind
develop; please rebase. // Detect available package managerrestateshasCmd('dpkg')— see.github/COMMENTING-GUIDELINES.md.- The dpkg and rpm branches are copy-pasted; moot with the capability check.
Closes #5133
Summary
pnpm installon Linux fails with a crypticnode-gyperror when system dependencies (libx11-dev,libxkbfile-dev,libsecret-1-dev) are missing. This PR adds a clear pre-flight check.Changes
scripts/postinstall.ts: Added a Linux-only check (step 0) that verifies required system packages viadpkg -sbefore attempting the native rebuild. On failure, prints the exactapt-get installcommand needed.Makefile: Added for dev workflow convenience (make deps,make install,make dev,make build). Happy to discuss whether this belongs in the project.Testing