メインコンテンツへ飛ぶ

ビルド手順 (Linux)

カスタム Electron バイナリの作成にあたって Linux で Electron そのもの をビルドするには、以下のガイドラインに従ってください。 For bundling and distributing your app code with the prebuilt Electron binaries, see the application distribution guide.

必要な環境

Due to Electron's dependency on Chromium, prerequisites and dependencies for Electron change over time. Chromium's documentation on building on Linux 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 can be referenced to get the current dependencies that Electron requires in addition to what Chromium installs via build/install-deps.sh.

クロスコンパイル

If you want to build for an arm target, you can use Electron's Linux dependency installer to install the additional dependencies by passing the --arm argument:

$ sudo install-deps.sh --arm

そして arm のようなターゲット向けにクロスコンパイルするには、gn gentarget_cpu 引数を渡す必要があります。

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

ビルド

See Build Instructions: GN

トラブルシューティング

共有ライブラリの読み込みエラー: libtinfo.so.5

プリビルドされた clanglibtinfo.so.5 へリンクしようとします。 ホストアーキテクチャにしたがって、以下のように適切な libncurses にシンボリックリンクしてください。

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

上級者向けトピック

デフォルトのビルド構成は、主要なデスクトップ Linux ディストリビューションを対象としています。 特定のディストリビューションやデバイス向けにビルドするには、以下の情報を参考にしてください。

ダウンロードした clang バイナリの代わりにシステムの clang を使用する

デフォルトでは、Electron のビルドは、Chromiumプロジェクトが提供する、プレビルドのclangバイナリを使用します。 何らかの理由でシステムにインストールされている clang を使ってビルドしたい場合は、GN の引数に clang_base_path 引数を指定します。

例えば clang/usr/local/bin/clang にインストールされている場合はこのようにします。

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

clang 以外のコンパイラを使用する

clang 以外のコンパイラを用いた Electron のビルドはサポートされていません。