Re: [PATCH v2 1/1] kconfig: port qconf to work with Qt6 in addition to Qt5

From: Masahiro Yamada
Date: Wed Aug 02 2023 - 22:34:30 EST


On Tue, Aug 1, 2023 at 11:07 PM Boris Kolpackov <boris@xxxxxxxxxxxxxxxxx> wrote:
>
> Tested with Qt5 5.15 and Qt6 6.4. Note that earlier versions of Qt5
> are no longer guaranteed to work.
>
> Signed-off-by: Boris Kolpackov <boris@xxxxxxxxxxxxxxxxx>
> ---


$ make xconfig
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/images.o
HOSTCC scripts/kconfig/confdata.o
HOSTCC scripts/kconfig/expr.o
LEX scripts/kconfig/lexer.lex.c
YACC scripts/kconfig/parser.tab.[ch]
HOSTCC scripts/kconfig/lexer.lex.o
HOSTCC scripts/kconfig/menu.o
HOSTCC scripts/kconfig/parser.tab.o
HOSTCC scripts/kconfig/preprocess.o
HOSTCC scripts/kconfig/symbol.o
HOSTCC scripts/kconfig/util.o
HOSTCXX scripts/kconfig/qconf.o
In file included from /usr/include/x86_64-linux-gnu/qt6/QtGui/qtguiglobal.h:7,
from /usr/include/x86_64-linux-gnu/qt6/QtGui/qaction.h:7,
from /usr/include/x86_64-linux-gnu/qt6/QtGui/QAction:1,
from scripts/kconfig/qconf.cc:7:
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:106:6: error:
#error "Qt requires a C++17 compiler"
106 | # error "Qt requires a C++17 compiler"
| ^~~~~
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:491:11: warning:
inline variables are only available with ‘-std=c++17’ or
‘-std=gnu++17’ [-Wc++17-extensions]
491 | constexpr inline Deprecated_t Deprecated = {};
| ^~~~~~
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:26: error:
‘enable_if_t’ in namespace ‘std’ does not name a template type
1009 | typename = std::enable_if_t<std::is_arithmetic_v<T>
&& std::is_arithmetic_v<U> &&
| ^~~~~~~~~~~
/usr/include/x86_64-linux-gnu/qt6/QtCore/qglobal.h:1009:21: note:
‘std::enable_if_t’ is only available from C++14 onwards
1009 | typename = std::enable_if_t<std::is_arithmetic_v<T>
&& std::is_arithmetic_v<U> &&
| ^~~
[ snip tons of errors]







The first error says, #error "Qt requires a C++17 compiler"


Right, g++ defaults to this:

$ g++ --version
g++ (Debian 12.2.0-14) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.






It worked for me with the following fix-up applied.



diff --git a/scripts/kconfig/qconf-cfg.sh b/scripts/kconfig/qconf-cfg.sh
index a1b718a7366c..a5d5ed008dc3 100755
--- a/scripts/kconfig/qconf-cfg.sh
+++ b/scripts/kconfig/qconf-cfg.sh
@@ -17,6 +17,8 @@ fi

if ${HOSTPKG_CONFIG} --exists $PKG6; then
${HOSTPKG_CONFIG} --cflags ${PKG6} > ${cflags}
+ # Qt6 requires a C++17 compiler
+ echo -std=c++17 >> ${cflags}
${HOSTPKG_CONFIG} --libs ${PKG6} > ${libs}
${HOSTPKG_CONFIG} --variable=libexecdir Qt6Core > ${bin}
exit 0






--
Best Regards
Masahiro Yamada