Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

electron-{bin,source,chromedriver}_35: init at 35.0.3 #387294

Merged
merged 8 commits into from
Mar 24, 2025

Conversation

teutat3s
Copy link
Member

@teutat3s teutat3s commented Mar 5, 2025

https://github.com/electron/electron/releases/tag/v35.0.0
https://github.com/electron/electron/releases/tag/v35.0.1
https://github.com/electron/electron/releases/tag/v35.0.2
https://github.com/electron/electron/releases/tag/v35.0.3

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@emilylange
Copy link
Member

Coming from #387264, #387370 has been merged in the meantime and should allow for a relatively painless electron-source.electron_34 bring up, if you want. Just as a fyi.

@emilylange emilylange removed their request for review March 7, 2025 11:41
@teutat3s teutat3s requested a review from TomaSajt March 8, 2025 14:54
@teutat3s teutat3s changed the title electron_35-bin, electron-chromedriver_35: init at 35.0.0 electron_35-{bin,source}, electron-chromedriver_35: init at 35.0.0 Mar 8, 2025
@teutat3s teutat3s changed the title electron_35-{bin,source}, electron-chromedriver_35: init at 35.0.0 electron-{bin,source,chromedriver}_35: init at 35.0.0 Mar 8, 2025
@teutat3s teutat3s requested a review from yuyuyureka March 8, 2025 15:11
@teutat3s
Copy link
Member Author

teutat3s commented Mar 8, 2025

Sigh. The source build needs some more work, converting to draft. Error message for the curious reader:

       > Running phase: buildPhase
       > ninja: Entering directory `out/Release'
       > [1/7] COPY ../../third_party/electron_node/deps/zlib/zconf.h gen/node_headers/include/node/zconf.h
       > [2/7] COPY ../../third_party/electron_node/deps/zlib/zlib.h gen/node_headers/include/node/zlib.h
       > [3/7] ACTION //electron:node_version_header(//build/toolchain/linux/unbundle:default)
       > [4/7] ACTION //electron:generate_config_gypi(//build/toolchain/linux/unbundle:default)
       > WARNING: --openssl-no-asm will result in binaries that do not take advantage
       >          of modern CPU cryptographic instructions and will therefore be slower.
       >          Please refer to BUILDING.md
       > WARNING: warnings were emitted in the configure phase
       > INFO: configure completed successfully
       > [5/7] COPY gen/config.gypi gen/node_headers/include/node/config.gypi
       > [6/7] COPY ../../third_party/electron_node/common.gypi gen/node_headers/include/node/common.gypi
       > [7/7] ACTION //electron:generate_node_headers(//build/toolchain/linux/unbundle:default)
       > FAILED: gen/node_headers.json
       > python3 ../../electron/script/node/generate_node_headers.py
       > Traceback (most recent call last):
       >   File "/build/src/out/Release/../../electron/script/node/generate_node_headers.py", line 68, in <module>
       >     options = install.parse_options([
       >               ^^^^^^^^^^^^^^^^^^^^^^^
       >   File "/build/src/third_party/electron_node/tools/install.py", line 419, in parse_options
       >     with open(options.config_gypi_path) as f:
       >          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       > FileNotFoundError: [Errno 2] No such file or directory: '/build/src/out/Testing/gen/config.gypi'

@teutat3s teutat3s marked this pull request as draft March 8, 2025 15:46
@TomaSajt
Copy link
Contributor

TomaSajt commented Mar 8, 2025

I'm glad I put the header generation before the main build, this way we knew that it failed before building the entire browser.

@teutat3s
Copy link
Member Author

teutat3s commented Mar 8, 2025

Tracked down a bit to this commit electron/electron@7a5e961 / PR electron/electron#44657.

@TomaSajt
Copy link
Contributor

TomaSajt commented Mar 8, 2025

This is the culprit:
https://github.com/electron/electron/blob/e4bd0cd3dcc57cb6889f845c75952bf999cbf581/script/node/generate_node_headers.py#L34-L39

The directory is not called "Testing" in release builds. They expect the ELECTRON_OUT_DIR do be set to "Release".

@TomaSajt
Copy link
Contributor

TomaSajt commented Mar 8, 2025

This small change fixes it:

diff --git a/pkgs/development/tools/electron/common.nix b/pkgs/development/tools/electron/common.nix
index f0d84e9d2692..19777b11b584 100644
--- a/pkgs/development/tools/electron/common.nix
+++ b/pkgs/development/tools/electron/common.nix
@@ -64,6 +64,9 @@ in
     hash = info.chromium_npm_hash;
   };

+  # needed for header generation in electron 35 and above
+  env.ELECTRON_OUT_DIR = "Release";
+
   src = null;

   patches =

(though this would rebuild all versions, so we should probably only do this conditionally)

@teutat3s teutat3s marked this pull request as ready for review March 9, 2025 13:53
@TomaSajt
Copy link
Contributor

TomaSajt commented Mar 9, 2025

I highly doubt lib.optionals is what we want, that's for lists.
Maybe just if cond then val else null is the easiest?
Not sure if that causes a rebuild or not.

Or perhaps lib.optionalString works?

@teutat3s teutat3s changed the title electron-{bin,source,chromedriver}_35: init at 35.0.0 electron-{bin,source,chromedriver}_35: init at 35.0.1 Mar 10, 2025
@teutat3s
Copy link
Member Author

Another nice surprise:

[41984/43140] ACTION //third_party/electron_node:generate_config_gypi(//build/toolchain/linux/unbundle:default)
FAILED: gen/third_party/electron_node/config.gypi
python3 ../../third_party/electron_node/tools/generate_config_gypi.py gen/third_party/electron_node/config.gypi --out-dir . --dep-file gen/third_party/electron_node/generate_config_gypi.d --node-gn-path //third_party/electron_node
Traceback (most recent call last):
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 113, in <module>
    main()
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 100, in main
    config = get_gn_config(args.out_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 32, in get_gn_config
    gn_args = subprocess.check_output(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 468, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 550, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 1028, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 1963, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gn'

@TomaSajt
Copy link
Contributor

TomaSajt commented Mar 10, 2025

My main suspect upon first glance is out_dir. I encountered it when I was looking at where else ELECTRON_OUT_DIR was used. I don't have time to track it down today.

It sucks a lot that this was so late in the build process.
Perhaps we can add an extra job (like the header job) to the build so that we don't have to build everything.


Edit: --out-dir . is being passed to the python script so I might be wrong.

@TomaSajt
Copy link
Contributor

Ideally we should be using gnChromium (an override of gn that is used to execute the listed buildTargets). Unfortunately it is not exposed directly.

IMO ideally, in the chromium/common.nix file, gnChromium should be put inside nativeBuildInputs instead of just string-iterpolating it.

@teutat3s
Copy link
Member Author

teutat3s commented Mar 11, 2025

3.5 hours later:

FAILED: gen/third_party/electron_node/config.gypi
python3 ../../third_party/electron_node/tools/generate_config_gypi.py gen/third_party/electron_node/config.gypi --out-dir . --dep-file gen/third_party/electron_node/generate_config_gypi.d --node-gn-path //third_party/electron_node
Traceback (most recent call last):
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 113, in <module>
    main()
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 100, in main
    config = get_gn_config(args.out_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 32, in get_gn_config
    gn_args = subprocess.check_output(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 468, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 573, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gn', 'args', '--list', '--short', '-C', '.']' returned non-zero exit status 1.

EDIT: Trying again with the below commit.

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 12, 2025
@teutat3s teutat3s requested review from emilylange and TomaSajt March 12, 2025 15:00
@teutat3s
Copy link
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 387294


x86_64-linux

✅ 3 packages built:
  • electron-chromedriver_35
  • electron_35
  • electron_35-bin

@teutat3s
Copy link
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 387294


x86_64-linux

✅ 1 package built:
  • electron_34

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 16, 2025
@andersk andersk mentioned this pull request Mar 18, 2025
13 tasks
teutat3s and others added 8 commits March 23, 2025 18:27
We already set it in chromium/common.nix, see 062eb42.
because electron 35+ needs gn in PATH at build time

[41984/43140] ACTION //third_party/electron_node:generate_config_gypi(//build/toolchain/linux/unbundle:default)
FAILED: gen/third_party/electron_node/config.gypi
python3 ../../third_party/electron_node/tools/generate_config_gypi.py gen/third_party/electron_node/config.gypi --out-dir . --dep-file gen/third_party/electron_node/generate_config_gypi.d --node-gn-path //third_party/electron_node
Traceback (most recent call last):
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 113, in <module>
    main()
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 100, in main
    config = get_gn_config(args.out_dir)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 32, in get_gn_config
    gn_args = subprocess.check_output(
              ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 468, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 550, in run
    with Popen(*popenargs, **kwargs) as process:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 1028, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/nix/store/26yi95240650jxp5dj78xzch70i1kzlz-python3-3.12.9/lib/python3.12/subprocess.py", line 1963, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'gn'
FAILED: gen/third_party/electron_node/config.gypi
python3 ../../third_party/electron_node/tools/generate_config_gypi.py gen/third_party/electron_node/config.gypi --out-dir . --dep-file gen/third_party/electron_node/generate_config_gypi.d --node-gn-path //third_party/electron_node
Traceback (most recent call last):
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 113, in <module>
    main()
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 105, in main
    f.write(repr(translate_config(args.out_dir, config, v8_config)))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/build/src/out/Release/../../third_party/electron_node/tools/generate_config_gypi.py", line 62, in translate_config
    'node_module_version': int(config['node_module_version']),
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: invalid literal for int() with base 10: '"133"'

Co-authored-by: Ljuzig <diamond.bertelli@gmail.com>
As a precaution and to avoid problems with hydra builds that had to
be fixed in the past. References: ce04dc5 (NixOS#378988) and 3f514d3.
@teutat3s teutat3s changed the title electron-{bin,source,chromedriver}_35: init at 35.0.1 electron-{bin,source,chromedriver}_35: init at 35.0.3 Mar 23, 2025
@teutat3s
Copy link
Member Author

Bumped to 35.0.3 and fixed conflicts.

@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 23, 2025
Copy link
Contributor

@TomaSajt TomaSajt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I do not really have the time to build from source, but I'm assuming it still builds.

@wegank wegank added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Mar 23, 2025
@teutat3s
Copy link
Member Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 387294


x86_64-linux

✅ 3 packages built:
  • electron-chromedriver_35
  • electron_35
  • electron_35-bin

@TomaSajt
Copy link
Contributor

Thanks, I'll merge soon :)

@TomaSajt TomaSajt merged commit 51a47f1 into NixOS:master Mar 24, 2025
43 of 44 checks passed
@nixpkgs-ci
Copy link
Contributor

nixpkgs-ci bot commented Mar 24, 2025

Successfully created backport PR for release-24.11:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 1-10 10.rebuild-linux: 101-500 12.approvals: 1 This PR was reviewed and approved by one reputable person backport release-24.11 Backport PR automatically
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants