Skip to content

libsForQt5.qt5.qtwebengine: fix build with clang#358759

Merged
emilazy merged 1 commit intoNixOS:stagingfrom
tricktron:fix-qt5-webengine-on-darwin
Nov 25, 2024
Merged

libsForQt5.qt5.qtwebengine: fix build with clang#358759
emilazy merged 1 commit intoNixOS:stagingfrom
tricktron:fix-qt5-webengine-on-darwin

Conversation

@tricktron
Copy link
Member

@tricktron tricktron commented Nov 24, 2024

Things done

Supersedes #358601.

Fixes the build on clang / darwin. I mostly go the patches and ideas from https://trac.macports.org/ticket/70850.

Don't know if this needs to go to staging because all changes are gated behind stdenv.cc.isClang and thus cannot break on other platforms.

Needs 24.11 backport for ZHF #ZurichZHF

ZHF: #352882

  • 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.

@github-actions github-actions bot added the 6.topic: qt/kde Object-oriented framework for GUI creation label Nov 24, 2024
@tricktron tricktron added 0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign backport release-24.11 labels Nov 24, 2024
@tricktron tricktron force-pushed the fix-qt5-webengine-on-darwin branch from dbd4066 to 99c38a8 Compare November 25, 2024 07:07
@tricktron tricktron changed the base branch from master to staging November 25, 2024 07:07
@tricktron
Copy link
Member Author

@emilazy Changed to using fetchpatch to directly use the upstream patch and switched to staging.

Comment on lines 188 to 193
Copy link
Member

Choose a reason for hiding this comment

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

I don’t think this will work; it’ll just add a .diff file to the source tree.

Could you fetch the upstream HarfBuzz commit instead and use extraPrefix/stripLen to apply it to the right place in the WebEngine source?

Copy link
Member Author

Choose a reason for hiding this comment

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

@emilazy I cannot make it work with the upstream commit because it seems to patch more than we want which then breaks. See the latest commit for reference to try it out.

Copy link
Member

Choose a reason for hiding this comment

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

I see – in that case, we can probably just use fetchurl with https://github.com/macports/macports-ports/raw/dd7bc40d8de48c762bf9757ce0a0672840c5d8c2/aqua/qt5/files/patch-qtwebengine_hb-ft.cc_error.diff.

Copy link
Member Author

@tricktron tricktron Nov 25, 2024

Choose a reason for hiding this comment

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

@emilazy Fetchurl also does not work, see latest commit again. I don't know why.

EDIT: Is it because of the timestamps at the end of the path and thus it cannot find the correct file?

Copy link
Member Author

Choose a reason for hiding this comment

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

@emilazy I reverted back to using our own patch because fetchurl did not work due to timestamps.

Copy link
Member

Choose a reason for hiding this comment

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

The timestamps are a normal part of the diff format. What’s the error you were getting?

Copy link
Member Author

Choose a reason for hiding this comment

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

@emilazy I get the following error:

applying patch /nix/store/3nny5pr2xq6cak6wyivia8ibcj1r29iq-patch-qtwebengine_hb-ft.cc_error.diff
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- src/3rdparty/chromium/third_party/harfbuzz-ng/src/src/hb-ft.cc     2024-09-27 18:46:30
|+++ src/3rdparty/chromium/third_party/harfbuzz-ng/src/src/hb-ft.cc 2024-09-27 18:46:18
--------------------------
File to patch:
Skip this patch? [y]
Skipping patch.
4 out of 4 hunks ignored

Copy link
Member

Choose a reason for hiding this comment

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

src/3rdparty/chromium/third_party/harfbuzz-ng/src/src/hb-ft.cc doesn’t look like the correct path (src/src seems unlikely) – it will probably work if you get the extraPrefix and stripLen values right.

Copy link
Member Author

Choose a reason for hiding this comment

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

@emilazy I got confused and used fetchurl according to #358759 (comment) but now I use fetchpatch again with extraPrefix = "" and it finally works.

@tricktron tricktron force-pushed the fix-qt5-webengine-on-darwin branch from 4b7f37a to 24c494a Compare November 25, 2024 13:27
@emilazy emilazy merged commit eccdbae into NixOS:staging Nov 25, 2024
@github-actions
Copy link
Contributor

Successfully created backport PR for staging-24.11:

@github-actions
Copy link
Contributor

Git push to origin failed for staging-24.11 with exitcode 1

@azuwis
Copy link
Contributor

azuwis commented Nov 26, 2024

We can remove the stdenv override after this PR, right?

--- a/pkgs/development/libraries/qt-5/5.15/default.nix
+++ b/pkgs/development/libraries/qt-5/5.15/default.nix
@@ -282,16 +282,6 @@ let
       qtwayland = callPackage ../modules/qtwayland.nix {};
       qtwebchannel = callPackage ../modules/qtwebchannel.nix {};
       qtwebengine = callPackage ../modules/qtwebengine.nix {
-        # The version of Chromium used by Qt WebEngine 5.15.x does not build with clang 16 due
-        # to the following errors:
-        # * -Wenum-constexpr-conversion: This is a downgradable error in clang 16, but it is planned
-        #   to be made into a hard error in a future version of clang. Patches are not available for
-        #   the version of v8 used by Chromium in Qt WebEngine, and fixing the code is non-trivial.
-        # * -Wincompatible-function-pointer-types: This is also a downgradable error generated
-        #   starting with clang 16. Patches are available upstream that can be backported.
-        # Because the first error is non-trivial to fix and suppressing it risks future breakage,
-        # clang is pinned to clang 15. That also makes fixing the second set of errors unnecessary.
-        stdenv = if stdenv.cc.isClang then overrideLibcxx llvmPackages_15.stdenv else stdenv;
         inherit (srcs.qtwebengine) version;
         inherit (darwin) bootstrap_cmds;
         python = python3;

@emilazy
Copy link
Member

emilazy commented Nov 26, 2024

If -Wno-enum-constexpr-conversion still works on LLVM 19, then I guess so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

0.kind: ZHF Fixes Fixes during the Zero Hydra Failures (ZHF) campaign 6.topic: qt/kde Object-oriented framework for GUI creation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants