Open busterbogheart opened 1 month ago
Does anyone have some pointers here?
I have confirmed that when specifying process.env.npm_config_arch
as arm64
even on an Intel machine, the app builds with the correct binary of ffmpeg.
Like
process.env.npm_config_arch=arm64 npm run make -- --arch=arm64
@erickzhao This fix above that worked above required me to hack into /core/dist/api/package.js
and set
process.env.npm_config_arch = target.arch
in a few spots. I'm not sure which one did the trick. Can someone review, verify, and possibly make a PR?
@erickzhao Hello?
Pre-flight checklist
Electron Forge version
7.4.0
Electron version
v24.1.1
Operating system
macOS 11.3.1
Last known working Electron Forge version
--
Expected behavior
Using
electron/universal
configured withosxUniversal
in forge config, we expect all dependent modules will receive the correctarch
and build themselves accordingly.Actual behavior
We are using
ffmpeg-static
in our Electron app, but when the universal build is created, only the arm64 ffmpeg binary exists. I have confirmed that theffmpeg-static
module can be rebuilt in CLI with anarch
param (npm rebuild --arch=x64 -f ffmpeg-static
and confirmed withfile node_modules/ffmpeg-static/ffmpeg
). In this case the correct binary is build/fetched. But when running the universal build with forge, onlyos.arch()
seems to be respected, which in this case is an M1 machine.It seems electron-forge isn't passing the correct arch to dependencies. If there were hooks in the universal build process, or some env vars set, I could manually rebuild this one ffmpeg module according to an arch. For example
ffmpeg-static
does obeyprocess.env.npm_config_arch
, so if I were able to set that in between the x64 and arm64 builds (or electron/universal did), the module would build the correct ffmpeg binary.I have attempted using hooks in electron-forge to try and switch based on
arch
, but that value is alwaysuniversal
. Also, building the app on separate Intel and M1 machines does produce the appropriate ffmpeg binary.Steps to reproduce
Set up a project with
electron-forge
andffmpeg-static
, then attempt a universal Mac build.Additional information
No response