Permalink
Switch branches/tags
1-3-x 1-4-x 1-5-x 1-6-x 1-7-x 1-8-x 2-0-x 2-1-x 3-0-x-appcontainer-trials 3-0-x 3-1-x 4-0-x 69_enable_logging add-args-spec add-vsts-status-to-readme add-web-frame-add-origin-access-whitelist-entry appcontainer-trials appveyor-test-reporter appveyor_gpu_test asan-tests backport-release-notes_4-0-x better-spec-runner brenca/accessibility-tests brenca/cookie-store-backport-4-0-x brenca/fix-14908 brenca/fix-paste-and-match-style-3-0-x build-gn buildFromTemplate-fix chromium-upgrade/71 cleanup-build-dirs-vsts deprecate-webframe-api dialog-refactor-p1 disable-color-correct-rendering docs-index e2e enable-mixed-sandbox enable-power-monitor-tests expect-browser-window-spec expect-crash-reporter-spec export-patches fetch-electron fetch_job_uaf_patch fix-build-with-enable_run_as_node-disabled fix-drag-region-crash fix-last-crash-report fix-memory-tracing fix-mixed-sandbox-tests fix-power-observer-dbus_3-0-x fix-remote-debugging fix-vsts-mac-gn fix-window-close fix-window-native-handle fix-windows-release-test fix-zoom-in-mac gn-add-nonproprietary-ffmpeg gn-babel gn-ci-builds gn-ci-sccache gn-circleci-mac gn-release-win gn-resource-conflict-omg-again-srsly gn-win-link ipc-filter jest-spike kthulu120/moveTopBackport lang lenient-locale-mkdirs make-cppcheck-happy master menu-accel migrate-setpath-logs miniak/desktop-capturer-filtering miniak/dock-api miniak/drop-mavericks miniak/fix-patch-description miniak/object-shorthand miniak/prefer-spread miniak/refactoring miniak/remote-promise-invoke miniak/remove-deprecated miniak/return-type-annotation miniak/screen-reader-detection miniak/tray-focus mkt/add-debugging-tools-to-windows-docs more-timeout multiple-globals no-chrome-common no-exit-event nornagon/gn-ci-builds ppontes/8100-backport-window.opener-null-fix-to-3-0-x ppontes/8100-use-proper-site-instance-candidate promise-changes promisify-affinity-tests promisify-cookies promisify-importcert promisify-tests publish-nightly-to-nightly reenable-nativeimage-specs release-1-7-x remove-blink_local_frame.patch rename-electron-build-configs resource-file-conflict-patch-explanation restore-clipboard-dcheck restore-url-dchecks restore-wtf-string-dcheck revert-10204-fix-window-opener revert-12293-revert-12193-master revert-15698-ppontes/8100-backport-window.opener-null-fix-to-4 rich-dialog roll-libcc route-permission-checks sandbox-ci-test single-core-fix-3-1-x system_netwok_context t-g test-build-appx test-change test-cr test-dirty-frame test-skips test-symbols-win unsafe-secure-origins url_fetcher_rewrite v2-sandbox wc-exec-js webui-resources webview-in-sandbox-renderer win-width-fix windows-powermonitor-shutdown-event wrap-docs-toc-in-element yolo-tests
Nothing to show
Find file Copy path
123 lines (87 sloc) 4.09 KB

Build Instructions (Linux)

Follow the guidelines below for building Electron on Linux.

Prerequisites

  • At least 25GB disk space and 8GB RAM.

  • Python 2.7.x. Some distributions like CentOS 6.x still use Python 2.6.x so you may need to check your Python version with python -V.

    Please also ensure that your system and Python version support at least TLS 1.2. For a quick test, run the following script:

    $ npm run check-tls

    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.

  • Node.js. There are various ways to install Node. You can download source code from nodejs.org and compile it. Doing so permits installing Node on your own home directory as a standard user. Or try repositories such as NodeSource.

  • clang 3.4 or later.

  • Development headers of GTK+ and libnotify.

On Ubuntu, install the following libraries:

$ sudo apt-get install build-essential clang libdbus-1-dev libgtk-3-dev \
                       libnotify-dev libgnome-keyring-dev libgconf2-dev \
                       libasound2-dev libcap-dev libcups2-dev libxtst-dev \
                       libxss1 libnss3-dev gcc-multilib g++-multilib curl \
                       gperf bison python-dbusmock

On RHEL / CentOS, install the following libraries:

$ sudo yum install clang dbus-devel gtk3-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 python-dbusmock

On Fedora, install the following libraries:

$ sudo dnf install clang dbus-devel gtk3-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 python-dbusmock

Other distributions may offer similar packages for installation via package managers such as pacman. Or one can compile from source code.

Cross compilation

If you want to build for an arm target you should also install the following dependencies:

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

Similarly for arm64, install the following:

$ sudo apt-get install libc6-dev-arm64-cross linux-libc-dev-arm64-cross \
                       g++-aarch64-linux-gnu

And to cross-compile for arm or ia32 targets, you should pass the target_cpu parameter to gn gen:

$ gn gen out/Debug --args='import(...) target_cpu="arm"'

Building

See Build Instructions: GN

Troubleshooting

Error While Loading Shared Libraries: libtinfo.so.5

Prebuilt clang will try to link to libtinfo.so.5. Depending on the host architecture, symlink to appropriate libncurses:

$ 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 distributions. To build for a specific distribution or device, the following information may help you.

Using system clang instead of downloaded clang binaries

By default Electron is built with prebuilt clang 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.

For example if you installed clang under /usr/local/bin/clang:

$ gn gen out/Debug --args='import("//electron/build/args/debug.gn") clang_base_path = "/usr/local/bin"'

Using compilers other than clang

Building Electron with compilers other than clang is not supported.