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

Qt5 does not compile on Mac with -qtnamespace

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.0.0 Beta 2
    • 5.0.0
    • None
    • Mac OSX Lion clang with Qt5 at b936b959650128bb8befaaa069477629105c680d
    • macOS
    • a760289038f3775cc399a8f47c36b9bce525c1a1

    Description

      When qt5 sources are compiled on Mac as

      ./configure -qtnamespace TestNamespace
      

      ...there is a build breakage:

      sarasmit@bq-imacdev1:~/build/qt5/qtbase/src/corelib$ clang -save-temps -c -pipe -mmacosx-version-min=10.6 -g -arch x86_64 -fvisibility=hidden -fvisibility-inlines-hidden -Wall -W -DQT_SHARED -DQT_EDITION=QT_EDITION_DESKTOP -DQT_NO_LIBUDEV -DQT_NO_EVDEV -DQT_NO_XCB -DQT_BUILD_CORE_LIB -DQT_NO_USING_NAMESPACE -DQT_NO_CAST_TO_ASCII -DQT_ASCII_CAST_WARNINGS -DQT_MOC_COMPAT -DQT_USE_QSTRINGBUILDER -DPCRE_HAVE_CONFIG_H -DHB_EXPORT=Q_CORE_EXPORT -DQT_NO_DEBUG_PLUGIN_CHECK -DQT_NAMESPACE=TestNamespace -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I/Users/sarasmit/depot/qt5/qtbase/mkspecs/macx-clang -I/Users/sarasmit/depot/qt5/qtbase/src/corelib -I../../include -I../../include/QtCore/5.0.0 -I../../include/QtCore/5.0.0/QtCore -I../../include/QtCore -I../../include -I.rcc/debug-shared -Iglobal -I/Users/sarasmit/depot/qt5/qtbase/src/3rdparty/pcre -I/Users/sarasmit/depot/qt5/qtbase/src/3rdparty/harfbuzz/src -I/Users/sarasmit/depot/qt5/qtbase/src/3rdparty/md5 -I/Users/sarasmit/depot/qt5/qtbase/src/3rdparty/md4 -I.moc/debug-shared -I. /Users/sarasmit/depot/qt5/qtbase/src/corelib/tools/qlocale_mac.mm -o .obj/debug-shared/qlocale_mac.o
      In file included from /Users/sarasmit/depot/qt5/qtbase/src/corelib/tools/qlocale_mac.mm:1:
      In file included from /Users/sarasmit/depot/qt5/qtbase/src/corelib/tools/qlocale_mac.mm:42:
      In file included from /Users/sarasmit/depot/qt5/qtbase/src/corelib/tools/qlocale_p.h:58:
      In file included from ../../include/QtCore/qvariant.h:1:
      In file included from ../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/kernel/qvariant.h:48:
      In file included from ../../include/QtCore/qmetatype.h:1:
      ../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/kernel/qmetatype.h:446:36: error: no member named 'is_enum' in namespace 'TestNamespace::QtPrivate'
                           | (QtPrivate::is_enum<T>::value ? QMetaType::IsEnumeration : 0)
                              ~~~~~~~~~~~^
      ../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/kernel/qmetatype.h:446:44: error: 'T' does not refer to a value
                           | (QtPrivate::is_enum<T>::value ? QMetaType::IsEnumeration : 0)
                                                 ^
      ../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/kernel/qmetatype.h:439:23: note: declared here
          template<typename T>
                            ^
      ../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/kernel/qmetatype.h:446:48: error: no member named 'value' in the global namespace
                           | (QtPrivate::is_enum<T>::value ? QMetaType::IsEnumeration : 0)
                                                   ~~^
      3 errors generated.
      

      If -save-temps is passed this can be seen in qlocale_mac.mii:

      # 1 "../../include/QtCore/qglobal.h" 1
      # 43 "../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/global/qisenum.h" 2
      
      namespace TestNamespace {
      
      # 1 "../../include/QtCore/qtypetraits.h" 1
      # 1 "../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/global/qtypetraits.h" 1
      # 66 "../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/global/qtypetraits.h"
      # 1 "../../include/QtCore/qglobal.h" 1
      # 67 "../../include/QtCore/../../../../../depot/qt5/qtbase/src/corelib/global/qtypetraits.h" 2
      
      namespace TestNamespace {
      
      namespace QtPrivate {
      

      So the QT_NAMESPACE macro is getting introduced twice in this case. The original error seems to go back to when qisenum.h was created, by was triggered for Mac by changes to the qtypetraits file, in 22494ea8e82d5d5588e67e8067f0273687ed9098 which exposes this when Mac is using the clang compiler.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            leonlee Leonard Lee
            sarasmit Sarah Smith (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes