Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Electron Build Steps (Linux)


May 25, 2021 Electron


Table of contents


Follow the instructions below to build Electron on Linux .

Prerequisites

  • Python 2.7.x. Some distributions such as CentOS still use Python 2.6.x, so you may need to check your Python version python -V .
  • Node.js v0.12.x. T here are many ways to install Node. You can .js the original file from the Node database and compile it . . . you can also install node . . . as a standard user in the home directory, or try using nodeSource .
  • Clang 3.4 or the updated version.
  • GTK plus development header files and libnotify.

At Ubuntu, install the following library:

$ sudo apt-get install build-essential clang libdbus-1-dev libgtk2.0-dev \
                       libnotify-dev libgnome-keyring-dev libgconf2-dev \
                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \
                       libxss1 libnss3-dev gcc-multilib g++-multilib

At Fedora, install the following library:

$ sudo yum install clang dbus-devel gtk2-devel libnotify-devel libgnome-keyring-devel \
                   xorg-x11-server-utils libcap-devel cups-devel libXtst-devel \
                   alsa-lib-devel libXrandr-devel GConf2-devel nss-devel

Other versions may provide similar packages to install through package managers such as pacman. Or one that compiles the source file.

Use a virtual machine

If you build Electron on a virtual machine, you need a fixed-size device that requires at least 25 gigabytes .

Get the code

$ git clone https://github.com/electron/electron.git

Bootstrapping

Bootstrap scripts are also necessary to download build dependencies to create project files. P ython 2.7.x is required for the script to execute successfully. D ownloading files correctly can take a long time. Note that we are ninja to build Electron, so there is no Makefile

$ cd electron
$ ./script/bootstrap.py -v

Cross-compilation

If you want to create an arm target, you should also download the following dependencies:

$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \
                       g++-arm-linux-gnueabihf

In order to arm ia32 targets, you bootstrap.py for the --target_arch parameter:

$ ./script/bootstrap.py -v --target_arch=arm

Build

Create Release Debug Target:

$ ./script/build.py

This script may create a huge executable Electron under directory out/R . T he file size may exceed 1.3 gigabytes. The reason is that the Release target binary contains the create-dist.py script to reduce the size of the file:

$ ./script/create-dist.py

This dist with a large number of small files in the dist directory. After create-dist.py script, perhaps you want to delete the 1.3 plus gigabyte binary that is still under out/R

You can create Debug target:

$ ./script/build.py -c D

Once created, you can find electron below out/D electron .

Cleaning

Remove the build file:

$ ./script/clean.py

Fix the problem

Make sure you've installed all the dependencies .

Error While Loading Shared Libraries: libtinfo.so.5

Pre-built clang attempts to link to libtinfo.so.5 . Depending on the host architecture, libncurses :

$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5

Tests

Test your modifications to match the project code style, using:

$ ./script/cpplint.py

Test effectiveness use:

+
$ ./script/test.py