Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-93360

Compile Qt with gcc 11

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 6.1.3, 6.1
    • 6.1.0, 6.2
    • Core: Object Model
    • None
    • Linux/X11

    Description

      It's not possible to compile current Qt dev branch using gcc 11. So far noticed the following issues:

      1. Warning at:

      /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qrandom.cpp: In member function ‘void QRandomGenerator::SystemAndGlobalGenerators::confirmLiteral()’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qrandom.cpp:380:28: warning: ‘template<class _Tp> struct std::is_literal_type’ is deprecated [-Wdeprecated-declarations]
        380 |         static_assert(std::is_literal_type<SystemAndGlobalGenerators>::value);
            |                            ^~~~~~~~~~~~~~~
      In file included from qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/global/qglobal.h:45,
                       from qtbase/include/QtCore/qglobal.h:1,
                       from qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/tools/qalgorithms.h:43,
                       from qtbase/include/QtCore/qalgorithms.h:1,
                       from /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qrandom.h:43,
                       from /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qrandom.cpp:44:
      /usr/include/c++/11/type_traits:711:5: note: declared here
        711 |     is_literal_type
            |     ^~~~~~~~~~~~~~~
      

      The std::is_literal_type is deprecated in C++ 17 and removed in C++ 20. Don't know what's the appropriate substitution. Please see a new comment added here: https://codereview.qt-project.org/c/qt/qtbase/+/208822.

      Fixed in: https://codereview.qt-project.org/c/qt/qtbase/+/346929

      2. Error:

      /home/jarek/dev/qt-dev/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h: In static member function ‘static constexpr size_t QItemSelectionModelPrivate::_qt_property_model_offset()’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h:98:40: error: ‘offsetof’ within non-standard-layout type ‘QItemSelectionModelPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         98 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QItemSelectionModelPrivate, QAbstractItemModel *, model,
      /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qglobal.h:1394:49: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS6’
       1394 | #define QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) MACRO##ARGC
            |                                                 ^~~~~
      /home/jarek/dev/qt-dev/qtbase/src/corelib/itemmodels/qitemselectionmodel_p.h:98:5: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS’
         98 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QItemSelectionModelPrivate, QAbstractItemModel *, model,
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      

      or

      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_inter_offset()’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp:61:40: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         61 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QTimerPrivate, int, inter, &QTimerPrivate::setInterval, 0)
      /home/jarek/dev/qt-dev/qtbase/src/corelib/global/qglobal.h:1394:49: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS5’
       1394 | #define QT_OVERLOADED_MACRO_EXPAND(MACRO, ARGC) MACRO##ARGC
            |                                                 ^~~~~
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp:61:5: note: in expansion of macro ‘Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS’
         61 |     Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QTimerPrivate, int, inter, &QTimerPrivate::setInterval, 0)
            |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_single_offset()’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp:62:42: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         62 |     Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, bool, single, false)
            |                                          ^
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp: In static member function ‘static constexpr size_t QTimerPrivate::_qt_property_type_offset()’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/kernel/qtimer.cpp:64:42: error: ‘offsetof’ within non-standard-layout type ‘QTimerPrivate’ is conditionally-supported [-Werror=invalid-offsetof]
         64 |     Q_OBJECT_BINDABLE_PROPERTY_WITH_ARGS(QTimerPrivate, Qt::TimerType, type, Qt::CoarseTimer)
            |                                          ^
      

      Please see https://codereview.qt-project.org/c/qt/qtbase/+/327044 for more info.

      Fixed in: https://codereview.qt-project.org/c/qt/qtbase/+/346636

      3. Probably unrelated to the error above:

      /home/jarek/dev/qt-dev/qtbase/src/corelib/tools/qsharedpointer.cpp: In static member function ‘static QtSharedPointer::ExternalRefCountData* QtSharedPointer::ExternalRefCountData::getAndRef(const QObject*)’:
      /home/jarek/dev/qt-dev/qtbase/src/corelib/tools/qsharedpointer.cpp:1414:16: error: ‘static void QtSharedPointer::ExternalRefCountData::operator delete(void*)’ called on pointer returned from a mismatched allocation function [-Werror=mismatched-new-delete]
       1414 |         delete x;
            |                ^
      /home/jarek/dev/qt-dev/qtbase/src/corelib/tools/qsharedpointer.cpp:1403:73: note: returned from ‘void* operator new(std::size_t)’
       1403 |     ExternalRefCountData *x = new ExternalRefCountData(Qt::Uninitialized);
            |                                                                         ^
      

      Fixed in: https://codereview.qt-project.org/c/qt/qtbase/+/350822

      4. After fixes to the points 1-3 were merged, there is also one more issue. Getting many errors like that:

      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qtmetamacros.h:159:32: error: ‘virtual const QMetaObject* QAbstractEventDispatcher::metaObject() const’ can be marked override [-Werror=suggest-override]
        159 |     virtual const QMetaObject *metaObject() const; \
            |                                ^~~~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qabstracteventdispatcher.h:54:5: note: in expansion of macro ‘Q_OBJECT’
         54 |     Q_OBJECT
            |     ^~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qtmetamacros.h:160:19: error: ‘virtual void* QAbstractEventDispatcher::qt_metacast(const char*)’ can be marked override [-Werror=suggest-override]
        160 |     virtual void *qt_metacast(const char *); \
            |                   ^~~~~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qabstracteventdispatcher.h:54:5: note: in expansion of macro ‘Q_OBJECT’
         54 |     Q_OBJECT
            |     ^~~~~~~~
      

      or:

      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qtmetamacros.h:159:32: error: ‘virtual const QMetaObject* QSocketNotifier::metaObject() const’ can be marked override [-Werror=suggest-override]
        159 |     virtual const QMetaObject *metaObject() const; \
            |                                ^~~~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qsocketnotifier.h:51:5: note: in expansion of macro ‘Q_OBJECT’
         51 |     Q_OBJECT
            |     ^~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qtmetamacros.h:160:19: error: ‘virtual void* QSocketNotifier::qt_metacast(const char*)’ can be marked override [-Werror=suggest-override]
        160 |     virtual void *qt_metacast(const char *); \
            |                   ^~~~~~~~~~~
      qtbase/include/QtCore/../../../../qt-dev/qtbase/src/corelib/kernel/qsocketnotifier.h:51:5: note: in expansion of macro ‘Q_OBJECT’
         51 |     Q_OBJECT
            |     ^~~~~~~~
      

      Fixed in: https://codereview.qt-project.org/c/qt/qtbase/+/351382

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-93360
          # Subject Branch Project Status CR V

          Activity

            People

              thiago Thiago Macieira
              jkobus Jarek Kobus
              Vladimir Minenko Vladimir Minenko
              Alex Blasche Alex Blasche
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes