Skip to content

Commit 596681a

Browse files
janvanhuffelclaude
andcommitted
fix(windows): keep arm64 binaries in the ARM64 NSIS installer payload
7-Zip 24 (bundled by app-builder-lib) auto-applies its ARM64 branch filter to arm64 PE files. NSIS 3.0.4.1's nsis7z extractor cannot decode that filter and silently skips those entries, so the ARM64 installer exits 0 but installs no Orca.exe, Electron DLLs, CLI, agent hook, ConPTY or rg. Force the BCJ2 filter for ARM64 Windows packages from the builder config so local builds, CI packaging and --prepackaged rebuilds all get it. x64 packaging is unchanged. Verified on a Windows 11 ARM64 laptop: before, 22 arm64 exe/dll files were missing after a silent install; after, all 6688 files install and every Orca process runs native (IsWow64Process2 machine aa64). Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent ae4921b commit 596681a

3 files changed

Lines changed: 23 additions & 0 deletions

File tree

‎config/electron-builder.config.cjs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,14 @@ const {
7171
const { signWindowsUninstallerViaSignPath } = require('./scripts/windows-uninstaller-signing.cjs')
7272
const { buildMacShipItScheduling } = require('./scripts/macos-shipit-scheduling.cjs')
7373
const {
74+
applyWindowsInstallerArchiveFilter,
7475
createWindowsArchitectureResources,
7576
getWindowsInstallerArtifactName,
7677
getWindowsUpdateChannelPublishOptions
7778
} = require('./windows-package-architecture.cjs')
7879

80+
applyWindowsInstallerArchiveFilter()
81+
7982
// Dev channels need release bundle ID/signature/notarization so Squirrel.Mac accepts updates and macOS retains app identity.
8083
const isMacHourly = process.env.ORCA_MAC_HOURLY === '1'
8184
const isMacDaily = process.env.ORCA_MAC_DAILY === '1'

‎config/scripts/windows-package-architecture.test.mjs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88

99
const require = createRequire(import.meta.url)
1010
const {
11+
applyWindowsInstallerArchiveFilter,
1112
createWindowsArchitectureResources,
1213
getWindowsInstallerArtifactName,
1314
getWindowsUpdateChannelPublishOptions
@@ -51,4 +52,14 @@ describe('Windows package architecture resources', () => {
5152
expect(findInstallerAssetName('win32', [installer], 'arm64')).toBe(installer)
5253
expect(findInstallerAssetName('win32', [installer], 'x64')).toBeNull()
5354
})
55+
56+
it('keeps arm64 binaries decodable by the NSIS installer extractor', () => {
57+
const arm64Env = { ORCA_WINDOWS_ARM64_BUILD: '1' }
58+
applyWindowsInstallerArchiveFilter(arm64Env)
59+
expect(arm64Env.ELECTRON_BUILDER_7Z_FILTER).toBe('BCJ2')
60+
61+
const x64Env = {}
62+
applyWindowsInstallerArchiveFilter(x64Env)
63+
expect(x64Env.ELECTRON_BUILDER_7Z_FILTER).toBeUndefined()
64+
})
5465
})

‎config/windows-package-architecture.cjs‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@ function getWindowsUpdateChannelPublishOptions(env = process.env) {
5050
return isWindowsArm64Build(env) ? { channel: 'latest-arm64' } : {}
5151
}
5252

53+
// Why: 7-Zip 24 auto-applies its ARM64 filter to arm64 PE files, which NSIS 3.0.4.1's nsis7z
54+
// cannot decode; the installer then silently skips Orca.exe and every arm64 DLL.
55+
function applyWindowsInstallerArchiveFilter(env = process.env) {
56+
if (isWindowsArm64Build(env) && !env.ELECTRON_BUILDER_7Z_FILTER) {
57+
env.ELECTRON_BUILDER_7Z_FILTER = 'BCJ2'
58+
}
59+
}
60+
5361
module.exports = {
62+
applyWindowsInstallerArchiveFilter,
5463
WINDOWS_ARM64_BUILD_ENV,
5564
createWindowsArchitectureResources,
5665
getWindowsInstallerArtifactName,

0 commit comments

Comments
 (0)