ubuntu electron chromium linux 交叉编译arm版本
参考:
- https://www.electronjs.org/docs/development/build-instructions-linux#%E4%BA%A4%E5%8F%89%E7%BC%96%E8%AF%91
- https://chromium.googlesource.com/chromium/src/+/master/docs/linux/chromium_arm.md
在x86机器上linux编译通过。
0,安装(预先安装两步骤非常重要,保证要安装成功!,electron文档没有提及,害得我编译走弯路!!!):
在src下运行:
$ ./build/install-build-deps.sh --no-chromeos-fonts 可以略去安装些没用的
./build/linux/sysroot_scripts/install-sysroot.py --arch=arm
以下是electron文档要求的:
$ sudo apt-get install libc6-dev-armhf-cross linux-libc-dev-armhf-cross \ g++-arm-linux-gnueabihf
1,修改或者自建: ~/.electron_build_tools/configs/evm.electron9-on-arm.json
{ "goma": "none", "root": "/home/a/dev0/e9.2.1", "remotes": { "electron": { "origin": "git@github.com:electron/electron.git" }, "node": { "origin": "git@github.com:electron/node.git" } }, "gen": { "args": [ "import(\"//electron/build/args/release_sym0.gn\") target_cpu=\"arm\" " ], "out": "ReleaseSym0" }, "env": { "CHROMIUM_BUILDTOOLS_PATH": "/home/a/dev0/e9.2.1/src/buildtools", "GIT_CACHE_PATH": "/home/a/dev0/cacheForElectron/git_cache" } }
2,如果出错,这就是由于前面第0步没做。:
e build electron Running "/home/a/.electron_build_tools/third_party/depot_tools/gn gen out/ReleaseSym0 --args=import("//electron/build/args/release_sym0.gn") target_cpu="arm" " in /home/a/dev0/e9.2.1/src ERROR at //build/config/sysroot.gni:64:7: Assertion failed. assert( ^----- Missing sysroot (//build/linux/debian_sid_arm-sysroot). To fix, run: build/linux/sysroot_scripts/install-sysroot.py --arch=arm See //build/config/sysroot.gni:65:11: exec_script("//build/dir_exists.py", ^----------------------------------- This is where it was set. See //chrome/installer/BUILD.gn:7:1: whence it was imported. import("//build/config/sysroot.gni") ^---------------------------------- See //BUILD.gn:73:5: which caused the file to be included. "//chrome/installer", ^------------------- ERROR Error: Command failed: /home/a/.electron_build_tools/third_party/depot_tools/gn gen out/ReleaseSym0 --args=import("//electron/build/args/release_sym0.gn") target_cpu="arm" at checkExecSyncError (child_process.js:630:11) at Object.execFileSync (child_process.js:648:15) at Object.depotExecFileSync [as execFileSync] (/home/a/.electron_build_tools/src/utils/depot-tools.js:106:16) at runGNGen (/home/a/.electron_build_tools/src/e-build.js:20:9) at ensureGNGen (/home/a/.electron_build_tools/src/e-build.js:45:41) at runNinja (/home/a/.electron_build_tools/src/e-build.js:90:3) at Object.<anonymous> (/home/a/.electron_build_tools/src/e-build.js:160:3) at Module._compile (internal/modules/cjs/loader.js:1138:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10) at Module.load (internal/modules/cjs/loader.js:986:32)
执行下面解决:
@ubuntu:~/dev0/e9.2.1/src$ build/linux/sysroot_scripts/install-sysroot.py --arch=arm Installing Debian sid arm root image: /home/a/dev0/e9.2.1/src/build/linux/debian_sid_arm-sysroot Downloading http://s3.amazonaws.com/electronjs-sysroots/toolchain/074ad35a3ef1425244ebb04568cd8ea14bf6c9ae/debian_sid_arm_sysroot.tar.xz