From f42cd8cdd1bf74dcf4cd3a195bd285fa0d5064cb Mon Sep 17 00:00:00 2001 From: bincxz <16399091+binaricat@users.noreply.github.com> Date: Tue, 3 Mar 2026 20:54:28 +0800 Subject: [PATCH] fix: prevent x64 native module rebuild on ARM64 CI runner On ubuntu-24.04-arm runners, electron-builder's post-build @electron/rebuild incorrectly tries to restore native modules to x64 architecture. The ARM64 g++ compiler doesn't support the -m64 flag, causing the build to fail. Setting npm_config_arch=arm64 ensures node-gyp correctly identifies the host architecture, preventing the erroneous x64 rebuild. --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 46d2388d2..4dfa3a2fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,6 +66,10 @@ jobs: env: CSC_IDENTITY_AUTO_DISCOVERY: ${{ matrix.name == 'macos' && 'false' || '' }} ELECTRON_BUILDER_PUBLISH: "never" + # On ARM64 runners, electron-builder's post-build @electron/rebuild incorrectly + # tries to restore native modules to x64, but the ARM g++ doesn't support -m64. + # Setting npm_config_arch ensures node-gyp uses the correct host architecture. + npm_config_arch: ${{ matrix.name == 'linux-arm64' && 'arm64' || '' }} run: npm run ${{ matrix.pack_script }} - name: Upload artifacts