Single file executable instead of 'dual file' executable #565

Closed
cGuille opened this Issue Mar 24, 2013 · 13 comments

10 participants

@cGuille

Hello!

Working on GNU/Linux, I followed the steps explained in the wiki in order to package my app.

I eventually understood that the executable produced had to be in the same directory as the nw.pak file you provide.
I was wondering if there was a solution to get over this restriction since it might be easier to use.

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@dubcanada

You don't need to have them in the same folder, you can just copy from two different areas...

copy /b C:\nw.exe+D:\app.nw D:\app.exe

For example.

@cGuille

Thank you for your attention.

I'm not talking about nw/nw.exe. I'm talking about nw.pak, which has to be in the same directory as app.exe when you run your packaged application.
If nw.pak is missing next to my executable, I get the following error:

util.js:537
  ctor.super_ = superCtor;
              ^
TypeError: Cannot set property 'super_' of undefined
    at Object.exports.inherits (util.js:537:15)
    at Function.startup.initNw (node.js:503:34)
    at startup (node.js:63:13)
    at node.js:583:3

PS: here is the script I use to build my app:

#!/usr/bin/env sh

cd app &&
zip -r ../app.nw * &&
cd .. &&
cat node-webkit-v0.4.2-linux-x64/nw app.nw > pdf-merge &&
chmod +x pdf-merge && 
rm app.nw
@kevsmt

+1 if possible

@Mithgol

Node-webkit already supports attaching some zipped application to the tail of the main binary.

Could it also support adding the rest of the necessary files (such as nw.pak, icudt.dll, ffmpegsumo.dll, libEGL.dll, libGLESv2.dll, D3DCompiler_43.dll, d3dx9_43.dll, libffmpeg.so) to the same tail-attached zip file where necessary? (Which seems like the only way to make the resulting executable really a single file.)

It would essentially mean additionally looking at the unpack path when these assets are missing at the application's path. (Maybe not directly at the unpack path, but in a subdirectory with some name /assets/ like the existing /plugins/ and /node_modules/.)

I also agree that making the most necessary files (nw.pak on Linux, nw.pak and icudt.dll on Windows) an integral part of the main binary would be an improvement (to reduce the chance they are missing). The application won't run without them anyway, or so it seems.

@Subash

@Mithgol, +1 for your idea. I think all files should be merged together in a single executable.

@BrentNoorda

Another +1 : We went through a similar process (javascript server creating standalone executables delivered via html) 20 years ago, and our users went through a lot of installation and versioning headaches until we finally bundled everything within a single executable (at the tail, of course). That was a major relief from headaches.

@cGuille

Hello again.

Glad to see I'm not the only one interested.

I just wanted to disambiguate something: I was not talking about the shared libraries (e.g. .dll on Windows) that others are talking about.
I don't think they may/can be bundled within the NW executable since they are shared libraries: they may be shared with others programs or their licence may not let us bundle it into the main executable.
IMO it is our responsibility to make an installer (for instance with something like Inno Setup on Windows or with .deb packages on Debian based distributions etc.) that installs the dependencies (if necessary) and our executable in the right place.

What I was talking about is the nw.pak file, which seems to be part of the Node Webkit system (I just supposed that because of its name). If it is part of Node Webkit and if it is absolutely necessary in any case, why is it not bundled with the rest of the runtime?

@Mithgol

That's a good objection. I've never thought about it, but packing D3DCompiler_43.dll and d3dx9_43.dll and distributing them with your application could actually be illegal in some jurisdictions because of the license that governs DirectX. (The rest of the above mentioned libraries are probably fine, because they're free software unless I'm missing something about them.)

@cGuille

Free software does not mean that you can do anything you want. For instance, you cannot bundle a (L)GPL library into a non free executable.

Anyway, those libraries are not part of NW so they must not be within it. But what about nw.pak? I don't even know what it is, but I guess it is related to the manifest parsing. If so, since the manifest is required, this file should be part of the bundle (imo).

@trevorlinton

I've implemented a fix to store nw.pak/dll's/etc all into the zip file. However this required a small bit of refactoring to the self extractor and may not be the best approach. Also, probably doesn't work on linux (I don't have a build for it).

trevorlinton@4b32a92

@opatry opatry referenced this issue in bianchimro/markgiu Jul 3, 2013
Closed

Application fails at startup #2

@rogerwang
nwjs member

Chromium upstream doesn't support put everything in a single executable file.

@rogerwang rogerwang closed this Apr 25, 2016
@fritx

da*n

@2596136372

我下载的nw压缩包解压以后并没有发现nw.pak这个文件,谁知道这是怎么回事吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment