electron / windows-installer

Build Windows Installers for Electron apps
MIT License
1.58k stars 262 forks source link

Error: wine: Bad EXE format #186

Open thre-isdd opened 7 years ago

thre-isdd commented 7 years ago

electron-winstaller@2.6.3 windows 10, 64-bit.

Cant build setup.exe with error:

Failed with exit code: 4294967295 Output: System.AggregateException: One or more errors occurred. ---> System.Exception: 7-Zip [64] 16.04 : Copyright (c) 1999-2016 Igor Pavlov : 2016-10-04

Then I decided to get squirrel logs with set DEBUG=electron-windows-installer And got these messages from node_modules\electron-winstaller\vendor\SquirrelSetup.log:

Utility: Failed to extract file /var/folders/sj/rrk8jvvj74j_mmjgcw505h5w0000gn/T/ei-11755-93846-r5wfhu.s4dlf5stt9/myapp.1.0.0.nupkg to /Users/kevin/.local/share/SquirrelTemp/tempa err:process:create_process 64-bit application L"Z:\Users\kevin\github\windows-installer\vendor\7z.exe" not supported in 32-bit prefix wine: Bad EXE format for Z:\Users\kevin\github\windows-installer\vendor\7z.exe.

Could anyone explain what happened?

thre-isdd commented 7 years ago

Its appeared, that building installer under debian 8 gives similar result:

Failed with exit code: 255 Output: System.AggregateException: One or more errors occurred. ---> System.Exception: err:process:create_process 64-bit application L"Z:\home\buildadmin\buildAgent\work\c7b333e02a3535f1\node_modules\electron-winstaller\vendor\7z.exe" not supported in 32-bit prefix wine: Bad EXE format for Z:\home\buildadmin\buildAgent\work\c7b333e02a3535f1\node_modules\electron-winstaller\vendor\7z.exe.

I even tired to change x64 to ia32 while packaging app, but got the same result

mono 5.0.1.1 wine 2.0.1

iamiota commented 7 years ago

OS X mono 5.0.1.1 wine 2.10

I get error when wine is 32:

System.AggregateException: One or more errors occurred. ---> System.Exception: err:process:create_process 64-bit application L"Z:\Users\baize\Work\agent\client\node_modules\electron-winstaller\vendor\7z.exe" not supported in 32-bit prefix

if I use 64 wine build is ok, but on first install i get error: squirrel.exe 0xc000007b

anaisbetts commented 7 years ago

Yep, the version of 7-Zip included is 64-bit, you'll need to switch to 64-bit Wine instead.

vietquocnguyen commented 7 years ago

@paulcbetts I installed wine with 64 bit support. How do I actually switch to 64-bit Wine?

Thomas101 commented 7 years ago

@paulcbetts could this be the root cause of #184 or does it only apply when using wine?

fredguth commented 7 years ago

I am also with this error. How to switch to 64-bit wine?

fredguth commented 7 years ago

@thre-isdd This is not a solution, but here how I managed to make it work.

  1. downloaded 7-zip 32bit at http://www.7-zip.org/a/7z1604.exe
  2. installed it via wine
  3. copied .exe and .dll from .wine/drive_c/Program Files/7-Zip to electron-winstaller/vendor
robertohuertasm commented 7 years ago

@paulcbetts , is there any reason why the 7z.exe is in 64 bit format? I guess that the 32 bit version would also work in x64 machines and would not suppose a problem when building 32 bits applications.

halfbyte commented 7 years ago

+1 on @robertohuertasm's question. The problem with assuming 64 bit is that 64bit support in Wine is officially sketchy, see their FAQ

Probably 64bit 7z.exe is an artifact of a recent SquirrelWin update? Only reason I could think of is that maybe 7z 32 bit has issues with very large files (the magical 2GB barrier)?

Anyway, if at all possible, I would vote for a downgrade to 32 bit 7z.exe.

fengerzh commented 6 years ago

@fredguth, I have to use your way to solve the problem.

nikolamakin commented 5 years ago

me too.

electron-packager . exe --platform win32 --arch x64 --out dist/

Packaging app for platform win32 x64 using electron v4.0.0 WARNING: Found 'electron' but not as a devDependency, pruning anyway rcedit.exe failed with exit code 193. wine: Bad EXE format for Z:\usr\local\lib\node_modules\electron-packager\node_modules\rcedit\bin\rcedit.exe.

dfeinzeig commented 5 years ago

@thre-isdd This is not a solution, but here how I managed to make it work.

  1. downloaded 7-zip 32bit at http://www.7-zip.org/a/7z1604.exe
  2. installed it via wine
  3. copied .exe and .dll from .wine/drive_c/Program Files/7-Zip to electron-winstaller/vendor

@fredguth , this is a dumb question as I don't typically use wine. can you explain step 2? how do i install that via wine?

davidsharp commented 5 years ago

@dfeinzeig, the exe in the link is the installer, you should just need to run it in wine and go through the installation wizard

dfeinzeig commented 5 years ago

thanks @davidsharp . couldn't run the installer on WSL so I just ran it in windows and grabbed the exe and dll. all works now. thanks!

robmro27 commented 5 years ago

Using wine64 is not solution, as packaging under Linux not work than https://github.com/electron-userland/electron-packager/issues/519, I need use wine32 to pack app, and now I cant make installer because I have wine32 :/

dfeinzeig commented 5 years ago

@robmro27 what issue are you having? i was able to get the whole build working with wine32.

robmro27 commented 5 years ago

I mean I use wine x32 so I can't use 7z x64 as I understand above posts, for me wine x32 works as well while packaging, but I needed also get x32 version of 7z to make installer, so I just mean we cant use wine x64 probably to make installer because than packaging not work under linux.

And error while make installer with 7z x64

System.AggregateException: One or more errors occurred. (0009:err:process:create_process L"Z:\\home\\robert\\projects\\ts\\angular\\node_modules\\electron-installer-windows\\vendor\\squirrel\\7z.exe" not supported on this installation (x86_64 binary)
wine: Bad EXE format for Z:\home\robert\projects\ts\angular\node_modules\electron-installer-windows\vendor\squirrel\7z.exe.) ---> System.Exception: 0009:err:process:create_process L"Z:\\home\\robert\\projects\\ts\\angular\\node_modules\\electron-installer-windows\\vendor\\squirrel\\7z.exe" not supported on this installation (x86_64 binary)
wine: Bad EXE format for Z:\home\robert\projects\ts\angular\node_modules\electron-installer-windows\vendor\squirrel\7z.exe.
  at Squirrel.Utility.CreateZipFromDirectory (System.String zipFilePath, System.String inFolder) [0x00119] in <4a7c1713912342669b34f9db87354d63>:0 
dfeinzeig commented 5 years ago

ah, yes :) i agree, i could not get wine64 to work. wine32 and swapping out 7z with the 32-bit version worked for me per the above suggestions.

iCodr8 commented 5 years ago

@thre-isdd This is not a solution, but here how I managed to make it work.

  1. downloaded 7-zip 32bit at http://www.7-zip.org/a/7z1604.exe
  2. installed it via wine
  3. copied .exe and .dll from .wine/drive_c/Program Files/7-Zip to electron-winstaller/vendor

@fredguth , this is a dumb question as I don't typically use wine. can you explain step 2? how do i install that via wine?

I didn't get it to work with the wine installation, but I have installed the 7-Zip.exe on a windows computer and moved the relevant files (7z.exe 7z.dll) to the project. After that I have copied them to the build process electron-winstaller/vendor directory.

This is my build config:

deploy:desktop:win:
  stage: deploy
  image: electronuserland/builder:wine-mono
  before_script:
  - apt-get update -yqq
  - apt-get install -yqq zip git
  # NPM
  - npm install
  # Fix 7z
  - chmod -R 777 ~/.wine
  - cp ./resources/electron/vendor/7-zip/7z.exe ./node_modules/electron-winstaller/vendor/
  - cp ./resources/electron/vendor/7-zip/7z.dll ./node_modules/electron-winstaller/vendor/
  script:
  - npm run build-win
  - npm run create-installer-win