electron/packager

Building Linux target apps on Windows hosts does not set the correct executable permissions

grofit opened this issue · 11 comments

I apologise if this is a simple question, I rarely use Linux but wanted to add support for it as a platform.

Now I am using electron version 0.30.2 and the package generated contains all the *.so files and the main Electron file, but when I put them on linux (I installed ubuntu on a VM) it doesnt seem to know how to open the Electron file.

There seems to be very little information online around this, and I know that this library basically gets the electron files and just copies and renames them but just wanted to see if there was some common way to just run these outputs on a fresh linux install. I have seen references saying there should be an Electron.app which there isnt, and some snippets here and there mention python bootstraps but I cannot find any solid information on how to build in windows and deploy on linux anywhere... which is baffling as I assume this would be a common thing.

Any help/advice would be great

Electron.app is for OSX.

To run the app in Linux:

  1. Open up a terminal, cd to the output directory of your app.
  2. Run: ./Electron (though, I think the name of the executable should have changed to $appname.)

I tried doing this but I just get "Command not found", in reality the actual output is MyAppName not Electron but if I were to do ./MyAppName it just gives the error above.

Does MyAppName exist in the output directory?

Yeah, Here is a screenshot:

https://dl.dropboxusercontent.com/u/98595151/ShareX/EMBERSOFT1/electron-linux.jpg

It shows the folder structure as well as the contents and the call to it in the terminal (although I had to sudo for some reason to run it).

What platform did you actually run electron-packager on? IIRC, Windows eats the proper permissioning of the Linux binary which should be executable. If you do ls -l and see no x bits on MyAppName, that's your problem.

I ran it via grunt with these settings:

electron: {
    windows: {
        // Lets not care about this
    },
    linux: {
        options: {
            dir: "./app",
            name: "MyAppName",
            platform: "linux",
            arch: "all",
            asar: true,
            overwrite: true,
            version: "0.30.2",
            icon: "resources/my-app-icon.ico",
            out: "_packages/raw",
            "app-version": appPkg.version   // appPkg is just a reference to the package.json
        }
    }
},

Using windows 10, latest Grunt (as of like a week ago) and latest version of this lib. Is there a way to get windows to set the file permissions in another build step? (I assume the permissions will not cause the main issue of the MyAppName not running though will it?)

Also the ls -l outputs:

leep@leep-virtual-machine:~/Documents/MyAppName-linux-x64$ ls -l
total 93024
-rw-rw-r-- 1 leep leep  9442207 Aug 10  2015 content_shell.pak
-rw-rw-r-- 1 leep leep 10207504 Aug 10  2015 icudtl.dat
-rw-rw-r-- 1 leep leep  2554248 Aug 10  2015 libffmpegsumo.so
-rw-rw-r-- 1 leep leep   520152 Aug 10  2015 libgcrypt.so.11
-rw-rw-r-- 1 leep leep 16237312 Aug 10  2015 libnode.so
-rw-rw-r-- 1 leep leep    31256 Aug 10  2015 libnotify.so.4
-rw-rw-r-- 1 leep leep     1055 Aug 10  2015 LICENSE
drwxrwxr-x 2 leep leep     4096 Aug 10  2015 locales
-rw-rw-r-- 1 leep leep 55240416 Aug 10  2015 MyAppName
-rw-rw-r-- 1 leep leep   410937 Aug 10  2015 natives_blob.bin
drwxrwxr-x 2 leep leep     4096 Aug 10  2015 resources
-rw-rw-r-- 1 leep leep   569580 Aug 10  2015 snapshot_blob.bin
-rw-rw-r-- 1 leep leep        7 Aug 10  2015 version

HUZZAH! ok so if I right click there is a check box "Allow Running As Executable", clicked that and boom runs like it should do.

So I guess the next question is as briefly mentioned above, is there a way to preset these permissions?

You might have to build your app inside a Linux VM to do so. (You can build Electron-based apps for all platforms on Linux.)

Yeah, I just didnt want to have to start hopping between O/S to build stuff, although I heard somewhere that I would need to do that for Mac OS anyway, as apparently you can only sign stuff with XCode.

Any update of this?

I don't know how to fix this on Windows hosts. This would be a good bug for someone in the community to research and see if a fix is even possible (hence the help wanted label).