NormanGhost
V2EX  ›  Electron

如何在没有 m1 情况下打包 mac ARM 平台 electron 包?

  •  
  •   NormanGhost · May 30, 2022 · 2727 views
    This topic created in 1446 days ago, the information mentioned may be changed or developed.

    我的机器:macos x86

    打包工具:electron-builder

    我的情况:项目使用到了 ffmeg ,用 @ffmpeg-installer/ffmpeg 安装 ffmpeg 。打包一般都是用 GitHub Actions ,但是 GitHub Actions 的 macos 是 x86 架构,所以只能出 x86 安装包。虽然 M1 也可以转译运行,但是总感觉不太好。

    临时解决方案:在node_modules里面找到了@ffmpeg-installer/ffmpeg的源码,直接写死 arch 字段为 arm64 ,然后手动把 ffmpeg 二进制文件替换。再 electron-builder 里面配置 target 为 arm ,这样打包出来的是 arm 版本。但是,这样每次都需要这样 hook 的操作属实有点傻吧。

    疑问:1. 大家在遇到我这种情况,项目里面有原生包,没有 m1 有想打包 macos arm 包怎么做的? 2. 有没有 m1 虚拟机服务,可以做这种事?

    1 replies    2022-05-30 14:04:59 +08:00
    Manweill
        1
    Manweill  
       May 30, 2022
    本地试过做过交叉编译得到 arm 版本,没试过 github actions 能不能做
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1141 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 23:39 · PVG 07:39 · LAX 16:39 · JFK 19:39
    ♥ Do have faith in what you're doing.