-
Notifications
You must be signed in to change notification settings - Fork 6
cmake: Build test_bitcoin-qt
executable
#101
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
Conversation
3c071c2
to
197fcce
Compare
197fcce
to
a0ca82e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed while poking around that cmake adds:
CMakeFiles/test_bitcoin-qt.dir/__/__/__/depends/x86_64-pc-linux-gnu/lib/cmake/Qt5Gui/Qt5Gui_QXcbIntegrationPlugin_Import.cpp.o
The contents of Qt5Gui_QXcbIntegrationPlugin_Import.cpp
are:
#include <QtPlugin>
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)
So I think we're doing that twice?
It seems we should either turn that off somehow, or remove the import from our code?
.github/workflows/cmake.yml
Outdated
@@ -448,7 +448,7 @@ jobs: | |||
|
|||
- name: Test Release configuration | |||
run: | | |||
ctest --test-dir build -j $env:NUMBER_OF_PROCESSORS -C Release | |||
ctest --test-dir build -j $env:NUMBER_OF_PROCESSORS -C Release --exclude-regex test_bitcoin-qt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? Because it requires a gui? Could you please add a comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A "TODO" comment with links to the issues has been added.
ba5caff
to
67ea3ab
Compare
Nice catch! It happens on the staging branch as well. Investigating... |
67ea3ab
to
fcff961
Compare
Thank you for this insight! Please consider #103. This PR has been rebased on #103 and drafted for now. |
fcff961
to
31bbd21
Compare
On Windows, the statically linked Specifically, This behavior differs from our custom static Qt build in the master branch, which does not crash :) I believe that the root of the difference in behaviour lies in the following Qt configuration options:
There are two obvious workarounds for this unfortunate issue:
Thought? cc @sipsorcery |
+1 to disable the tests for the dynamically linked version. Reasoning being that the Windows build is for "developers only" and tracking down Qt bugs for a non-production build doesn't seem to offer a good effort to reward tradeoff. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK cb1a44f
Tested on Ubuntu 22.04.
...
Tests:
test_bitcoin ........................ ON
test_bitcoin-qt ..................... ON
...
./build/src/qt/test/test_bitcoin-qt
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
********* Start testing of AppTests *********
Config: Using QtTest library 5.15.3, Qt 5.15.3 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 11.3.0), ubuntu 22.04
...
All tests passed.
~InitExecutor : Stopping thread
~InitExecutor : Stopped thread
The mentioned issues have been fixed in bitcoin-core/gui#803. Please review it as well :) |
f3b3928 fixup! cmake: Build `bitcoin-qt` executable (Hennadii Stepanov) 3c27391 qt: Drop `Q_IMPORT_PLUGIN` macros (Hennadii Stepanov) edc8c18 qt, build: Drop `QT_STATICPLUGIN` macro (Hennadii Stepanov) Pull request description: 1. When using CMake, each plugin comes with a C++ stub file that automatically initializes the static plugin. Consequently, any target that links against a plugin has this C++ file added to its `SOURCES`, which makes the removed code redundant and [duplicates](#103 (comment)) the included plugins. For example, on the staging branch @ 1a976ca: ``` 2024-03-01T10:51:26Z Bitcoin Core version v26.99.0-1a976ca427ca (release build) 2024-03-01T10:51:26Z Qt 5.15.11 (static), plugin=windows (static) 2024-03-01T10:51:26Z Static plugins: 2024-03-01T10:51:26Z QWindowsIntegrationPlugin, version 331520 2024-03-01T10:51:26Z QWindowsVistaStylePlugin, version 331520 2024-03-01T10:51:26Z QWindowsVistaStylePlugin, version 331520 2024-03-01T10:51:26Z QWindowsIntegrationPlugin, version 331520 2024-03-01T10:51:26Z Style: windowsvista / QWindowsVistaStyle 2024-03-01T10:51:26Z System: Windows 11 Version 2009, x86_64-little_endian-llp64 2024-03-01T10:51:26Z Screen: \\.\DISPLAY1 1920x1080, pixel ratio=1.0 ``` Initially noticed in #101 (review). Here are `LogQtInfo()` outputs in the `debug.log`: - `x86_64-pc-linux-gnu`: ``` 2024-02-25T10:15:18Z Qt 5.15.11 (static), plugin=xcb (static) 2024-02-25T10:15:18Z Static plugins: 2024-02-25T10:15:18Z QXcbIntegrationPlugin, version 331520 2024-02-25T10:15:18Z Style: fusion / QFusionStyle 2024-02-25T10:15:18Z System: Ubuntu 22.04.4 LTS, x86_64-little_endian-lp64 2024-02-25T10:15:18Z Screen: XWAYLAND0 1920x1080, pixel ratio=1.0 ``` - `x86_64-w64-mingw32` ``` 2024-02-25T10:44:54Z Qt 5.15.11 (static), plugin=windows (static) 2024-02-25T10:44:54Z Static plugins: 2024-02-25T10:44:54Z QWindowsVistaStylePlugin, version 331520 2024-02-25T10:44:54Z QWindowsIntegrationPlugin, version 331520 2024-02-25T10:44:54Z Style: windowsvista / QWindowsVistaStyle 2024-02-25T10:44:54Z System: Windows 11 Version 2009, x86_64-little_endian-llp64 2024-02-25T10:44:54Z Screen: \\.\DISPLAY1 1600x900, pixel ratio=1.0 ``` --- 2. Apparently, Qt tries to link its default set of static plugins to every suitable target. When building on Windows, it leads to an insane list of plugins: ``` 2024-03-01T19:11:04Z Qt 5.15.10 (static), plugin=windows (dynamic) 2024-03-01T19:11:04Z Static plugins: 2024-03-01T19:11:04Z QGifPlugin, version 331520 2024-03-01T19:11:04Z QICNSPlugin, version 331520 2024-03-01T19:11:04Z QICOPlugin, version 331520 2024-03-01T19:11:04Z QJpegPlugin, version 331520 2024-03-01T19:11:04Z QSvgIconPlugin, version 331520 2024-03-01T19:11:04Z QSvgPlugin, version 331520 2024-03-01T19:11:04Z QTgaPlugin, version 331520 2024-03-01T19:11:04Z QTiffPlugin, version 331520 2024-03-01T19:11:04Z QWbmpPlugin, version 331520 2024-03-01T19:11:04Z QWebpPlugin, version 331520 2024-03-01T19:11:04Z QWindowsIntegrationPlugin, version 331520 2024-03-01T19:11:04Z QWindowsVistaStylePlugin, version 331520 ``` Therefore, in this PR, we prevent Qt from such a behaviour. ACKs for top commit: m3dwards: ACK f3b3928 Tree-SHA512: e77aad13349b6938d1c4c48c12a2e32226ef9b2c9e52e021df94a9a21b6bd0e42685f73f032eb5bfded9438f16edf2badac775200e941e18d73da85b0b817d3c
Find out whether Qt is static explicitly as it's done in the master branch.
Reworked. Rebased. Ready for review. The PR description has been updated with Windows/MSVC specific notes. Friendly ping @TheCharlatan @m3dwards @pablomartin4btc @vasild; and @sipsorcery (as a Windows expert) :) |
With a dynamic linked build on Windows I get:
|
Yes. That happens when a user has no privilege to create symbolic links. This issue is not specific to this PR change. However, it should be fixed. |
tACK 4da7634. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re tACK e4b4c98
On Ubuntu 22.04.
./build/src/qt/test/test_bitcoin-qt
...
All tests passed.
...
ctest -j $(nproc)
...
100% tests passed, 0 tests failed out of 128
Total Test time (real) = 22.90 sec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
re tACK e4b4c98
Tested cross-building for Windows on WSL Ubuntu 22.04.
All tests passed.
(running test_bitcoin-qt.exe
successfully in both WSL and Windows 11 Pro)
593b130 cmake: Add `libqrencode` optional package support (Hennadii Stepanov) Pull request description: A new configuration option `WITH_QRENCODE` has been added. This PR, along with #101, concludes the GUI-specific part of the new CMake-based build system. ACKs for top commit: pablomartin4btc: tACK 593b130 Tree-SHA512: ba21d65ccff59e29585bd6ce092216034abcbd9866e5452fe6a1b1e2f0957dc3c48a204c170ce443888852ae165be7cb1846483b031b8cf49e6d986dec722f88
A new configuration option is
BUILD_GUI_TESTS
.Native Windows / MSVC Notes:
-opengl dynamic
, which makes the "minimal" platform plugin unusable due to internal Qt bugs.ctest
workarounds this issue by setting the environment variableQT_QPA_PLATFORM=windows
.x64-windows
andx64-windows-static
triplets. Please note thattest_bitcoin-qt.exe
fails to run in the CI environment on the master branch.test_bitcoin-qt.exe
directly (not driven byctest
).