nedit-ng icon indicating copy to clipboard operation
nedit-ng copied to clipboard

Qt6

Open 1div0 opened this issue 4 years ago • 12 comments

Hi++ Evan!

Yesterday I've successfully compiled Qt 6 and now I am trying to adapt nedit-ng.

[  1%] Building CXX object Regex/CMakeFiles/Regex.dir/Execute.cpp.o
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp: In lambda function:
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp:153:108: error: no matching function for call to ‘safe_ctype<tolower>(char&)’
  153 |   count = greedy_consume(input_str, max_cmp, [operand](char ch) { return *operand == safe_ctype<tolower>(ch); });
      |                                                                                                            ^
In file included from /1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp:10:
/1TB/usr/src/github.com/1div0/nedit-ng/Util/include/Util/utils.h:6:15: note: candidate: ‘template<int (& F)(int), class Ch> constexpr int safe_ctype(Ch)’
    6 | constexpr int safe_ctype(Ch c) {
      |               ^~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/include/Util/utils.h:6:15: note:   template argument deduction/substitution failed:
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp:153:108: error: ‘(int (&)(int))tolower’ is not a valid template argument for type ‘int (&)(int)’
  153 |   count = greedy_consume(input_str, max_cmp, [operand](char ch) { return *operand == safe_ctype<tolower>(ch); });
      |                                                                                                            ^
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp:153:108: note: it must be the name of a function with external linkage
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp: In lambda function:
/1TB/usr/src/github.com/1div0/nedit-ng/Regex/Execute.cpp:176:90: error: no matching function for call to ‘safe_ctype<isalnum>(char&)’
  176 |   count = greedy_consume(input_str, max_cmp, [](char ch) { return (safe_ctype<isalnum>(ch) || ch == '_'); });

Please review.

Thanks.

Cheers, Peter

1div0 avatar Nov 12 '20 10:11 1div0

I'll check into it, THAT part looks like an easy fix. Hopefully, Qt6 is decently backward compatible overall.

eteran avatar Nov 12 '20 15:11 eteran

OK, That particular issue regarding safe_ctype should be fixed in master now. I was able to compile my it with C++17 enabled (Qt5 though)

eteran avatar Nov 12 '20 17:11 eteran

C001. That was fast.

However,

[ 32%] Building CXX object Util/CMakeFiles/Util.dir/User.cpp.o
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp: In member function ‘void Input::consume(const QRegularExpression&)’:
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:225:113: warning: ‘QRegularExpression::AnchoredMatchOption’ is deprecated: Use AnchorAtOffsetMatchOption instead [-Wdeprecated-declarations]
  225 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:115:9: note: declared here
  115 |         AnchoredMatchOption Q_DECL_ENUMERATOR_DEPRECATED_X(
      |         ^~~~~~~~~~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:225:113: warning: ‘QRegularExpression::AnchoredMatchOption’ is deprecated: Use AnchorAtOffsetMatchOption instead [-Wdeprecated-declarations]
  225 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:115:9: note: declared here
  115 |         AnchoredMatchOption Q_DECL_ENUMERATOR_DEPRECATED_X(
      |         ^~~~~~~~~~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:225:132: error: no matching function for call to ‘QRegularExpression::match(const QString*&, int&, QRegularExpression::MatchType, QRegularExpression::MatchOption) const’
  225 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                                    ^
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:121:29: note: candidate: ‘QRegularExpressionMatch QRegularExpression::match(const QString&, qsizetype, QRegularExpression::MatchType, QRegularExpression::MatchOptions) const’
  121 |     QRegularExpressionMatch match(const QString &subject,
      |                             ^~~~~
/usr/local/include/QtCore/qregularexpression.h:121:50: note:   no known conversion for argument 1 from ‘const QString*’ to ‘const QString&’
  121 |     QRegularExpressionMatch match(const QString &subject,
      |                                   ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/include/QtCore/qregularexpression.h:126:29: note: candidate: ‘QRegularExpressionMatch QRegularExpression::match(QStringView, qsizetype, QRegularExpression::MatchType, QRegularExpression::MatchOptions) const’
  126 |     QRegularExpressionMatch match(QStringView subjectView,
      |                             ^~~~~
/usr/local/include/QtCore/qregularexpression.h:126:47: note:   no known conversion for argument 1 from ‘const QString*’ to ‘QStringView’
  126 |     QRegularExpressionMatch match(QStringView subjectView,
      |                                   ~~~~~~~~~~~~^~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp: In member function ‘bool Input::match(const QRegularExpression&, QString*)’:
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:239:113: warning: ‘QRegularExpression::AnchoredMatchOption’ is deprecated: Use AnchorAtOffsetMatchOption instead [-Wdeprecated-declarations]
  239 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:115:9: note: declared here
  115 |         AnchoredMatchOption Q_DECL_ENUMERATOR_DEPRECATED_X(
      |         ^~~~~~~~~~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:239:113: warning: ‘QRegularExpression::AnchoredMatchOption’ is deprecated: Use AnchorAtOffsetMatchOption instead [-Wdeprecated-declarations]
  239 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:115:9: note: declared here
  115 |         AnchoredMatchOption Q_DECL_ENUMERATOR_DEPRECATED_X(
      |         ^~~~~~~~~~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:239:132: error: no matching function for call to ‘QRegularExpression::match(const QString*&, int&, QRegularExpression::MatchType, QRegularExpression::MatchOption) const’
  239 |  QRegularExpressionMatch match = re.match(string_, index_, QRegularExpression::NormalMatch, QRegularExpression::AnchoredMatchOption);
      |                                                                                                                                    ^
In file included from /usr/local/include/QtCore/QRegularExpression:1,
                 from /1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:3:
/usr/local/include/QtCore/qregularexpression.h:121:29: note: candidate: ‘QRegularExpressionMatch QRegularExpression::match(const QString&, qsizetype, QRegularExpression::MatchType, QRegularExpression::MatchOptions) const’
  121 |     QRegularExpressionMatch match(const QString &subject,
      |                             ^~~~~
/usr/local/include/QtCore/qregularexpression.h:121:50: note:   no known conversion for argument 1 from ‘const QString*’ to ‘const QString&’
  121 |     QRegularExpressionMatch match(const QString &subject,
      |                                   ~~~~~~~~~~~~~~~^~~~~~~
/usr/local/include/QtCore/qregularexpression.h:126:29: note: candidate: ‘QRegularExpressionMatch QRegularExpression::match(QStringView, qsizetype, QRegularExpression::MatchType, QRegularExpression::MatchOptions) const’
  126 |     QRegularExpressionMatch match(QStringView subjectView,
      |                             ^~~~~
/usr/local/include/QtCore/qregularexpression.h:126:47: note:   no known conversion for argument 1 from ‘const QString*’ to ‘QStringView’
  126 |     QRegularExpressionMatch match(QStringView subjectView,
      |                                   ~~~~~~~~~~~~^~~~~~~~~~~
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp: In member function ‘bool Input::match(const QString&)’:
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Input.cpp:265:15: error: ‘const class QString’ has no member named ‘midRef’
  265 |  if (string_->midRef(index_, s.size()) == s) {
      |               ^~~~~~
make[2]: *** [Util/CMakeFiles/Util.dir/build.make:121: Util/CMakeFiles/Util.dir/Input.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Resource.cpp: In function ‘QByteArray loadResource(const QString&)’:
/1TB/usr/src/github.com/1div0/nedit-ng/Util/Resource.cpp:25:10: error: ‘class QResource’ has no member named ‘isCompressed’
   25 |  if (res.isCompressed()) {
      |          ^~~~~~~~~~~~
make[2]: *** [Util/CMakeFiles/Util.dir/build.make:147: Util/CMakeFiles/Util.dir/Resource.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:298: Util/CMakeFiles/Util.dir/all] Error 2
make: *** [Makefile:160: all] Error 2

1div0 avatar Nov 12 '20 17:11 1div0

Right, so the C++17 stuff is fixed, but I'll need to address Qt6 related stuff (first I'll have to install it!)

eteran avatar Nov 12 '20 17:11 eteran

code.qt.io/qt/qt5 v6.0.0-beta4

Patience. Good luck!

1div0 avatar Nov 12 '20 18:11 1div0

Just as an update to this, I did try building Qtr from sources and ran into a hiccup (I forget what it was, nothing MAJOR, but enough to make me stop and say "meh, i'll try again later").

Once Qt6 hits gentoo ebuilds, I'll give this another go. I don't think it'll take much to make things compile cleanly with Qt6. Honestly, I think that the most complex part will be editing the cmake files to be able to work with either Qt5 or Qt6 and choose a sensible one by default (I've done that before during the 4->5 transition for another project, wasn't too bad).

So, I'm optimistic :-).

eteran avatar Dec 26 '20 21:12 eteran

I hope this isn't going to require Qt6 to build nedit-ng, I don't think it's very widely available yet. My work system (RHEL-7) still only has Qt-5.9.7 and Homebrew for MacOS has Qt-5.15.1.

anjohnson avatar Dec 29 '20 21:12 anjohnson

I hope this isn't going to require Qt6 to build nedit-ng, I don't think it's very widely available yet. My work system (RHEL-7) still only has Qt-5.9.7 and Homebrew for MacOS has Qt-5.15.1.

Oh, don't worry. It'll default to Qt5, but optionally support building against Qt6 :-).

I did that with another project as Qt transitioned from 4 to 5 👍🏻

eteran avatar Dec 30 '20 05:12 eteran

Just to get a little perspective, do we know how long will Qt 5.5 continue to be maintained by Qt team?

tksoh avatar Dec 30 '20 06:12 tksoh

Qt 5.5 is no longer maintained. Technically 5.12 LTS (5.12.10) is the oldest version "supported" (because 5.9 LTS JUST expired this year).

See https://en.wikipedia.org/wiki/Qt_version_history (Qt5 section) for details.

So it's more about the "5 branch" which will be supported for a LONG time since Qt is always backward compatible within major versions. So code that is built against 5.5 will certainly work with Qt 5.15 and distros will continue to need to supply some version of Qt5 for several years to come.

eteran avatar Dec 30 '20 14:12 eteran

Making both Qt-6 and a C++17 compiler an essential requirement may significantly reduce the number of users. I hope that's not going to happen...

anjohnson avatar Mar 26 '21 21:03 anjohnson

My plan is to make it support both Qt5 and Qt6 defaulting to the newest installed 🙂.

After a few years, when Qt6 is widely deployed, Qt5 and C++ before 17 may be phased out eventually.

eteran avatar Mar 27 '21 00:03 eteran