electron-userland / electron-builder-binaries

172 stars 60 forks source link

Error: Bad CPU type in executable building Windows on MacOS Catalina #30

Open erichs opened 4 years ago

erichs commented 4 years ago

It appears that MacOS Catalina no longer supports any 32-bit compatible binaries. Attempting to build for the win32 platform on MacOS Catalina produces an error of the form:

• packaging       platform=win32 arch=x64 electron=5.0.1 appOutDir=dist/win-unpacked
  • downloading               parts=8 size=62 MB url=https://github.com/electron/electron/releases/download/v5.0.1/electron-v5.0.1-win32-x64.zip
  • downloaded                duration=4.605s url=https://github.com/electron/electron/releases/download/v5.0.1/electron-v5.0.1-win32-x64.zip
  • downloading               parts=1 size=5.6 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.4.0/winCodeSign-2.4.0.7z
  • downloaded                duration=1.121s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.4.0/winCodeSign-2.4.0.7z
  • downloading               parts=4 size=26 MB url=https://github.com/electron-userland/electron-builder-binaries/releases/download/wine-2.0.3-mac-10.13/wine-2.0.3-mac-10.13.7z
  • downloaded                duration=2.325s url=https://github.com/electron-userland/electron-builder-binaries/releases/download/wine-2.0.3-mac-10.13/wine-2.0.3-mac-10.13.7z
  ⨯ error: fork/exec /Users/erichs/Library/Caches/electron-builder/wine/wine-2.0.3-mac-10.13/bin/wine: bad CPU type in executable

I'm not sure if this issue belongs here or in the Electron-Builder project, but felt it was worth reporting.

danmo commented 4 years ago

2020 here we go, facing the same thing :)

anibaldeboni commented 4 years ago

I' m trying to build for Win x64 and getting the same error

• electron-builder version=20.44.4
  • loaded configuration file=package.json ("build" field)
  • writing effective config file=builder/builder-effective-config.yaml
  • no native production dependencies
  • packaging       platform=win32 arch=x64 electron=2.0.18 appOutDir=builder/win-unpacked
  ⨯ error: fork/exec /Users/anibal/Library/Caches/electron-builder/wine/wine-2.0.3-mac-10.13/bin/wine: bad CPU type in executable
WesUnwin commented 4 years ago

Upgraded from Mojave to Catalina today, and also got this. There has got to be some quick fix?

godza commented 4 years ago

Same thing here. Upgraded to Catalina and getting the same error

cernockyd commented 4 years ago

Did you figure it out, guys?

anibaldeboni commented 4 years ago

@dalibor-123 From what I found. Catalina dropped all support for 32 bits libs. Wine has a 64 bits version but even this one depends on 32 bit libs, so we won't be able to run it on Catalina. Didn't found any workround.

cernockyd commented 4 years ago

@anibaldeboni Hello, thank you very much for your reply. I already found some issue (I don't have it at hand right now) about the same problem and it led to new electron-builder version so upgrading electron-builder to latest version fixed the problem for me 😄.

yanlee26 commented 4 years ago

⨯ error: fork/exec /Users/xxx/Library/Caches/electron-builder/wine/wine-2.0.3-mac-10.13/bin/wine: bad CPU type in executable

jiyarong commented 4 years ago

same error here, Catalina is the worst version of macos, tons of bugs

cernockyd commented 4 years ago

Did you guys upgraded electron-builder?

satinder1208 commented 3 years ago

Started facing same issue, any clue please?

error: fork/exec /Users/user1/Library/Caches/electron-builder/wine/wine-2.0.3-mac-10.13/bin/wine: bad CPU type in executable

s43 commented 3 years ago

This happened to me today, while trying to maintain an electron app, everything goes well except when I try to generate the windows package, BOOM !

I guess Catalina stopped supporting 32, and electron-builder is using it and gives no other options to switch to wine64.

POF :

  1. Install wine-stable with Homebrew if you don't have it on your mac
  2. run a simple wine command

This will give you the exact error as Electron builder bad CPU type in executable.

The command wine64 works like a charm tho

Still digging to find a solution for this issue and will post it here, if anyone has figured it out, it will be a great thing to see a solution.

satinder1208 commented 3 years ago

I solved this after a long struggle of couple of days on my MacOs Catalina.

This suggestion guided me to the way.

Steps for me were little different...

  1. Installed electron-builder as local devDependency inside my project folder.

  2. Installed rcedit inside my project folder as local module. (Earlier it was using global one from Library). The difference in the two was rcedit64.exe. The global which was installed automatically by electron builder didn't had rcedit64.exe, but when I installed as local module it was there.

  3. Second important step was inside

    /node_modules/rcedit/lib/rcedit.js

around line number 40 I changed rcedit = process.arch === 'x64' ? 'wine64' : 'wine' to rcedit = process.arch === 'x64' ? 'wine64' : 'wine64'

Now it works perfectly. However one issue introduced after that, which is.. earlier I was preparing mac and windows build in one go by having both configs in my build.json, but now both together doesn't work and gives same error, however if I remove one of them then other works. So I prepare build one by one for windows and mac.

Hope this helps. Thanks

s43 commented 3 years ago

@satinder1208 I confirm your solution works like a charm! grateful and thankful for the approach you've come with.

satinder1208 commented 3 years ago

@satinder1208 I confirm your solution works like a charm! grateful and thankful for the approach you've come with.

Glad to hear that. Thanks

JChristensen97 commented 3 years ago

I solved this after a long struggle of couple of days on my MacOs Catalina.

This suggestion guided me to the way.

Steps for me were little different...

  1. Installed electron-builder as local devDependency inside my project folder.
  2. Installed rcedit inside my project folder as local module. (Earlier it was using global one from Library). The difference in the two was rcedit64.exe. The global which was installed automatically by electron builder didn't had rcedit64.exe, but when I installed as local module it was there.
  3. Second important step was inside /node_modules/rcedit/lib/rcedit.js

around line number 40 I changed rcedit = process.arch === 'x64' ? 'wine64' : 'wine' to rcedit = process.arch === 'x64' ? 'wine64' : 'wine64'

Now it works perfectly. However one issue introduced after that, which is.. earlier I was preparing mac and windows build in one go by having both configs in my build.json, but now both together doesn't work and gives same error, however if I remove one of them then other works. So I prepare build one by one for windows and mac.

Hope this helps. Thanks

My rcedit.js looks different. On line 9, my file has the following

const rceditExe = process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit.exe' const rcedit = path.resolve(__dirname, '..', 'bin', rceditExe)

Any idea what I should change this too? I've tried the following variations

const rceditExe = process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit-x64.exe' const rceditExe = process.arch === 'x64' ? 'rcedit.exe' : 'rcedit.exe' const rceditExe = process.arch === 'x64' ? 'wine64' : 'wine64'

All of these variants are still throwing the same error upon packaging. bad CPU type in executable

JChristensen97 commented 3 years ago

I solved this after a long struggle of couple of days on my MacOs Catalina. This suggestion guided me to the way. Steps for me were little different...

  1. Installed electron-builder as local devDependency inside my project folder.
  2. Installed rcedit inside my project folder as local module. (Earlier it was using global one from Library). The difference in the two was rcedit64.exe. The global which was installed automatically by electron builder didn't had rcedit64.exe, but when I installed as local module it was there.
  3. Second important step was inside /node_modules/rcedit/lib/rcedit.js

around line number 40 I changed rcedit = process.arch === 'x64' ? 'wine64' : 'wine' to rcedit = process.arch === 'x64' ? 'wine64' : 'wine64' Now it works perfectly. However one issue introduced after that, which is.. earlier I was preparing mac and windows build in one go by having both configs in my build.json, but now both together doesn't work and gives same error, however if I remove one of them then other works. So I prepare build one by one for windows and mac. Hope this helps. Thanks

My rcedit.js looks different. On line 9, my file has the following

const rceditExe = process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit.exe' const rcedit = path.resolve(__dirname, '..', 'bin', rceditExe)

Any idea what I should change this too? I've tried the following variations

const rceditExe = process.arch === 'x64' ? 'rcedit-x64.exe' : 'rcedit-x64.exe' const rceditExe = process.arch === 'x64' ? 'rcedit.exe' : 'rcedit.exe' const rceditExe = process.arch === 'x64' ? 'wine64' : 'wine64'

All of these variants are still throwing the same error upon packaging. bad CPU type in executable

The issue is resolved now. I just had to upgrade electron-builder to 22.2.0

iAbhinav commented 3 years ago

I updated electron and electron-builder to their latest versions

"electron": "^13.1.6", "electron-builder": "^22.11.7"

and used v14 of node

mcrio commented 2 years ago

For those still having this issue and not being able to upgrade electron-builder and it's dependencies, one workaround would be using the docker build approach: https://www.electron.build/multi-platform-build.html#docker

voidrender commented 2 years ago

I updated to the latest electron-builder but I was still running into this issue. The fix for me was to install Rosetta 2 on my M1 Mac.