| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  | # Build Instructions (Linux)
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Follow the guidelines below for building Electron on Linux. | 
					
						
							| 
									
										
										
										
											2014-02-20 18:39:24 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | ## Prerequisites
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 16:26:18 +09:00
										 |  |  | * At least 25GB disk space and 8GB RAM. | 
					
						
							| 
									
										
										
										
											2016-12-15 03:05:24 +00:00
										 |  |  | * Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  |   so you may need to check your Python version with `python -V`. | 
					
						
							| 
									
										
										
										
											2018-05-16 23:19:49 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  |   Please also ensure that your system and Python version support at least TLS 1.2. | 
					
						
							|  |  |  |   For a quick test, run the following script: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ```sh | 
					
						
							| 
									
										
										
										
											2019-07-16 12:04:02 -07:00
										 |  |  |   $ npx @electron/check-python-tls | 
					
						
							| 
									
										
										
										
											2018-05-16 23:19:49 +02:00
										 |  |  |   ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   If the script returns that your configuration is using an outdated security | 
					
						
							|  |  |  |   protocol, use your system's package manager to update Python to the latest | 
					
						
							|  |  |  |   version in the 2.7.x branch. Alternatively, visit https://www.python.org/downloads/ | 
					
						
							|  |  |  |   for detailed instructions. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-13 19:41:53 -07:00
										 |  |  | * Node.js. There are various ways to install Node. You can download | 
					
						
							| 
									
										
										
										
											2018-01-12 12:24:48 -03:00
										 |  |  |   source code from [nodejs.org](https://nodejs.org) and compile it. | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  |   Doing so permits installing Node on your own home directory as a standard user. | 
					
						
							|  |  |  |   Or try repositories such as [NodeSource](https://nodesource.com/blog/nodejs-v012-iojs-and-the-nodesource-linux-repositories). | 
					
						
							| 
									
										
										
										
											2017-07-27 10:29:41 -07:00
										 |  |  | * [clang](https://clang.llvm.org/get_started.html) 3.4 or later. | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  | * Development headers of GTK+ and libnotify. | 
					
						
							| 
									
										
										
										
											2014-02-20 18:56:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-06-05 19:38:30 -04:00
										 |  |  | On Ubuntu, install the following libraries: | 
					
						
							| 
									
										
										
										
											2014-02-20 18:56:59 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2018-02-15 15:08:55 -06:00
										 |  |  | $ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \ | 
					
						
							| 
									
										
										
										
											2019-07-29 14:33:47 +02:00
										 |  |  |                        libnotify-dev libgnome-keyring-dev \ | 
					
						
							| 
									
										
										
										
											2015-04-08 19:46:37 +08:00
										 |  |  |                        libasound2-dev libcap-dev libcups2-dev libxtst-dev \ | 
					
						
							| 
									
										
										
										
											2016-08-10 11:08:14 -07:00
										 |  |  |                        libxss1 libnss3-dev gcc-multilib g++-multilib curl \ | 
					
						
							| 
									
										
										
										
											2019-05-08 15:28:55 -07:00
										 |  |  |                        gperf bison python-dbusmock openjdk-8-jre | 
					
						
							| 
									
										
										
										
											2014-05-15 14:12:40 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-15 03:05:24 +00:00
										 |  |  | On RHEL / CentOS, install the following libraries: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2018-02-15 15:08:55 -06:00
										 |  |  | $ sudo yum install clang dbus-devel gtk3-devel libnotify-devel \ | 
					
						
							| 
									
										
										
										
											2016-12-15 03:05:24 +00:00
										 |  |  |                    libgnome-keyring-devel xorg-x11-server-utils libcap-devel \ | 
					
						
							|  |  |  |                    cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \ | 
					
						
							| 
									
										
										
										
											2019-07-29 14:33:47 +02:00
										 |  |  |                    nss-devel python-dbusmock openjdk-8-jre | 
					
						
							| 
									
										
										
										
											2016-12-15 03:05:24 +00:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-01 16:01:44 +02:00
										 |  |  | On Fedora, install the following libraries: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2018-02-15 15:08:55 -06:00
										 |  |  | $ sudo dnf install clang dbus-devel gtk3-devel libnotify-devel \ | 
					
						
							| 
									
										
										
										
											2016-12-15 03:05:24 +00:00
										 |  |  |                    libgnome-keyring-devel xorg-x11-server-utils libcap-devel \ | 
					
						
							|  |  |  |                    cups-devel libXtst-devel alsa-lib-devel libXrandr-devel \ | 
					
						
							| 
									
										
										
										
											2019-07-29 14:33:47 +02:00
										 |  |  |                    nss-devel python-dbusmock openjdk-8-jre | 
					
						
							| 
									
										
										
										
											2015-09-01 16:01:44 +02:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 15:54:14 +08:00
										 |  |  | Other distributions may offer similar packages for installation via package | 
					
						
							| 
									
										
										
										
											2015-09-01 16:01:44 +02:00
										 |  |  | managers such as pacman. Or one can compile from source code. | 
					
						
							| 
									
										
										
										
											2015-06-05 19:38:30 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 15:54:14 +08:00
										 |  |  | ### Cross compilation
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  | If you want to build for an `arm` target you should also install the following | 
					
						
							| 
									
										
										
										
											2015-07-13 15:26:35 -07:00
										 |  |  | dependencies: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2015-07-13 15:26:35 -07:00
										 |  |  | $ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \ | 
					
						
							|  |  |  |                        g++-arm-linux-gnueabihf | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-10-31 15:09:12 +01:00
										 |  |  | Similarly for `arm64`, install the following: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2017-10-31 15:09:12 +01:00
										 |  |  | $ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \ | 
					
						
							|  |  |  |                        g++-aarch64-linux-gnu | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-27 10:29:41 -07:00
										 |  |  | And to cross-compile for `arm` or `ia32` targets, you should pass the | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | `target_cpu` parameter to `gn gen`: | 
					
						
							| 
									
										
										
										
											2015-07-02 15:54:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2019-11-07 11:51:44 -08:00
										 |  |  | $ gn gen out/Testing --args='import(...) target_cpu="arm"' | 
					
						
							| 
									
										
										
										
											2015-07-02 15:54:14 +08:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-20 18:39:24 +08:00
										 |  |  | ## Building
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | See [Build Instructions: GN](build-instructions-gn.md) | 
					
						
							| 
									
										
										
										
											2017-03-17 20:44:18 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-20 18:39:24 +08:00
										 |  |  | ## Troubleshooting
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  | ### Error While Loading Shared Libraries: libtinfo.so.5
 | 
					
						
							| 
									
										
										
										
											2015-07-04 10:27:29 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-19 08:45:06 -07:00
										 |  |  | Prebuilt `clang` will try to link to `libtinfo.so.5`. Depending on the host | 
					
						
							| 
									
										
										
										
											2015-08-30 22:30:12 -07:00
										 |  |  | architecture, symlink to appropriate `libncurses`: | 
					
						
							| 
									
										
										
										
											2015-07-04 10:27:29 +05:30
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2015-07-04 10:27:29 +05:30
										 |  |  | $ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 16:35:33 +09:00
										 |  |  | ## Advanced topics
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The default building configuration is targeted for major desktop Linux | 
					
						
							| 
									
										
										
										
											2017-07-27 10:29:41 -07:00
										 |  |  | distributions. To build for a specific distribution or device, the following | 
					
						
							| 
									
										
										
										
											2016-05-02 16:35:33 +09:00
										 |  |  | information may help you. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-02 22:32:43 +09:00
										 |  |  | ### Using system `clang` instead of downloaded `clang` binaries
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-12 12:24:48 -03:00
										 |  |  | By default Electron is built with prebuilt | 
					
						
							| 
									
										
										
										
											2017-07-27 10:29:41 -07:00
										 |  |  | [`clang`](https://clang.llvm.org/get_started.html) binaries provided by the | 
					
						
							| 
									
										
										
										
											2018-01-12 12:24:48 -03:00
										 |  |  | Chromium project. If for some reason you want to build with the `clang` | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | installed in your system, you can specify the `clang_base_path` argument in the | 
					
						
							|  |  |  | GN args. | 
					
						
							| 
									
										
										
										
											2016-05-02 22:32:43 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | For example if you installed `clang` under `/usr/local/bin/clang`: | 
					
						
							| 
									
										
										
										
											2016-05-02 22:32:43 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-24 11:13:57 +01:00
										 |  |  | ```sh | 
					
						
							| 
									
										
										
										
											2019-11-07 11:51:44 -08:00
										 |  |  | $ gn gen out/Testing --args='import("//electron/build/args/testing.gn") clang_base_path = "/usr/local/bin"' | 
					
						
							| 
									
										
										
										
											2016-05-02 22:32:43 +09:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-07-27 10:29:41 -07:00
										 |  |  | ### Using compilers other than `clang`
 | 
					
						
							| 
									
										
										
										
											2016-05-02 22:32:43 +09:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-09-08 18:15:32 -07:00
										 |  |  | Building Electron with compilers other than `clang` is not supported. |