windows-installer icon indicating copy to clipboard operation
windows-installer copied to clipboard

Error: wine: Bad EXE format

Open thre-isdd opened this issue 8 years ago • 19 comments
trafficstars

[email protected] 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 avatar Jun 22 '17 09:06 thre-isdd

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

thre-isdd avatar Jun 22 '17 13:06 thre-isdd

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

iamiota avatar Jun 23 '17 06:06 iamiota

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

anaisbetts avatar Jun 23 '17 07:06 anaisbetts

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

vietquocnguyen avatar Jun 28 '17 17:06 vietquocnguyen

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

Thomas101 avatar Jun 29 '17 08:06 Thomas101

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

fredguth avatar Jul 05 '17 20:07 fredguth

@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 avatar Jul 05 '17 20:07 fredguth

@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.

robertohuertasm avatar Sep 13 '17 16:09 robertohuertasm

+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.

halfbyte avatar Sep 18 '17 15:09 halfbyte

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

fengerzh avatar Feb 28 '18 09:02 fengerzh

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.

nikolamakin avatar Dec 26 '18 08:12 nikolamakin

@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?

dfeinzeig avatar Mar 05 '19 03:03 dfeinzeig

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

davidsharp avatar Mar 14 '19 12:03 davidsharp

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!

dfeinzeig avatar Mar 14 '19 18:03 dfeinzeig

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 :/

robmro27 avatar Apr 05 '19 14:04 robmro27

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

dfeinzeig avatar Apr 05 '19 14:04 dfeinzeig

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 

robmro27 avatar Apr 05 '19 14:04 robmro27

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.

dfeinzeig avatar Apr 05 '19 15:04 dfeinzeig

@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

iCodr8 avatar Apr 25 '19 09:04 iCodr8