Electron executable not recognized by Nautilus - electron

I'm not able to build an executable file of an Electron App with the following command:
electron-packager . electron-tutorial-app --overwrite --asar=true --platform=linux --arch=x64 --prune=true --out=release-builds
The build file, which is a shared library file (application/x-sharedlib), is not executing on Ubuntu 18. Instead, I'm getting the following error message when opening the file in Nautilus:
Could not display "electron-tutorial-app"
There is no application installed for "shared library" files. Do you
want to search for an application to open this file?
[No] [Yes]
Is there any way around to do this?

TL;DR: the produced files are actually executables of a new format. There's nothing wrong with them. Nautilus/file managers mistakenly don't recognize them as executables. There are solutions, such as creating a *.desktop file to launch the application.
Analysis
This phenomenon occurs as a side-effect of a change in how Electron builds Linux binaries. The commit 9294facf changed the binary format from ELF to PIE. The change is quite small and only affects a single file (BUILD.gn). The change has landed in Electron starting with version 4.0.0.
File managers utilize the file command to decide what to do with a file (e.g. open an image viewer, a text editor or execute the file). file cannot distinguish between shared libraries and PIE executables and therefore misclassifies PIE files (see the corresponding bug report).
Solutions
Run from terminal
Since the problem only exists for graphical file managers, you can simply run the executable from the terminal or from a script. This is somewhat involved for non-technical end users and not what the OP wants.
Wait for upstream fix
Wait for file to recognize PIE as executable files. In turn, this will likely lead to file managers such as Nautilus to launch the PIEs correctly. It's not clear if or when this will happen. If it happens, it will likely only be included in future distro releases.
Use a desktop file
Create a desktop file to launch the application. This is a common way desktop applications are launched anyway.
Create a file called myapp.desktop with the following contents.
[Desktop Entry]
Name=My Application
Exec=/path/to/binary
Terminal=false
Type=Application
StartupNotify=true
Encoding=UTF-8
Then, mark the desktop file executable by issuing chmod +x myapp.desktop. Double clicking the file should launch the application as expected.
Further information
The corresponding discussion in the electron-packager project: https://github.com/electron-userland/electron-packager/issues/901. (Gist: This issue was not caused by electron-packager, look upstream)
The corresponding issue in the electron project is https://github.com/electron/electron/issues/15406. (Gist: they wanted to enable PIE on Linux. Not our bug, look upstream)

For Linux(Ubuntu):
Downgrade Electron package:
npm install electron#3.1.6 --save-dev
For global (If needed)
npm install -g electron#3.1.6
Execute electron-packager command - for linux:
electron-packager . electron-tutorial-app --overwrite --asar --platform=linux --arch=all --prune=true --out=release-builds
This will result in 4 Linux folders(arch=all). Select a working executable according to your OS.

This is an issue when electron-packager is used to package a Linux app with Electron version 4.0.x, whereas there was no problem with previous Electron versions, such as 3.1.x.
For some reason, in Electron 4.0.x, the produced app file is a shared library instead of an executable.
From a Terminal window, running the file command on the app file path gives:
ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0,
BuildID[sha1]=b9e8ba37118dad1bf605affef41026f813215bc6, stripped
while it used to be:
ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically
linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32,
stripped
Fortunately, it is still possible, albeit cumbersome, to run the app by launching it from a Terminal window, for instance by dragging the app file icon onto the terminal prompt, then typing Enter.

Related

How to build Appium Desktop from source code?

I'm trying to build the "latest" version of Appium Desktop from source (on a Mac), but I'm clearly not doing something that I need to be doing, because no binary is generated after I run all the build commands.
So, I've downloaded and unpacked the .zip archive https://github.com/appium/appium-desktop/archive/v1.16.0.zip, opened up a terminal session inside the root of the source directory, and followed the online instructions for building from source--but I think this is for the server build https://appium.io/docs/en/contributing-to-appium/appium-from-source/#running-appium-from-source
npm install
npm run build
node .
And it all appears to work successfully! I get a "build completed" message and life looks fab, but nothing launches as far as an app is concerned, and I can find no .app file anywhere in the source directory. And, oddly, there are no build instructions to be found anywhere in the source directory. There's a "ReadMe.md" file but it provides no instructions on how to build from source.
Can someone please tell me what I need to do to build and launch Appium Desktop (not the server) from source? (Oh, I also ran appium-doctor and it gave me a clean bill of health.)
Any feedback would be most appreciated!
Thanks,
Wulf
You've already run npm install so it should be as simple as running npm run dev if you want it in dev mode or npm start if you want non-dev.
See the Contributing to Appium Desktop readme for more.

Hide source code from build executable in electron-app

I am trying to package and distribute my app which is written in electron. I noticed that when the binaries build is completed, the local resource/source code are also exposed in the final built folder.
In the resource/app folder, you would have all your source code revealed to anyone who can access.
I am wondering if there's anyway to hide these information, and just deliver the built binary.
I am using Electron 1.2 and electron-packager 7.0.4
Beyond mini-/uglifying your js code (can still be viewed) and creating an .asar package (can be extracted) there is not a whole lot you can do to prevent the visibility of your code.
See also this post on the electron-packager github page:
theres nothing built in to electron to do that, so we don't support
anything like that (since we only support what electron supports). you
would have to implement that in your own module and run it on your
code before using electron-packager -maxogden
If 7 years have passed but are still looking for an answer, they can use #electron/asar. When creating an application with electron packager, it creates a file with an .asar extension that will store your code if you type "--asar" on the terminal screen. For example;
electron-packager . {your exe file name} --overwrite --asar --platform=win32 --arch=x64 --icon={your icon file source} --prune=true --out=release-builds --version-string.CompanyName=CE --version-string.FileDescription=CE --version-string.ProductName="product name"

Packaging electron app using electron-packer - folders shown not existing

I am trying to package my electron app . Follwing the instruction Here. I added an object to my package.json like below
"osx-package": "node_modules/electron-packager/cli.js
./build/bin --platform=darwin --arch=x64 --version=0.34.0 --overwrite"
When i run
npm run osx-package
I received the messgage below
Packaging app for platform darwin x64 using electron v0.34.0 Wrote new
app to /...../binary-build-darwin-x64
Below is what i can see from by sublime text.
However, when i visit the folder, i can only see three files . Myapp(i.e execuatble ) , licence file and version file. I unhidden hidden files , still couldnt see my files as expected. However, the files were still shown in the directory in sublime . Clicking my app throws an error saying can't find an electron framework etc. Please what am i misssing ? How do i fix this ?
Did your try running it via the console with npm start?
After packaging the OSX app, the following files should be created:
LICENSE
LICENSES.chromium.html
MYAPP.app
version

NIST(National Institute of Standards and Technology) library for iOS

I downloaded some code which contains some source code and some txt files.
The Read me or Installation file says following,
NBIS Open Source Software Installation Guide
(For LINUX and MAC OSX)
----------------------------------------------
Step 1:
Run the following command to setup your build environment:
./setup.sh <TARGET INSTALLATION DIR> [--without-X11]
[--STDLIBS] [--without-OPENJP2] [--32 | --64]
<TARGET INSTALLATION DIR> is replaced by the specific directory path
where you want to install the NBIS applications, libraries,
pre-computed runtime data and manuals.
Option Usage :
--without-X11 Build without X11 support.
--STDLIBS Build without JASPER, OpenJP2 and PNG
image format support.
--without-OPENJP2 Build without OpenJP2 image format
support.
--32 Build on 32-bit architecture machine.
(Only applicable for LINUX build.
If you are compiling on a 64-bit
machine, please have the proper
32-bit libraries installed.)
--64 Build on 64-bit architecture machine
(Only applicable for LINUX build.)
Example:
> ./setup.sh /SRC/NBIS/Main --32
Step 2:
Run the following commands to build "NBIS":
make config
make it
Step 3:
Run the following command to install NBIS executables into the
directory:
make install LIBNBIS=[yes|no]
Step 4: (OPTIONAL)
Run the following command, if you want to generate a list of
API supported in NBIS.
make catalog
Note: If you enable the "LIBNBIS=no" option during make install,
it will create the following libraries:
liban2k.a libclapck.a libfft.a libioutil.a libmindtct.a
libnfseg.a libpcautil.a libutil.a libbozorth3.a libf2c.a
libihead.a libjpegb.a libmlp.a libopenjp2.a libpcax.a
libwsq.a libcblas.a libfet.a libimage.a libjpegl.a libnfiq.a
libpca.a libpng.a libz.a
If you enable the "LIBNBIS=yes" option during make install, it will
combine all the libraries listed above and build libnbis.a.
Can I use the library build using above in my xCode project for iOS.
Thank You,
Subhash

Pub does not download dependencies on Windows 7 after the update to lib v2 (SDK 0.3.1_r17328)

After the update to the version 0.3.1_r17328 of Dart SDK and Dart Editor I have some trouble to import some library particulary Args library. I have the same problem both directly importing Args or importing Web_ui where Args is one of the dependencies.
Here is my pubspec.yaml:
name: notes
description: A sample application
dependencies:
web_ui: 0.3.0+1
or:
name: notes
description: A sample application
dependencies:
args: 0.3.1+1
Here is the error generate from build.dart
Unable to open file: C:/Users/Fabio/Dropbox/progetti/note/packages/args/args.dart'package:web_ui/component_build.dart': Error: line 25 pos 1: library handler failed
import 'package:args/args.dart';
'file:///C:/Users/Fabio/Dropbox/progetti/note/build.dart': Error: line 1 pos 1: library handler failed
import 'package:web_ui/component_build.dart';
I solved the problem. It seems that the Cache folder (Pub) has been corrupted.
I have deleted the folder Cache: C:\Users\<UserName>\AppData\Roaming\Pub
Then i run pub install from command line and it works.
Unfortunately, I was getting the same error with my windows XP machine.
In the end, I logged into my windows 7 machine and was able to
download the packages, zipped them up and pasted the libraries into my
windows XP dart editor. Success!
I had no reason to believe I had the exact proxy issue #shindokaku had as I am using my home computer.
I tried all the suggestions on deleting the .cache files, pub.lock files and the packages folder and retrying. I uninstalled dart editor and tried again. I also tried using the git resources to download web-ui and running commands through the command line to no avail
Including suggestions in this similar questions:
cannot-find-referenced-source-packages
is-there-a-workaround-for-pub-dependency-resolution-through-proxies
This problem has been haunting me over and over for a few weeks. I am not using Windows, so this answer is not intended to help the original poster who is using Windows 7.
If you are using Linux here are the steps I use to repair corrupted pub cache.
Go to the top level directory of your app. You should see at least pubspec.lock, pubspec.yaml, a folder named packages, and a folder named web.
Delete your pubspec.lock, and packages folder.
[Make sure you aren't storing your own libraries in the packages folder]
cd ~/dart/myApp/
rm -r packages
rm pubspec.lock
Now once you have removed these files:
pub cache repair
Note 1: if your dart-sdk is not in your systems $PATH, than you will want to use the absolute path to the sdk when using the above command. Comment if you need that explained.
Note 2: This is working solution with Dart 1.5.3. I have not tested this on earlier versions.
Try deleting your pubspec.lock file and packages directory in the root folder of the project. Then run pub install again, when things get wacky thats what I do.
You should try to run pub update. I have sometimes found that this doesn't work as expected from the editor, but generally works quite smoothly when called from the command line.

Resources