1

I am trying to build electron (master) using the appended script on Ubuntu 22.04. Its throwing the following error (e build doesn't report this error). I am using the latest depot_tools, gn and node.js. Please help:

root@acs-x86-node1-ghatwala-rhel:/electron/src# gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ERROR at //electron/BUILD.gn:110:20: Script returned non-zero exit code.
electron_version = exec_script("script/print-version.py",
                   ^----------
Current dir: /electron/src/out/Release/
Command: python3 /electron/src/electron/script/print-version.py
Returned 1 and printed out: 0a>\n/electron/src/electron/script/lib/get-version.js:19\n    throw new Error('Failed to get current electron version');\n    ^\n\nError: Failed to get current electron version\n    at module.exports.getElectronVersion (/electron/src/electron/script/lib/get-version.js:19:11)\n    at [eval]:1:37\n    at Script.runInThisContext (node:vm:129:12)\n    at Object.runInThisContext (node:vm:307:38)\n    at node:internal/process/execution:83:21\n    at [eval]-wrapper:6:24\n    at runScript (node:internal/process/execution:82:62)\n    at evalScript (node:internal/process/execution:104:10)\n    at node:internal/main/eval_string:50:3\n\nNode.js v19.3.0\n"
  File "/usr/lib/python3.8/subprocess.py", line 516, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['node', '-p', 'require("./script/lib/get-version").getElectronVersion()']' returned non-zero exit status 1.
See //electron/build/args/all.gn:2:21: which caused the file to be included.
root_extra_deps = [ "//electron" ]
                    ^-----------


mkdir electron && cd electron
gclient config --name "src/electron" --unmanaged https://github.com/electron/electron
gclient sync --with_branch_heads --with_tags --no-history
cd src
export CHROMIUM_BUILDTOOLS_PATH=`pwd`/buildtools
gn gen out/Release --args="import(\"//electron/build/args/release.gn\")"
ninja -C out/Release electron
samofoz
  • 635
  • 5
  • 11
  • Any luck? Facing with the same issue :( – Footniko Feb 07 '23 at 10:24
  • @Footniko Follow the steps exactly as here (https://www.electronjs.org/docs/latest/development/build-instructions-gn), including the git cache and you should be fine. – samofoz Feb 08 '23 at 04:31
  • 1
    https://github.com/ppc64le/build-scripts/blob/master/e/electron/electron-22.0.3-ubuntu-22.04.sh – samofoz Feb 10 '23 at 12:03

1 Answers1

0

For me this problem was occurring because the command git describe --tags --abbrev=0 was failing in one of the electron repo's python scripts. I repaired the repo as here (https://stackoverflow.com/a/45730454/3837653) and it was fixed. Hope this helps someone.

samofoz
  • 635
  • 5
  • 11