From 0c21bf319357ba7d092ebb4a752837eafea23ef4 Mon Sep 17 00:00:00 2001 From: denis0001-dev Date: Sat, 17 Oct 2026 17:38:08 +0300 Subject: [PATCH] Build native ARM64 Windows installer tooling instead of reusing the x64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ARM64 installer still died with "installer has no payload for this CPU (x86_64)". Two installers, two architectures, and each needs tooling compiled for its own target. fromchat-pack embeds the app-image payload, and payload.rs selects it with std::env::consts::ARCH — the stub's own compile-time architecture, not the machine's. The stub is a Windows x64 binary, so on ARM64 it runs emulated, reports x86_64, and looks for an x86_64 payload that the ARM-only bundle never embeds. The ARM asset was therefore structurally incapable of installing. So the ARM64 leg now builds its own aarch64-pc-windows-msvc tooling on the ARM runner (cargo build --release --workspace with no --target builds for the host) instead of downloading the x64 artifact, which is now x64-only. ensureWindowsRustBinaries is existence-based and rebuilds when binaries are absent, so this leg is self-healing if the explicit build step ever misfires. The Rust cache key was also arch-blind — windows-rust-${{ runner.os }}-v3-... — so an x64 target/ directory could be restored onto the ARM runner and make the "binaries ready" check pass with the wrong architecture. It now includes ${{ runner.arch }} and is bumped to v4, so the two legs cannot share a cache. This also reverts the PROCESSOR_ARCHITEW6432 sniffing added in 35492fc: with natively compiled stubs it is unnecessary, and it would have been actively wrong — an x64 installer running emulated on ARM64 should install the x64 payload, not be redirected to the arm64 one. --- .../cache-windows-rust-tools/action.yml | 7 ++-- .github/workflows/release.yml | 40 ++++++++++++++++++- 2 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.github/actions/cache-windows-rust-tools/action.yml b/.github/actions/cache-windows-rust-tools/action.yml index 9861416..5a18bb0 100644 --- a/.github/actions/cache-windows-rust-tools/action.yml +++ b/.github/actions/cache-windows-rust-tools/action.yml @@ -16,9 +16,8 @@ runs: ~/.cargo/registry ~/.cargo/git app/desktop/windows-setup/target - key: windows-rust-${{ runner.os }}-v3-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }} + key: windows-rust-${{ runner.os }}-${{ runner.arch }}-v4-${{ hashFiles('app/desktop/windows-setup/Cargo.lock') }} restore-keys: | - windows-rust-${{ runner.os }}-v3- - windows-rust-${{ runner.os }}-v2- - windows-rust-tools-v1- + windows-rust-${{ runner.os }}-${{ runner.arch }}-v4- + windows-rust-${{ runner.os }}-${{ runner.arch }}-v3- cargo-registry-${{ runner.os }}- diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0dce4f..4ef0223 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -308,7 +308,45 @@ jobs: with: name: desktop-proguard path: app/desktop/build/prebuilt/main-release/proguard - - name: Restore Windows Rust installer tools + # Two installers, two architectures, two *natively compiled* sets of Rust tooling. + # fromchat-pack embeds the app-image payload and the stub picks it with + # std::env::consts::ARCH — which is the stub's own compile-time architecture. An x64 stub + # running emulated on ARM64 reports "x86_64" and finds no x86_64 payload in the ARM-only + # bundle: "installer has no payload for this CPU (x86_64)". So the ARM64 leg builds its own + # aarch64 tooling on the ARM runner instead of downloading the x64 artifact. + - uses: dtolnay/rust-toolchain@stable + if: matrix.arch == 'arm64' + with: + targets: aarch64-pc-windows-msvc + - uses: ./.github/actions/cache-windows-rust-tools + if: matrix.arch == 'arm64' + - name: Verify Windows ARM64 Rust binaries + if: matrix.arch == 'arm64' + id: rust-binaries-arm64 + shell: bash + run: | + ready=true + for exe in \ + FromChat-Installer.exe \ + FromChat-Installer-Helper.exe \ + fromchat-portable-launcher.exe \ + fromchat-pack.exe \ + fromchat-icon-patch.exe + do + if [[ ! -f "app/desktop/windows-setup/target/release/$exe" ]]; then + echo "Missing $exe" + ready=false + fi + done + echo "ready=$ready" >> "$GITHUB_OUTPUT" + - name: Build Windows ARM64 installer Rust tooling + if: matrix.arch == 'arm64' && steps.rust-binaries-arm64.outputs.ready != 'true' + shell: bash + run: ./gradlew :app:desktop:buildWindowsSetupRust --no-daemon --console=plain + - uses: ./.github/actions/save-windows-rust-cache + if: always() && matrix.arch == 'arm64' + - name: Restore Windows x64 Rust installer tools + if: matrix.arch == 'x64' uses: actions/download-artifact@v5 with: name: windows-rust-tools