electron/docs/development/build-instructions-linux.md

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

66 lines
2.7 KiB
Markdown
Raw Normal View History

2015-08-30 22:30:12 -07:00
# Build Instructions (Linux)
Follow the guidelines below for building **Electron itself** on Linux, for the purposes of creating custom Electron binaries. For bundling and distributing your app code with the prebuilt Electron binaries, see the [application distribution][application-distribution] guide.
[application-distribution]: ../tutorial/application-distribution.md
2014-02-20 18:39:24 +08:00
## Prerequisites
Due to Electron's dependency on Chromium, prerequisites and dependencies for Electron change over time. [Chromium's documentation on building on Linux](https://chromium.googlesource.com/chromium/src/+/HEAD/docs/linux/build_instructions.md) has up to date information for building Chromium on Linux. This documentation can generally
be followed for building Electron on Linux as well.
Additionally, Electron's [Linux dependency installer](https://github.com/electron/build-images/blob/main/tools/install-deps.sh) can be referenced to get the current dependencies that Electron requires in addition to what Chromium installs via [build/install-deps.sh](https://chromium.googlesource.com/chromium/src/+/HEAD/build/install-build-deps.sh).
2015-07-02 15:54:14 +08:00
### Cross compilation
If you want to build for an `arm` target, you can use Electron's [Linux dependency installer](https://github.com/electron/build-images/blob/main/tools/install-deps.sh) to install the additional dependencies by passing the `--arm argument`:
2017-11-24 11:13:57 +01:00
```sh
$ sudo install-deps.sh --arm
```
chore: bump chromium to 102.0.4999.0 (main) (#33731) * chore: bump chromium in DEPS to 102.0.4999.0 * 3576640: Set OOM handler during V8 initialization https://chromium-review.googlesource.com/c/chromium/src/+/3576640 * 3574964: Remove deprecated base::Value usage in print_settings_conversion code. https://chromium-review.googlesource.com/c/chromium/src/+/3574964 * 3570062: Replicate Active state to render process for all RenderViews. https://chromium-review.googlesource.com/c/chromium/src/+/3570062 * chore: fixup patch indices * 3380402: Remove legacy SwiftShader https://chromium-review.googlesource.com/c/chromium/src/+/3380402 * 3570254: [Local Fonts] Rename permission name from FONT_ACCESS to LOCAL_FONTS. https://chromium-review.googlesource.com/c/chromium/src/+/3570254 * 3572172: Rename or remove several parameters involved in creation of MimeHandler streams https://chromium-review.googlesource.com/c/chromium/src/+/3572172 * fix: add missing base/bits include * chore: fix lint * chore: remove ia32 Linux support * chore: patch out swift-format cipd dep on macOS * build: apply patch better * build: reset all caches * build: update zip manifests to remove swiftshared libraries Refs: https://chromium-review.googlesource.com/c/chromium/src/+/3380402 * Revert "build: update zip manifests to remove swiftshared libraries" This reverts commit 6aeec01ef1a79425a7b7d8c1cfb131a26b91c494. * Revert "3380402: Remove legacy SwiftShader" This reverts commit 4c7eebbbf2d0a459cc192959e17ae20f970c2da2. * build: remove unused swiftshader egl libraries Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <sattard@salesforce.com>
2022-04-22 15:36:22 -07:00
And to cross-compile for `arm` or targets, you should pass the
`target_cpu` parameter to `gn gen`:
2015-07-02 15:54:14 +08:00
2017-11-24 11:13:57 +01:00
```sh
$ 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
See [Build Instructions: GN](build-instructions-gn.md)
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
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`:
2017-11-24 11:13:57 +01:00
```sh
$ sudo ln -s /usr/lib/libncurses.so.5 /usr/lib/libtinfo.so.5
```
## 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
information may help you.
2016-05-02 22:32:43 +09:00
### Using system `clang` instead of downloaded `clang` binaries
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
Chromium project. If for some reason you want to build with the `clang`
installed in your system, you can specify the `clang_base_path` argument in the
GN args.
2016-05-02 22:32:43 +09: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
$ 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
Building Electron with compilers other than `clang` is not supported.