electron / universal

Create Universal macOS applications from two x64 and arm64 Electron applications
MIT License
112 stars 43 forks source link

ffmpeg module does not rebuild according to `arch` #106

Open busterbogheart opened 1 month ago

busterbogheart commented 1 month ago

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 the ffmpeg-static module can be rebuilt with an arch param (npm rebuild --arch=arm64 -f ffmpeg-static, then confirmed with file node_modules/ffmpeg-static/ffmpeg) and the correct binary is created/downloaded. But when running the universal build, only os.arch() seems to be respected (which is an M1 machine in CircleCI).

If there were hooks in the universal build process, or some env vars set, I could manually rebuild this one module according to an arch. For example this ffmpeg module does read process.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.

busterbogheart commented 3 weeks ago

It seems like there is just one step missing in the middle here, but I can't seem to find it. Does anyone have a clue?

busterbogheart commented 3 days ago

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

This seems like a simple enough feature request; to set npm_config_arch at the appropriate time in the electron/universal build process.