Skip to content

UPX compression issue with latest NW.js on Windows #153

@ghostoy

Description

@ghostoy

When turning on UPX compression for latest NW.js (0.15.x or later), the generated exe file is corrupted and failed to run (see #142 and nwjs/nw.js#4976).

Actually, it's not necessary to compress nw.exe. Firstly, it's quite small (~1M). Most of the functions, originally in nw.exe, are now moved to nw.dll in latest versions (~80-90M). So it's better to compress nw.dll other than nw.exe. And second, once it's appended with zipped app, it can't be compressed, which is similar to zipping files twice doesn't make it smaller.

Better choice would be zipping *.dll files instead of nw.exe, which doesn't crash the exe in my test. Here is the compression results of *.dll files using UPX for reference:

$ upx --lzma -9 *.dll
                       Ultimate Packer for eXecutables
                          Copyright (C) 1996 - 2013
UPX 3.91w       Markus Oberhumer, Laszlo Molnar & John Reiser   Sep 30th 2013

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
   4470976 ->   1411264   31.57%    win64/pe     d3dcompiler_47.dll
   1005056 ->    368128   36.63%    win64/pe     ffmpeg.dll
     94208 ->     44032   46.74%    win64/pe     libEGL.dll
   2323968 ->    706560   30.40%    win64/pe     libGLESv2.dll
   3867648 ->   1213952   31.39%    win64/pe     node.dll
  87264256 ->  27682304   31.72%    win64/pe     nw.dll
    146944 ->     68608   46.69%    win64/pe     nw_elf.dll
   --------------------   ------   -----------   -----------
  99173056 ->  31494848   31.76%                 [ 7 files ]

Packed 7 files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions