Skip to content

Fix Intel Mac binary not found: afterPack copies wrong arch binaries in cross-arch builds#73

Draft
Copilot wants to merge 2 commits intomainfrom
copilot/fix-recent-issue
Draft

Fix Intel Mac binary not found: afterPack copies wrong arch binaries in cross-arch builds#73
Copilot wants to merge 2 commits intomainfrom
copilot/fix-recent-issue

Conversation

Copy link
Copy Markdown

Copilot AI commented Apr 12, 2026

When building both x64 and arm64 targets on an ARM64 Mac, the afterPack hook used the build machine's arch instead of the target arch, causing the x64 (Intel) app bundle to receive osx-arm64 binaries at the wrong path — leaving osx-x86/scrcpy/adb absent and crashing on launch.

Changes

  • scripts/build_optimize.cjs: Replace common.platformArch() with a new archFromContext() helper that maps electron-builder's context.arch enum to the directory naming convention used in electron/resources/extra/:
// electron-builder Arch enum values
const ARCH_X64 = 1;
const ARCH_ARM64 = 3;

const archFromContext = (contextArch) => {
    switch (contextArch) {
        case ARCH_X64:   return "x86";   // osx-x86, win-x86, linux-x86
        case ARCH_ARM64: return "arm64"; // osx-arm64, linux-arm64
        default:         return common.platformArch();
    }
};

afterPack now resolves the correct source directory per target arch, so an ARM64 machine building both slices copies osx-x86 into the x64 bundle and osx-arm64 into the arm64 bundle as intended.

… Mac binary not found

Agent-Logs-Url: https://github.com/modstart-lib/linkandroid/sessions/8a7ddead-8b22-4a7d-aedc-a0f4445d22c6

Co-authored-by: modstart <78841409+modstart@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix recent issue reported by users Fix Intel Mac binary not found: afterPack copies wrong arch binaries in cross-arch builds Apr 12, 2026
Copilot AI requested a review from modstart April 12, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants