May 25, 2021 Electron
Follow the instructions below to build Electron on Linux .
python -V
.
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.
If you build Electron on a virtual machine, you need a fixed-size device that requires at least 25 gigabytes .
$ git clone https://github.com/electron/electron.git
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
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
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
.
Remove the build file:
$ ./script/clean.py
Make sure you've installed all the dependencies .
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
Test your modifications to match the project code style, using:
$ ./script/cpplint.py
Test effectiveness use:
$ ./script/test.py