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

build, qt: Add Wayland support for Linux builds with depends #22708

Closed
wants to merge 5 commits into from

Conversation

hebasto
Copy link
Member

@hebasto hebasto commented Aug 15, 2021

This PR adds the QtWayland module into the qt package in depends.

This change allows to build release binaries for Linux systems that can run natively—as a Wayland client—on modern desktops with Wayland compositors.

Closes #19950.


The diff for Qt "Configure summary" in depends:

@@ -85,11 +85,11 @@
     MarkdownReader ....................... yes
       Using system libmd4c ............... no
     MarkdownWriter ....................... no
-  EGL .................................... no
+  EGL .................................... yes
   OpenVG ................................. no
   OpenGL:
     Desktop OpenGL ....................... no
-    OpenGL ES 2.0 ........................ no
+    OpenGL ES 2.0 ........................ yes
     OpenGL ES 3.0 ........................ no
     OpenGL ES 3.1 ........................ no
     OpenGL ES 3.2 ........................ no
@@ -157,6 +157,24 @@
   WinRT Runner Tool ...................... no
 Qt Tools:
   QDoc ................................... no
+Qt Wayland Drivers:
+  EGL .................................... yes
+  Raspberry Pi ........................... no
+  XComposite EGL ......................... no
+  XComposite GLX ......................... no
+  DRM EGL ................................ no
+  libhybris EGL .......................... no
+  Linux dma-buf server buffer integration . no
+  Vulkan-based server buffer integration . no
+  Shm emulation server buffer integration . no
+Qt Wayland Client Shell Integrations:
+  xdg-shell .............................. yes
+  xdg-shell unstable v5 (deprecated) ..... no
+  xdg-shell unstable v6 .................. no
+  ivi-shell .............................. no
+  wl-shell (deprecated) .................. no
+Qt Wayland Client ........................ yes
+Qt Wayland Compositor .................... no
 
 Note: Also available for Linux: linux-clang linux-icc
 

Here is an excerpt from the log on Ubuntu 22.04 + GNOME:

$ QT_QPA_PLATFORM=wayland ./src/qt/bitcoin-qt -printtoconsole
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
2022-04-04T11:11:26Z Bitcoin Core version v23.99.0-8ffd5cae0b8a (release build)
2022-04-04T11:11:26Z Qt 5.15.3 (static), plugin=wayland (static)
2022-04-04T11:11:26Z Static plugins:
2022-04-04T11:11:26Z  QXcbIntegrationPlugin, version 331520
2022-04-04T11:11:26Z  QWaylandIntegrationPlugin, version 331520
2022-04-04T11:11:26Z  QWaylandEglClientBufferPlugin, version 331520
2022-04-04T11:11:26Z  QWaylandBradientDecorationPlugin, version 331520
2022-04-04T11:11:26Z  QWaylandXdgShellIntegrationPlugin, version 331520
2022-04-04T11:11:26Z Style: fusion / QFusionStyle
2022-04-04T11:11:26Z System: Ubuntu Jammy Jellyfish (development branch), x86_64-little_endian-lp64
2022-04-04T11:11:26Z Screen: eDP-1 1920x1080, pixel ratio=1.0
...

Please note that for the simplicity sake Wayland 1.19.0 has been used as in Wayland 1.20.0:

  • The autotools build system has been dropped. Meson has replaced it.

Notes about new runtime dependencies

Wayland compositor infrastructure:

Vendor neutral GL dispatch libraries:

https://ubuntu.com/security/cves and https://security-tracker.debian.org/tracker/ have no records about the packages mentioned above.

More details:

@DrahtBot
Copy link
Contributor

DrahtBot commented Aug 15, 2021

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

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #24798 ([POC] build: Hello Qt 6 by hebasto)
  • #24283 (build: Add show-% target for multi-line variables and debug info by hebasto)
  • #23969 (build: remove use of TARGET_OS and BUILD_OS by fanquake)

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.

depends/README.md Outdated Show resolved Hide resolved
@laanwj
Copy link
Member

laanwj commented Aug 16, 2021

Concept ACK. Thanks for working on this.

Adding a hard dependency on Mesa's OpenGL ES2 driver for building the dependencies is kind of meh here.

Speaking of which, does this add any NEEDED libraries to the bitcoin-qt binary? (e.g., does this pass the symbols check)? Or does it figure out that wayland/EGL/OpenGL ES2 is optional at least at run time, if not at build time?

@fanquake
Copy link
Member

Speaking of which, does this add any NEEDED libraries to the bitcoin-qt binary?

Yes it does. This change in it's current state adds the following runtime dependencies to bitcoin-qt:

qt/bitcoin-qt: NEEDED library libwayland-egl.so.1 is not allowed
qt/bitcoin-qt: NEEDED library libGLESv2.so.2 is not allowed
qt/bitcoin-qt: NEEDED library libwayland-cursor.so.0 is not allowed
qt/bitcoin-qt: NEEDED library libwayland-client.so.0 is not allowed
qt/bitcoin-qt: NEEDED library libEGL.so.1 is not allowed

@hebasto
Copy link
Member Author

hebasto commented Aug 17, 2021

@MarcoFalke Guix builds for the current state of this PR seem useless, so the "DrahtBot Guix build requested" label could be dropped.

maflcko pushed a commit that referenced this pull request Aug 19, 2021
…anged

f52a72a ci: Invalidate depends caches when sources have been changed (Hennadii Stepanov)
939640f ci: Reorder scripts to make git available before depends_sources_cache (Hennadii Stepanov)

Pull request description:

  On master (502d22c) the Cirrus CI do _not_ invalidate depends caches when their sources has been changed, i.e. source version updates, a new dependency etc.

  This behavior causes:
  - breaking CI build for Android APK  (see #22708)
  - the cache sizes growing

  It is assumed that caches could be invalidated via Cirrus CI API/GUI, but it is inconvenient and it does not work as expected in all cases.

  The common part of `fingerprint_key`s for both `depends_sources_cache` and `depends_built_cache` is the recent commit that changes sources in the `src/depends` sub-directory.

  For `depends_built_cache` additionally `CIRRUS_TASK_NAME` is used to avoid sharing of the same cache between tasks with different OSes and different `DEP_OPTS`.

  ---

  The `depends_sources` cache:
  - in master (502d22c)

  ![Screenshot from 2021-08-16 11-10-17](https://user-images.githubusercontent.com/32963518/129532207-56c09e06-c8d0-4f1e-a692-f198da011b20.png)

  - with this PR

  ![Screenshot from 2021-08-16 11-10-42](https://user-images.githubusercontent.com/32963518/129532253-f5426814-4f58-448f-ad52-da26cc312af7.png)

ACKs for top commit:
  MarcoFalke:
    cr ACK f52a72a
  Zero-1729:
    crACK f52a72a

Tree-SHA512: 0d14814ff308317c7c18cc725cf69055139030c207200af003872068f5567bd4b9c1f6783845d11742e314ebcc1dc5cae16aa86475376b623d921af5fcda14dd
@hebasto
Copy link
Member Author

hebasto commented Aug 19, 2021

Rebased 2ad38d8 -> ec94b62 (pr22708.06 -> pr22708.07) due to the conflict with #22710.

@hebasto
Copy link
Member Author

hebasto commented Sep 2, 2021

Rebased ec94b62 -> 2b4c1ca (pr22708.07 -> pr22708.08) due to the conflict with #22418.

@luke-jr
Copy link
Member

luke-jr commented Sep 16, 2021

  • Raspberry Pi ........................... no

Maybe we want that for ARM/AArch64 builds?

PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 7, 2022
ef77549 build: Include native_X.mk before X.mk (Hennadii Stepanov)

Pull request description:

  Unfortunately, our depends build system still lacks 100% reliability.

  On master (57982f4):
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=
  ```

  This PR fixes this issue:
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=0.7.0
  ```

  This PR split off from bitcoin#22552, bitcoin#22555 and bitcoin#22708.

ACKs for top commit:
  Zero-1729:
    tACK ef77549
  fanquake:
    ACK ef77549

Tree-SHA512: 9818277c82fcef778282a9fe854e48c6b6118cc757fcffa6fd4a2418e3de8b2a2b9d54e31804d22a53b28a28ffa5b8610c983add1969be0c4b3e13e0f2267271
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 7, 2022
ef77549 build: Include native_X.mk before X.mk (Hennadii Stepanov)

Pull request description:

  Unfortunately, our depends build system still lacks 100% reliability.

  On master (57982f4):
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=
  ```

  This PR fixes this issue:
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=0.7.0
  ```

  This PR split off from bitcoin#22552, bitcoin#22555 and bitcoin#22708.

ACKs for top commit:
  Zero-1729:
    tACK ef77549
  fanquake:
    ACK ef77549

Tree-SHA512: 9818277c82fcef778282a9fe854e48c6b6118cc757fcffa6fd4a2418e3de8b2a2b9d54e31804d22a53b28a28ffa5b8610c983add1969be0c4b3e13e0f2267271
@DrahtBot DrahtBot mentioned this pull request Apr 8, 2022
5 tasks
@hebasto
Copy link
Member Author

hebasto commented Apr 10, 2022

  • What are the new dependencies:

    • What do they do and why are they required?

    • Why do we need to bring them into depends as opposed to using system packages?

    • When should / how often do these new dependencies need updating?

I've updated the PR description with the new dependencies details.

@hebasto
Copy link
Member Author

hebasto commented Apr 10, 2022

Updated 8ffd5ca -> 46cfa61 (pr22708.24 -> pr22708.25):

  • pruned unused wayland artifacts in depends
  • code cleanups

@hebasto
Copy link
Member Author

hebasto commented Apr 10, 2022

Will our Qt binary run on more or less systems compared to now?

The former. It can run on Wayland desktops which do not support native X11 applications (tbh, I'm not aware of any such system).

If a system doesn't support wayland, does this automatically fallback to using the xcb backend?

A backend automatically depends on the XDG_SESSION_TYPE environment variable (which is ignored on GNOME), and can be overridden by the QT_QPA_PLATFORM environment variable. With this PR our release bitcoin-qt binary supports two values of the QT_QPA_PLATFORM environment variable: "xcb" and "wayland".

Will users be required to install dependencies before being able to run the binaries?

The runtime dependencies required to run bitcoin-qt natively on Wayland have already been described in doc/build-unix.md:

$ sudo apt install qtwayland5

I guess that Wayland-aware desktops already have this package been installed.

Does the introduction of new runtime dependencies increase Qt attack vectors in any way?

Hardly. There are no related CVEs so far.

How would / does any of this change with Qt 6?

I've looked through git log --oneline --no-merges 5.15..6.2.4 | grep -v 'Update dependencies' and https://bugreports.qt.io, and have not found anything significant.

@fanquake
Copy link
Member

Hardly. There are no related CVEs so far.

If you're loading more libraries at runtime your attack surface is increased.

How would / does any of this change with Qt 6?

I'm asking about Wayland support in general. Does it make a difference / would it be easier if we only supported it for Qt 6 onwards.

@hebasto
Copy link
Member Author

hebasto commented Apr 11, 2022

Updated 46cfa61 -> df5d7ae (pr22708.25 -> pr22708.26):

  • switched to the system libffi package instead of building it in depends

@hebasto hebasto force-pushed the 210815-wayland branch 3 times, most recently from ca953e1 to 46cfa61 Compare April 11, 2022 16:18
@hebasto
Copy link
Member Author

hebasto commented Apr 11, 2022

Updated 46cfa61 -> df5d7ae (pr22708.25 -> pr22708.26):

  • switched to the system libffi package instead of building it in depends

Reverted back as the libffi package must have host's architecture when cross-compiling.

PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 11, 2022
ef77549 build: Include native_X.mk before X.mk (Hennadii Stepanov)

Pull request description:

  Unfortunately, our depends build system still lacks 100% reliability.

  On master (57982f4):
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=
  ```

  This PR fixes this issue:
  ```
  $ make --no-print-directory -C depends print-capnp_version MULTIPROCESS=1
  capnp_version=0.7.0
  ```

  This PR split off from bitcoin#22552, bitcoin#22555 and bitcoin#22708.

ACKs for top commit:
  Zero-1729:
    tACK ef77549
  fanquake:
    ACK ef77549

Tree-SHA512: 9818277c82fcef778282a9fe854e48c6b6118cc757fcffa6fd4a2418e3de8b2a2b9d54e31804d22a53b28a28ffa5b8610c983add1969be0c4b3e13e0f2267271
@hebasto
Copy link
Member Author

hebasto commented Apr 11, 2022

Updated 46cfa61 -> 95bc748 (pr22708.25 -> pr22708.27):

  • switched to the system expat package instead of building the native_expat one in depends
  • minor cleanups

@hebasto
Copy link
Member Author

hebasto commented Apr 12, 2022

Guix builds on x86_64:

$ find guix-build-$(git rev-parse --short=12 HEAD)/output/ -type f -print0 | env LC_ALL=C sort -z | xargs -r0 sha256sum
d7febdff788ca87ce49c596c89bb8f9eabf92315184de9b23646887e3aa7fac5  guix-build-95bc74861315/output/aarch64-linux-gnu/SHA256SUMS.part
aa2a19ef7757c5629080ea8d5708e0ae577d3328aa19de0441543d9f5e4084f6  guix-build-95bc74861315/output/aarch64-linux-gnu/bitcoin-95bc74861315-aarch64-linux-gnu-debug.tar.gz
980de5ec642448c3b0c1e8dabe7180ecc5ab5fba4db80de9ee5adf6c256c7de7  guix-build-95bc74861315/output/aarch64-linux-gnu/bitcoin-95bc74861315-aarch64-linux-gnu.tar.gz
e7e702a1a427e40ef1ffe9fc8220dc36e27eb02e780b7140ac079db7958bd901  guix-build-95bc74861315/output/arm-linux-gnueabihf/SHA256SUMS.part
f5501c0afb4e38a87c74c712de8e08407f2d6c3bb7a3c326be3a92d794444c0d  guix-build-95bc74861315/output/arm-linux-gnueabihf/bitcoin-95bc74861315-arm-linux-gnueabihf-debug.tar.gz
43ccf701c97b382029c39704fe4fe2872c81974aa86d12d9913e8f2bf7ece52a  guix-build-95bc74861315/output/arm-linux-gnueabihf/bitcoin-95bc74861315-arm-linux-gnueabihf.tar.gz
94ef635b19b47dec8696788bbb0696cdb94f81bb763b37e30db256314123be4e  guix-build-95bc74861315/output/arm64-apple-darwin/SHA256SUMS.part
bcb0826e49ea67db787de78e5b88ab7331a76bfb54d12abd6eed177e18d55589  guix-build-95bc74861315/output/arm64-apple-darwin/bitcoin-95bc74861315-arm64-apple-darwin-unsigned.dmg
f3714ede1c40f0523926218a1fba32278f07d3d69295327dbef0feabb8d09339  guix-build-95bc74861315/output/arm64-apple-darwin/bitcoin-95bc74861315-arm64-apple-darwin-unsigned.tar.gz
40911c6c30da3ab6a85fd6c2ddff35140c8758b21e2a443e60f8d37fcd7199b7  guix-build-95bc74861315/output/arm64-apple-darwin/bitcoin-95bc74861315-arm64-apple-darwin.tar.gz
cb8791f4022c457692fc3744e7f5b240654e92093d6ab8eaea7c76650a55e349  guix-build-95bc74861315/output/dist-archive/bitcoin-95bc74861315.tar.gz
ff020b442ecd53e17ad9eb2350fa865a69094a99add786957c96d065d4dc9ce5  guix-build-95bc74861315/output/powerpc64-linux-gnu/SHA256SUMS.part
6cd72afe5b1f653dc1677cc0e610c198abdb45185d2e9f2d878fc7b3a7047ba5  guix-build-95bc74861315/output/powerpc64-linux-gnu/bitcoin-95bc74861315-powerpc64-linux-gnu-debug.tar.gz
688aac2906be71ca49091347d956de2cd447dad8df4ec6e7934855f02483c765  guix-build-95bc74861315/output/powerpc64-linux-gnu/bitcoin-95bc74861315-powerpc64-linux-gnu.tar.gz
297f43dccae5557fe9445a1c530f9bd03e65fe38a5766091bdd90741e9b6788f  guix-build-95bc74861315/output/powerpc64le-linux-gnu/SHA256SUMS.part
f00c6d35d63e370677c7d0c063e7563894a204f31003eefc0bc614a4ea77b7f0  guix-build-95bc74861315/output/powerpc64le-linux-gnu/bitcoin-95bc74861315-powerpc64le-linux-gnu-debug.tar.gz
13d0f3195eadfd5c1ae6d67044fea9e2000d2dd36b35a3e1d63728c3277b382f  guix-build-95bc74861315/output/powerpc64le-linux-gnu/bitcoin-95bc74861315-powerpc64le-linux-gnu.tar.gz
38c38c3012fa1b1bcfcf66d8afd75284b80a6672f6e329875c900a564d9d5775  guix-build-95bc74861315/output/riscv64-linux-gnu/SHA256SUMS.part
b2eb65d25a68f9635589d2b2343879c02768b28d6423f2ee140bbc873c3c083d  guix-build-95bc74861315/output/riscv64-linux-gnu/bitcoin-95bc74861315-riscv64-linux-gnu-debug.tar.gz
a98d56423305710e1567f21a8dda2f22bd37e5519d36b0edbda12be2ca34a1a6  guix-build-95bc74861315/output/riscv64-linux-gnu/bitcoin-95bc74861315-riscv64-linux-gnu.tar.gz
f018cc36c74b54e6b3e906d6860c1f419af197c43661b86fd0f05cd9b236863c  guix-build-95bc74861315/output/x86_64-apple-darwin/SHA256SUMS.part
0969d06078e177acac3e6775b48c194df6516b6598a0f84fea0baf38df564322  guix-build-95bc74861315/output/x86_64-apple-darwin/bitcoin-95bc74861315-x86_64-apple-darwin-unsigned.dmg
8814cde98bc048e2a1b9a1bb40b1097d50ae34524441008116853f73ae4fbda0  guix-build-95bc74861315/output/x86_64-apple-darwin/bitcoin-95bc74861315-x86_64-apple-darwin-unsigned.tar.gz
42d42cad94130a56183f6e6d871b674ecabf5ee3074e54c7476c8f0f7a655fb2  guix-build-95bc74861315/output/x86_64-apple-darwin/bitcoin-95bc74861315-x86_64-apple-darwin.tar.gz
a165db4eff6b8917375ae6296e2944668c46d9d8bbd2b9dd1e37c4aca53d89d7  guix-build-95bc74861315/output/x86_64-linux-gnu/SHA256SUMS.part
c1c85afbf630deee79e7ae8e425e0e3a1f9b2d57cc3997ec747a14e21a36b18e  guix-build-95bc74861315/output/x86_64-linux-gnu/bitcoin-95bc74861315-x86_64-linux-gnu-debug.tar.gz
b6588a01b020df0e57cd94ebb24e0d413a758f081dc0070c024027d92ce180bd  guix-build-95bc74861315/output/x86_64-linux-gnu/bitcoin-95bc74861315-x86_64-linux-gnu.tar.gz
1edae9c35b4bb998df51474f87f8cf38e3521e5fa685c63369ff0ece52c001b4  guix-build-95bc74861315/output/x86_64-w64-mingw32/SHA256SUMS.part
d7e9ec896fc93010d337556b29ec13bf69ecc508b5779990b1b9e01a9723b32c  guix-build-95bc74861315/output/x86_64-w64-mingw32/bitcoin-95bc74861315-win64-debug.zip
19b969d82224cc5f9f4fabdd970e991d300a2254e1b38bc336eb13619c97249f  guix-build-95bc74861315/output/x86_64-w64-mingw32/bitcoin-95bc74861315-win64-setup-unsigned.exe
51414e682194324bc3bc68ea1ae2eda5ccc51451600c57713eac243b0769fecb  guix-build-95bc74861315/output/x86_64-w64-mingw32/bitcoin-95bc74861315-win64-unsigned.tar.gz
ff8f1e36746e93aaa09a5e384509b41b1e8c44da5dd91fd73b03fd8bb62f374b  guix-build-95bc74861315/output/x86_64-w64-mingw32/bitcoin-95bc74861315-win64.zip

@fanquake
Copy link
Member

Concept ~0. Without some sort of plan / outline for what we are doing with Qt going forward, I'm not convinced this should be merged. For many years we've been trying to reduce the number of dependencies we need to manage, and the scope of features/things that need to be maintained in this repository, and this change moves us in the opposite direction.

Not only are we now supposedly going to return to supporting two major versions of Qt simultaneously (the benefit of which is not clear given basically all system packages of Qt 6 are currently unusable in our build system), but at the same time, this change introduces a second Linux graphics backend to support, along with more packages in depends, new runtime dependencies, and the scope for adding even more drivers/features in the future.

If there was some overwhelming demand for us to support it (which I don't see, and the majority of people who care about this are likely already self-compiling), and a plan to migrate towards say just supporting qt6+wayland, then this may be more interesting.

@hebasto
Copy link
Member Author

hebasto commented Apr 17, 2022

Concept ~0. Without some sort of plan / outline for what we are doing with Qt going forward, I'm not convinced this should be merged. For many years we've been trying to reduce the number of dependencies we need to manage, and the scope of features/things that need to be maintained in this repository, and this change moves us in the opposite direction.

Not only are we now supposedly going to return to supporting two major versions of Qt simultaneously (the benefit of which is not clear given basically all system packages of Qt 6 are currently unusable in our build system), but at the same time, this change introduces a second Linux graphics backend to support, along with more packages in depends, new runtime dependencies, and the scope for adding even more drivers/features in the future.

If there was some overwhelming demand for us to support it (which I don't see, and the majority of people who care about this are likely already self-compiling), and a plan to migrate towards say just supporting qt6+wayland, then this may be more interesting.

Even reducing new packages in depends to wayland and libglvnd only does not invalidate other mentioned points.

@hebasto hebasto closed this Apr 17, 2022
@bitcoin bitcoin locked and limited conversation to collaborators Apr 17, 2023
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.

[Linux] Add wayland support
7 participants