-
Notifications
You must be signed in to change notification settings - Fork 36.2k
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: Check QT library version #15706
Conversation
Concept ACK, can you take a look at the build system changes please @theuni |
9d74d35
to
25e43fc
Compare
I tested it on an affected machine. Are we in time to add back the 0.18.2 tag? |
Concept ACK. |
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.
Please quote macro arguments with [
and ]
consistently.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
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. |
Fixes issue bitcoin#15688 Due to a bug, in systems using pkg-config, the version of the Qt library is not checked at configure time. Without any check, when Qt version is not supported, the build process stops with unexpleined errors. This PR introduces the control of the version of the QT library, returning a warning or an error at configure time, when the installed version is not supported.
25e43fc
to
35c46bc
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.
ACK 35c46bc, tested on Linux Mint 19.3 with system Qt 5.9.5:
$ qmake -qt=qt5_system -v
QMake version 3.1
Using Qt version 5.9.5 in /usr/lib/x86_64-linux-gnu
Tests with pkg-config
usage
$ ./autogen.sh
$ ./configure
...
checking for QT5... yes
checking for QT_TEST... yes
checking for QT_DBUS... yes
checking for Qt >= 5.5.1... yes
checking for Qt >= 5.8.0... yes
checking for static Qt... no
checking whether -fPIE can be used with this Qt config... no
checking for moc-qt5... no
checking for moc5... no
checking for moc... /usr/lib/qt5/bin/moc
checking for uic-qt5... no
checking for uic5... no
checking for uic... /usr/lib/qt5/bin/uic
checking for rcc-qt5... no
checking for rcc5... no
checking for rcc... /usr/lib/qt5/bin/rcc
checking for lrelease-qt5... no
checking for lrelease5... no
checking for lrelease... /usr/lib/qt5/bin/lrelease
checking for lupdate-qt5... no
checking for lupdate5... no
checking for lupdate... /usr/lib/qt5/bin/lupdate
checking whether to build Bitcoin Core GUI... yes (Qt5)
...
To test alternative behavior the following patch was applied:
$ git diff
diff --git a/build-aux/m4/bitcoin_qt.m4 b/build-aux/m4/bitcoin_qt.m4
index 019a3ebfb..be20602f0 100644
--- a/build-aux/m4/bitcoin_qt.m4
+++ b/build-aux/m4/bitcoin_qt.m4
@@ -262,7 +262,7 @@ dnl Internal. Check included version of Qt against minimum specified in doc/depe
dnl Requires: INCLUDES must be populated as necessary.
dnl Output: bitcoin_cv_qt_minimumrequired=yes|no
AC_DEFUN([_BITCOIN_QT_CHECK_MINIMUM_REQUIRED],[
- AC_CACHE_CHECK(for Qt >= 5.5.1, bitcoin_cv_qt_minimumrequired,[
+ AC_CACHE_CHECK(for Qt >= 5.9.6, bitcoin_cv_qt_minimumrequired,[
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <QtCore/qconfig.h>
#ifndef QT_VERSION
@@ -270,7 +270,7 @@ AC_DEFUN([_BITCOIN_QT_CHECK_MINIMUM_REQUIRED],[
#endif
]],
[[
- #if QT_VERSION < 0x050501
+ #if QT_VERSION < 0x050906
choke
#endif
]])],
@@ -434,8 +434,8 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
fi
])
BITCOIN_QT_CHECK([
- AC_CACHE_CHECK(for Qt >= 5.5.1,bitcoin_cv_qt_minimumrequired,
- PKG_CHECK_EXISTS(Qt5Core < 5.5.1,[bitcoin_cv_qt_minimumrequired=no],[bitcoin_cv_qt_minimumrequired=yes])
+ AC_CACHE_CHECK(for Qt >= 5.9.6,bitcoin_cv_qt_minimumrequired,
+ PKG_CHECK_EXISTS(Qt5Core < 5.9.6,[bitcoin_cv_qt_minimumrequired=no],[bitcoin_cv_qt_minimumrequired=yes])
)
])
BITCOIN_QT_CHECK([
$ ./autogen.sh
$ ./configure
checking for QT5... yes
checking for QT_TEST... yes
checking for QT_DBUS... yes
checking for Qt >= 5.9.6... no
checking for Qt >= 5.8.0... yes
configure: WARNING: Qt version not supported; bitcoin-qt frontend will not be built
checking whether to build Bitcoin Core GUI... no
...
$ ./autogen.sh
$ ./configure --with-gui=qt5
...
checking for QT5... yes
checking for QT_TEST... yes
checking for QT_DBUS... yes
checking for Qt >= 5.9.6... no
checking for Qt >= 5.8.0... yes
configure: error: Qt version not supported
Tests without pkg-config
usage
For these tests the following patch was applied:
$ git diff configure.ac
diff --git a/configure.ac b/configure.ac
index 18f3104ac..d6c8745c7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -479,7 +479,7 @@ AC_ARG_WITH([daemon],
[build_bitcoind=$withval],
[build_bitcoind=yes])
-use_pkgconfig=yes
+use_pkgconfig=no
case $host in
*mingw*)
and --with-qt-incdir
command-line option was passed to configure
script.
$ ./autogen.sh
$ ./configure --with-qt-incdir=/usr/include/x86_64-linux-gnu/qt5
...
checking for Qt >= 5.5.1... yes
checking for >= Qt 5.8... yes
...
checking whether to build Bitcoin Core GUI... yes (Qt5)
...
$ ./autogen.sh
$ ./configure --with-qt-incdir=/usr/include/x86_64-linux-gnu/qt5
...
checking for Qt >= 5.9.6... no
checking for >= Qt 5.8... yes
...
configure: WARNING: Qt version not supported; bitcoin-qt frontend will not be built
checking whether to build Bitcoin Core GUI... no
...
@@ -434,14 +433,25 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ | |||
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) | |||
fi | |||
]) | |||
BITCOIN_QT_CHECK([ | |||
AC_CACHE_CHECK(for Qt >= 5.5.1,bitcoin_cv_qt_minimumrequired, | |||
PKG_CHECK_EXISTS(Qt5Core < 5.5.1,[bitcoin_cv_qt_minimumrequired=no],[bitcoin_cv_qt_minimumrequired=yes]) |
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.
non-blocking nit, for consistency with "for Qt >= 5.5.1":
PKG_CHECK_EXISTS(Qt5Core < 5.5.1,[bitcoin_cv_qt_minimumrequired=no],[bitcoin_cv_qt_minimumrequired=yes]) | |
PKG_CHECK_EXISTS(Qt5Core >= 5.5.1,[bitcoin_cv_qt_minimumrequired=yes],[bitcoin_cv_qt_minimumrequired=no]) |
]) | ||
BITCOIN_QT_CHECK([ | ||
AC_CACHE_CHECK(for Qt >= 5.8.0,bitcoin_cv_qt58, | ||
PKG_CHECK_EXISTS(Qt5Core < 5.8.0,[bitcoin_cv_qt58=no],[bitcoin_cv_qt58=yes]) |
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.
non-blocking nit, for consistency with "for Qt >= 5.8.0":
PKG_CHECK_EXISTS(Qt5Core < 5.8.0,[bitcoin_cv_qt58=no],[bitcoin_cv_qt58=yes]) | |
PKG_CHECK_EXISTS(Qt5Core >= 5.8.0,[bitcoin_cv_qt58=yes],[bitcoin_cv_qt58=no]) |
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[ | ||
dnl Output: bitcoin_cv_qt_minimumrequired=yes|no | ||
AC_DEFUN([_BITCOIN_QT_CHECK_MINIMUM_REQUIRED],[ | ||
AC_CACHE_CHECK(for Qt >= 5.5.1, bitcoin_cv_qt_minimumrequired,[ |
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.
non-blocking nit: here and in other places mind quoting the first argument:
AC_CACHE_CHECK(for Qt >= 5.5.1, bitcoin_cv_qt_minimumrequired,[ | |
AC_CACHE_CHECK([for Qt >= 5.5.1], bitcoin_cv_qt_minimumrequired,[ |
?
dnl Requires: INCLUDES must be populated as necessary. | ||
dnl Output: bitcoin_cv_qt58=yes|no | ||
AC_DEFUN([_BITCOIN_QT_CHECK_QT58],[ | ||
AC_CACHE_CHECK(for > Qt 5.7, bitcoin_cv_qt58,[ | ||
AC_CACHE_CHECK(for >= Qt 5.8, bitcoin_cv_qt58,[ |
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.
AC_CACHE_CHECK(for >= Qt 5.8, bitcoin_cv_qt58,[ | |
AC_CACHE_CHECK([for >= Qt 5.8], bitcoin_cv_qt58,[ |
@@ -434,14 +433,25 @@ AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[ | |||
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no]) | |||
fi | |||
]) | |||
BITCOIN_QT_CHECK([ | |||
AC_CACHE_CHECK(for Qt >= 5.5.1,bitcoin_cv_qt_minimumrequired, |
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.
AC_CACHE_CHECK(for Qt >= 5.5.1,bitcoin_cv_qt_minimumrequired, | |
AC_CACHE_CHECK([for Qt >= 5.5.1],bitcoin_cv_qt_minimumrequired, |
) | ||
]) | ||
BITCOIN_QT_CHECK([ | ||
AC_CACHE_CHECK(for Qt >= 5.8.0,bitcoin_cv_qt58, |
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.
AC_CACHE_CHECK(for Qt >= 5.8.0,bitcoin_cv_qt58, | |
AC_CACHE_CHECK([for Qt >= 5.8.0],bitcoin_cv_qt58, |
It seems we should consider an alternative solution based on #18297. |
I agree that something like #18297 is the way forward here, so I'm going to close. This also would not be getting backported to 0.18 or 0.19 at this point. Thanks for the contribution & sorry it didn't make it into the repo. |
4af4672 build, qt: Add Qt version checking (Hennadii Stepanov) 30e336f build: Drop unused bitcoin_cv_qt58 (Hennadii Stepanov) Pull request description: Now `configure` script checks that Qt version is not less then minimum required (currently [5.5.1](#15393)). This PR is an alternative to #15706 (see #15706 (comment)). Closes #15688. The first commit removes dead code (see #18297 (comment)). ACKs for top commit: fanquake: ACK 4af4672 - this looks ok. I've tested this with Qt 5.15.0 and Qt 5.7.1 system libs, as well as 5.9.8 from depends. Tree-SHA512: 8e3b82fa3a98926814923331038185633fabad962c271f31bd158e1ab293dcde52ab1dbf997745540a9ed27e16835cf5b5f3701d405876d877fa561eb03cc619
4af4672 build, qt: Add Qt version checking (Hennadii Stepanov) 30e336f build: Drop unused bitcoin_cv_qt58 (Hennadii Stepanov) Pull request description: Now `configure` script checks that Qt version is not less then minimum required (currently [5.5.1](bitcoin#15393)). This PR is an alternative to bitcoin#15706 (see bitcoin#15706 (comment)). Closes bitcoin#15688. The first commit removes dead code (see bitcoin#18297 (comment)). ACKs for top commit: fanquake: ACK 4af4672 - this looks ok. I've tested this with Qt 5.15.0 and Qt 5.7.1 system libs, as well as 5.9.8 from depends. Tree-SHA512: 8e3b82fa3a98926814923331038185633fabad962c271f31bd158e1ab293dcde52ab1dbf997745540a9ed27e16835cf5b5f3701d405876d877fa561eb03cc619
4af4672 build, qt: Add Qt version checking (Hennadii Stepanov) 30e336f build: Drop unused bitcoin_cv_qt58 (Hennadii Stepanov) Pull request description: Now `configure` script checks that Qt version is not less then minimum required (currently [5.5.1](bitcoin#15393)). This PR is an alternative to bitcoin#15706 (see bitcoin#15706 (comment)). Closes bitcoin#15688. The first commit removes dead code (see bitcoin#18297 (comment)). ACKs for top commit: fanquake: ACK 4af4672 - this looks ok. I've tested this with Qt 5.15.0 and Qt 5.7.1 system libs, as well as 5.9.8 from depends. Tree-SHA512: 8e3b82fa3a98926814923331038185633fabad962c271f31bd158e1ab293dcde52ab1dbf997745540a9ed27e16835cf5b5f3701d405876d877fa561eb03cc619
4af4672 build, qt: Add Qt version checking (Hennadii Stepanov) 30e336f build: Drop unused bitcoin_cv_qt58 (Hennadii Stepanov) Pull request description: Now `configure` script checks that Qt version is not less then minimum required (currently [5.5.1](bitcoin#15393)). This PR is an alternative to bitcoin#15706 (see bitcoin#15706 (comment)). Closes bitcoin#15688. The first commit removes dead code (see bitcoin#18297 (comment)). ACKs for top commit: fanquake: ACK 4af4672 - this looks ok. I've tested this with Qt 5.15.0 and Qt 5.7.1 system libs, as well as 5.9.8 from depends. Tree-SHA512: 8e3b82fa3a98926814923331038185633fabad962c271f31bd158e1ab293dcde52ab1dbf997745540a9ed27e16835cf5b5f3701d405876d877fa561eb03cc619
Fixes #15688
Due to a bug, the version of the QT library was not checked at configure time for systems using pkg-config. Without any check at configure time, the build process stopped with unexplicative errors on systems with QT versions not supported.
This PR introduces the control of the version of the QT library, with a warning, or an error, at configure time, if the installed version is not supported.
Tested in all the following cases (all combinations):
--with-gui
and--without-gui
on configure command lineSince the current 0.18 branch is affected, with compilation errors on some systems, like Debian Jessie (EOL on June 30, 2020), I suggest to include this low impact PR in 0.18.