Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
erichs opened this issue Nov 21, 2019 · 20 comments
Open

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

erichs opened this issue Nov 21, 2019 · 20 comments

Comments

@erichs
Copy link

erichs commented Nov 21, 2019

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
Copy link

danmo commented Jan 14, 2020

2020 here we go, facing the same thing :)

@anibaldeboni
Copy link

anibaldeboni commented Feb 20, 2020

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
Copy link

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

@godza
Copy link

godza commented Mar 2, 2020

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

@cernockyd
Copy link

Did you figure it out, guys?

@anibaldeboni
Copy link

@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
Copy link

cernockyd commented Apr 15, 2020

@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
Copy link

yanlee26 commented Apr 21, 2020

⨯ 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
Copy link

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

@cernockyd
Copy link

Did you guys upgraded electron-builder?

@satinder1208
Copy link

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
Copy link

s43 commented Oct 23, 2020

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
Copy link

satinder1208 commented Oct 23, 2020

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
Copy link

s43 commented Oct 26, 2020

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

@satinder1208
Copy link

@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
Copy link

JChristensen97 commented Mar 6, 2021

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
Copy link

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
Copy link

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
Copy link

mcrio commented Feb 12, 2022

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
Copy link

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.

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

No branches or pull requests