Skip to content

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Apr 7, 2022

This is a draft of upgrading Qt in depends up to Qt 6.2 LTS.

The motivation is:

  • Qt 6 seems (almost) inevitable in the future
  • this change drops all of the backported patches (but introduces a new one)

Tasks

  • backport the QTBUG-86080 fix
  • integrate Qt 6 into build-aux/m4/bitcoin_qt.m4
  • fix builds which are configured with --disable-wallet
  • cross-compiling
  • Guix builds

Closes #20627.


Steps to build on Linux x86_64:

$ make -C depends
$ ./autogen.sh
$ ./configure --with-gui=qt6 CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site
$ make clean 
$ make
$ make check

@laanwj
Copy link
Member

laanwj commented Apr 7, 2022

So I understand this doesn't need any actual code changes? Only build system and depends?

@laanwj laanwj added the GUI label Apr 7, 2022
@hebasto
Copy link
Member Author

hebasto commented Apr 7, 2022

So I understand this doesn't need any actual code changes? Only build system and depends?

Cannot say for sure at this point.

@DrahtBot
Copy link
Contributor

DrahtBot commented Apr 8, 2022

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Reviews

See the guideline for information on the review process.
A summary of reviews will appear here.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #25797 (build: Add CMake-based build system by hebasto)
  • #25391 (guix: Use LTO to build releases by fanquake)
  • #16545 (refactor: Implement missing error checking for ArgsManager flags by ryanofsky)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@laanwj
Copy link
Member

laanwj commented Apr 8, 2022

Cannot say for sure at this point.

OK I assumed so, as it wouldn't make much sense to change depends if the code cannot handle it. We could try compiling against system Qt6.

@hebasto
Copy link
Member Author

hebasto commented Apr 8, 2022

Cannot say for sure at this point.

OK I assumed so, as it wouldn't make much sense to change depends if the code cannot handle it. We could try compiling against system Qt6.

Some changes are required: bitcoin-core/gui#577, bitcoin-core/gui#578, bitcoin-core/gui#579, bitcoin-core/gui#580, #24813.

@hebasto
Copy link
Member Author

hebasto commented Apr 9, 2022

Compiled and linked (not pushed yet):

2022-04-09T11:25:38Z Bitcoin Core version v23.99.0-388ee2edb127 (release build)
2022-04-09T11:25:38Z Qt 6.2.4 (static), plugin=xcb (static)
2022-04-09T11:25:38Z Static plugins:
2022-04-09T11:25:38Z  QXcbIntegrationPlugin, version 393728
2022-04-09T11:25:38Z Style: fusion / QFusionStyle
2022-04-09T11:25:38Z System: Ubuntu Jammy Jellyfish (development branch), x86_64-little_endian-lp64
...

Screenshot from 2022-04-09 13-24-24

@hebasto
Copy link
Member Author

hebasto commented Apr 9, 2022

Steps to build this PR in its current state on Linux x86_64:

$ make -C depends
$ ./autogen.sh
$ CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure
$ make clean 
$ make

@hebasto
Copy link
Member Author

hebasto commented Apr 9, 2022

I ran into a problem while working on this PR.

The problem's root is in two facts:

  1. our build system rely on pkg-config
  2. Qt 6 build system, after switching from qmake to cmake, does not produce *.pc files

The fix suggested in QTBUG-86080 works only for shared libraries.

Here are some ways to work out this problem:

  1. modify Qt's patch to support static builds. Nevertheless, the generated *.pc files lack *.private sections which contains libraries required for static builds. This issue in turn can be solved by adjusting resulted *_LIB variables ad-hoc. Btw, this approach is currently implemented in this PR
  2. develop our own patch which make Qt generate correct *.pc files for static builds (the content of internal QMAKE_PRL_LIBS variables could be used for that)
  3. keep working *.pc files in our repo, and substitute them for static builds
  4. something else
  5. ...

@jarolrod
Copy link
Member

While it's good to think about this kind of integration, I don't know how feasible this will ultimately be.

In d0015fd5f3b0465d2b3f36fda3714e248f1b4c51, you uncomment lines where the patch author intended to return when performing a static build. Here's a link to a discussion on the QTBUG-86080 page where it talks about the current qt internal issues with *.pc files and static builds.

On the surface, it appears we most likely can get this working. But, I worry about the implications of the hacky path we'd take to get there.

@laanwj
Copy link
Member

laanwj commented Apr 11, 2022

IMO for static linking in the release, it's acceptable to carry some hacky patches in depends until the issue gets resolved upstream. I don't have any specific opinion which one, as long as it's works and is maintainable.

I do think we should be able to build against distro Qt6 -dev packages for local builds for development (so without any Qt-side patches). But dynamic-only is fine there. Not sure what the recommended approach to find the libraries is if they don't ship *.pc, though. Probing hardcoded paths is really crappy. Any other autoconf-using Qt6 applications we can borrow scripting from?

@luke-jr
Copy link
Member

luke-jr commented Apr 12, 2022

Would prefer to see this PR split between Qt6 compatibility (goal ASAP), and using Qt6 for releases (goal TBD later).

@hebasto
Copy link
Member Author

hebasto commented Apr 12, 2022

Would prefer to see this PR split between Qt6 compatibility (goal ASAP), and using Qt6 for releases (goal TBD later).

#24798 (comment) -- is it what you mean?

hebasto added a commit to bitcoin-core/gui that referenced this pull request Apr 12, 2022
6312575 qt: Update deprecated enum value (Hennadii Stepanov)
c7add88 qt: Use `|` instead of `+` for key modifiers (Hennadii Stepanov)
6f1e162 qt: Fix headers (Hennadii Stepanov)

Pull request description:

  For Qt 5 all changes in this PR are refactoring. But for [Qt 6](bitcoin/bitcoin#24798) they are real bugfixes :)

  As I do not provide anyway way to build `bitcoin-qt` against Qt 6.2.4 fir now, suggesting to reviewers to verify changes for Qt 5 only.

ACKs for top commit:
  shaavan:
    ACK 6312575
  jarolrod:
    tACK 6312575

Tree-SHA512: ceee983192ddf62f09c1305458af3447ff0e3bd90311fa6328b139673bcaed3407dc0ce0b275028d4e0ca251d6b54dad40b48049211aeb251f65cbb4f5330834
@hebasto
Copy link
Member Author

hebasto commented Apr 12, 2022

Rebased on top of the bitcoin-core/gui#577.

@hebasto
Copy link
Member Author

hebasto commented Apr 15, 2022

Rebased on top of the bitcoin-core/gui#579.

laanwj added a commit to bitcoin-core/gui that referenced this pull request Jun 23, 2022
d8d99d0 qt6: Do not use deprecated high DPI attributes in Qt 6 (Hennadii Stepanov)
8927bb8 refactor: Fix style in `initTranslations()` function (Hennadii Stepanov)
ad73447 qt6: Do not use deprecated `QLibraryInfo::path` in Qt 6 (Hennadii Stepanov)
3f51d0b qt6: Fix type registration (Hennadii Stepanov)

Pull request description:

  One more step in migration to Qt 6.

  Could be tested with hebasto/bitcoin#3 or bitcoin/bitcoin#24798.

  No behavior change when compiling with Qt 5.

ACKs for top commit:
  laanwj:
    Code review ACK d8d99d0
  jarolrod:
    ACK d8d99d0

Tree-SHA512: e5f92a80f8622e5f95dd98a90783956a26d3c8382b9ca8e479fb6c152cfdc85a2f6084e78d463ceea1e0f0b3ac72d2b086c8ca24967b2b6070553317e9e3252e
@hebasto hebasto mentioned this pull request Aug 7, 2022
16 tasks
@fanquake
Copy link
Member

Can you rebase this to reflect the current state of / remaining changes needed for integration? Seems that some of the changes here have now made it in (via the GUI repo).

@hebasto
Copy link
Member Author

hebasto commented Aug 10, 2022

Can you rebase this to reflect the current state of / remaining changes needed for integration? Seems that some of the changes here have now made it in (via the GUI repo).

Done 🐅

@DrahtBot
Copy link
Contributor

DrahtBot commented Oct 4, 2022

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@fanquake
Copy link
Member

fanquake commented Dec 5, 2022

Should we close this (for now)? This is blocked on cmake, as we aren't going to introduce a --with-qt6 option, or the other build system changes here. Looks like fb872ed could possibly be PR'd on it's own? Otherwise I'm not sure this is reviewable / that useful to keep open?

@hebasto hebasto closed this Dec 5, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Dec 5, 2023
@hebasto hebasto deleted the 220406-qt6 branch October 25, 2024 09:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RFC: Migrate from Qt5 to Qt6's Qt5 compat
6 participants