fix(linux): make the Linux build work on arm64 - #293
Conversation
|
Warning Review limit reached
Next review available in: 44 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughThe PR adds Linux ARM64 support for FFmpeg provisioning and bindgen paths. It also replaces hardcoded ChangesLinux ARM64 support
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`npm run build:linux` could not complete on an aarch64 host. Four independent x86-only assumptions, each fixed here: - fetch-ffmpeg: SHARED_PINNED had no `linux-arm64` entry, so the SDK fetch bailed out. BtbN publishes the asset in the pinned release; only the pin was missing. Digest taken from its checksums.sha256. - build-linux-compositor-addon: `/usr/lib/x86_64-linux-gnu` and `/usr/lib/gcc/x86_64-linux-gnu` were hardcoded, hiding both libclang and gcc's stddef.h on arm64. Derived from `process.arch` instead. - build-linux-pipewire-helper: bindgen failed with "'limits.h' file not found" because Ubuntu ships libclang.so.1 without a resource dir. Now passes BINDGEN_EXTRA_CLANG_ARGS at gcc's includes, the same fallback build-linux-compositor-addon already applied. - audio.rs / ffmpeg.rs: `[0i8; 256]` passed to av_strerror's `*mut c_char`. `c_char` is signed on x86_64 but unsigned on aarch64, so this is a hard type error there. Use `c_char`. No behaviour change on x86_64: the ffmpeg pin is additive, the two path constants resolve to their previous values, and `c_char` *is* `i8` there. Verified by building and packaging on aarch64 (Ubuntu 24.04): the deb reports `Architecture: arm64`, and the app boots and renders under Xvfb. One caveat worth flagging separately: BtbN's linuxarm64 ffmpeg ships no h264_vaapi, so `every_ladder_entry_names_a_codec_this_build_has` fails on arm64. The encoder ladder probes and falls through at runtime, and h264_nvenc / h264_v4l2m2m / libopenh264 are all present, so this is a gap in the test's assumption rather than a broken export path. Left alone here to keep this PR to the build fix.
…ookup at its source Review follow-ups on the arm64 build fix. - fetch-ffmpeg: the linux-arm64 shared entry named n8.1.2-32-gcfa62de001, a build that is not in the release RELEASE_TAG points at. Nothing conflicted — the entry is added just below the lines main had changed — so it merged clean and `npm run build:linux` died on a 404 at step one, on the only arch that reaches it. Re-pinned to n8.1.2-34-g9b6c8969e0 with the digest from that release's checksums.sha256, like its siblings. - fetch-ffmpeg.test.mjs: the guard that was missing. Asserts every pinned asset names ONE ffmpeg build, carries a full sha-256, and is an -lgpl artifact. It fails on the pin above and names the odd entry out. Reads the file as text rather than importing it, which would start a download. `scripts` joins vitest's include glob for it. - pipewire-capture/build.rs: hardcoded /usr/lib/gcc/x86_64-linux-gnu, which is the actual arm64 defect. Derived from CARGO_CFG_TARGET_ARCH instead, matched on the vendor prefix so Arch's x86_64-pc-linux-gnu also resolves while a cross-gcc for the other arch is still refused. Picks the same directory as before on x86_64. - build-linux-pipewire-helper: drops the BINDGEN_EXTRA_CLANG_ARGS wrapper. build.rs already owns that fallback and its doc comment says why — doing it in the script covers only the npm path and leaves a bare `cargo build` broken on arm64, which is the split build.rs exists to prevent. - build-linux-compositor-addon: bindgenClangArgs() filtered on stddef.h while the failure it exists to fix is 'limits.h' file not found, and took whatever readdirSync returned first. Now requires both headers and sorts, matching build.rs. A dir with stddef.h but no limits.h made it export a non-empty BINDGEN_EXTRA_CLANG_ARGS, which suppressed build.rs's own fallback and failed with the very error being fixed. - audio.rs / ffmpeg.rs: std::ffi::c_char rather than the legacy std::os::raw alias, matching encoder.rs. audio.rs's comment in French like the rest of that file.
f006525 to
4e7961c
Compare
Summary
npm run build:linuxcannot complete on an aarch64 host. This fixes four independent x86-only assumptions in the Linux build path, so the same command produces a workingarm64deb/AppImage.scripts/fetch-ffmpeg.mjsSHARED_PINNEDhas nolinux-arm64entry, so the SDK fetch bails. BtbN publishes the asset in the already-pinned release — only the pin was missing. Digest taken from that release'schecksums.sha256.scripts/build-linux-compositor-addon.mjs/usr/lib/x86_64-linux-gnuand/usr/lib/gcc/x86_64-linux-gnuare hardcoded, hiding both libclang and gcc'sstddef.hon arm64. Now derived fromprocess.arch.scripts/build-linux-pipewire-helper.mjs'limits.h' file not found— Ubuntu shipslibclang.so.1with no resource dir. Now passesBINDGEN_EXTRA_CLANG_ARGSat gcc's includes, the same fallbackbuild-linux-compositor-addon.mjsalready applies.crates/compositor/src/audio.rs,electron/native/pipewire-capture/src/ffmpeg.rs[0i8; 256]passed toav_strerror's*mut c_char.c_charis signed on x86_64 but unsigned on aarch64, so this is a hard type error there. Usesc_char.No behaviour change on x86_64: the ffmpeg pin is additive, both path constants resolve to their previous values, and
c_charisi8there.Related issue
No existing issue — found while building for an aarch64 machine.
Type of change
Release impact
Desktop impact
Screenshots / video
No visual change. The packaged arm64 build boots and renders its recorder toolbar correctly under Xvfb.
Testing
Ubuntu 24.04, aarch64 (NVIDIA GB10), Rust 1.95, Node 22.22.
Build & package —
npm run build:linuxOpenscreen-Linux-1.9.0.deb→Architecture: arm64;apt-get -s installresolves every dependency with no extras.--no-sandbox), and renders underxvfb-run.Unit —
npm test→ 1677 passed, 1 skipped, 0 failed (140 files).E2E —
npm run test:e2eunderxvfb-run→ 7 passed, 4 skipped, 0 failed. The 4 skips arewindows-native-checklist.spec.ts(test.skip(process.platform !== "win32")).Both export paths pass end-to-end on arm64:
exports an MP4 from a loaded video— softwarelibopenh264exports a GIF from a loaded video— compositor selected the hardware backend:[d3d] adaptateur Vulkan : NVIDIA GB10 (IntegratedGpu, Vulkan) -> backend HardwareThat last line is the useful one: the natively-built compositor addon negotiates a hardware Vulkan backend on arm64, not just a CPU fallback.
Static —
npx tscclean;biome checkclean on the three changed scripts.cargo testinpipewire-capture: 54 passed, 1 failed — see below.Not verified on x86_64 (no host available), though the reasoning for why each change is a no-op there is above.
Note for anyone reproducing the e2e run on Linux
npm run devaborts before serving becausenode_modules/electron/dist/chrome-sandboxisn'troot:root 4755, which takes the Vite server down with it and fails every spec onERR_CONNECTION_REFUSED.NO_ELECTRON=1 npm run devavoids it. Pre-existing and unrelated to arm64 — mentioning it only so the run is reproducible.One caveat, not fixed here
BtbN's
linuxarm64ffmpeg ships noh264_vaapi, soevery_ladder_entry_names_a_codec_this_build_hasfails on arm64. The encoder ladder probes and falls through at runtime, andh264_nvenc,h264_v4l2m2mandlibopenh264are all present — so this looks like a gap in the test's assumption rather than a broken export path. Left alone to keep this PR to the build fix; happy to follow up if you'd like the assertion made arch-aware.🤖 Generated with Claude Code
https://claude.ai/code/session_014iYUHw6DyT4CSBNyvr4zsY
Summary by CodeRabbit
Bug Fixes
New Features