Nativefier: Packaging for windows fails under some Linuxes and our Docker image, due to rcedit.exe format incompatible with wine

Created on 25 May 2017  Â·  6Comments  Â·  Source: jiahaog/nativefier

Description

Error: rcedit.exe failed with exit code 193. wine: Bad EXE format for Z:\usr\lib\node_modules\nativefier\node_modules\rcedit\bin\rcedit.exe.

Steps to Reproduce Issue

nativefier --arch 'x64' --platform "windows" --name "MyName" "https://www.mysite.com"

Specifications

  • nativefier --version 7.3.1
  • Version of Node.js (run $ node --version): v6.10.2
  • OS: centos 7
  • Architecture X64
  • Stack trace from the error message (if any)
packaging [========================================          ] 80%
Packaging app for platform win32 x64 using electron v1.6.6
Error: rcedit.exe failed with exit code 193. wine:
    Bad EXE format for Z:\usr\lib\node_modules\nativefier\node_modules\rcedit\bin\rcedit.exe.
    at ChildProcess.<anonymous> (/usr/lib/node_modules/nativefier/node_modules/rcedit/lib/rcedit.js:68:16)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:886:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Pipe._handle.close [as _onclose] (net.js:501:12)
bug windows

Most helpful comment

would be als great to get this working for the Dockerimage, see #311

All 6 comments

Hey @dipenpatel235, thanks for the feedback! I haven't tried on centos, but that looks clear and reproducible. As a workaround, nativefying for windows under windows should work (if you have a windows machine, of course), and maybe the issue isn't here with other Linux distributions (that's a maybe, I didn't look into it, if you do please share your learnings).

Note to self or whoever works on this: look at https://github.com/electron/node-rcedit/issues/22 and https://github.com/electron-userland/electron-builder/issues/1062 .

Ok... I have asked that to electron also.
And they said it is not implemented rcedit.exe for 64 bit.
So use wine32 in your 64 bit system and it will work.

I did that and it worked fine.

Thanks.

use wine32 in your 64 bit system and it will work. I did that and it worked fine.

@dipenpatel235 great! Can you be a little more precise about how you were able to "use wine32 in your 64bit system"?

would be als great to get this working for the Dockerimage, see #311

Quoting some discussion with @Fmstrat at https://github.com/jiahaog/nativefier/issues/487,

"When building Windows EXEs on Linux hosts, icons are not supported" is slightly incorrect. Here's what I just tested with Nativefier 6fb3b92eb82bec77ff96075b28e5e93987e32b9f, Ubuntu 16.04.3, Wine 2.21:

  • nativefier --arch 'x64' --platform "windows" --name "googwin" "https://www.google.ca/"
    → Worked, produced an app that worked under Windows 10 with the inferred Google icon.
  • nativefier --arch 'x64' --platform "windows" --name "googwin" --icon /opt/icon-someicon.png "https://www.google.ca/"
    → Worked, produced an app that worked under Windows 10 with my custom icon.

The remaining, reproduced problem is that rcedit indeed fails under some Linuxes, as documented in #375. Until we properly fix the issue, and given nobody reads READMEs –and it's alright–, the best "documentation" for that would be to catch the Bad EXE format exception currently thrown, and instead cleanly abort with a mention of your workaround. Using your example, it could look like this (proposal after the blank line):

Downloading tmp-1-0-electron-v1.6.6-win32-x64.zip
[========================>] 100.0% of 52.42 MB (9.53 MB/s)
Packaging app for platform win32 x64 using electron v1.6.6
wine: configuration in '/home/node/.wine' has been updated.
wine: Bad EXE format

Error: setting Windows icon failed due to format incompatibility between wine and rcedit.
This is a known issue, see https://github.com/jiahaog/nativefier/issues/375
Workaround 1: install the 32bit version of Wine.
Workaround 2: grab the latest compiled rcedit from https://github.com/electron/rcedit/releases
and, on a Windows host, run: rcedit-x64.exe YourExe.exe --set-icon icon.ico
Sorry for the inconvenience, help welcome on the known issue :)

~And regarding Docker: yeah, given we do control the full stack in our Dockerfile, we c/should do a better job especially in this version, it's just the current Dockerfile was probably never tested on this use case. We should use a distribution/wine/rcedit that we know will work. Help welcome here~ EDIT: done, see PR below.

PR much welcome for something along those lines 🙂.

https://github.com/jiahaog/nativefier/pull/488 should address this in Docker. Still not resolved out of Docker, PR welcome maybe around something like https://github.com/jiahaog/nativefier/issues/375#issuecomment-344993335

Was this page helpful?
0 / 5 - 0 ratings

Related issues

desimaniac picture desimaniac  Â·  4Comments

raulcraveiro picture raulcraveiro  Â·  4Comments

luco picture luco  Â·  4Comments

simonweil picture simonweil  Â·  5Comments

codekandis picture codekandis  Â·  4Comments