Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt5, cmake, clang and macOS
Forum Update on Monday, May 27th 2025

Qt5, cmake, clang and macOS

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
3 Posts 2 Posters 1.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nils1603
    wrote on 25 Mar 2021, 16:00 last edited by
    #1

    Hey everyone!

    Since updating everything I have installed via brew, I can no longer build our open-source project.
    So first of all here are the version of everything I use:

    g++: Apple clang version 12.0.0 (clang-1200.0.32.29)
    qt@5: qt5.12.2 (freshly installed via brew)
    cmake: cmake version 3.19.5

    Here is the CMakeLists.txt we use to link qt in our project.
    https://github.com/emsec/hal/blob/master/plugins/gui/CMakeLists.txt

    Since the latest update I get a bunch of errors ranging from:

    /usr/local/Cellar/qt/5.15.2/lib/QtWidgets.framework/Headers/qstyleoption.h:500:9: error: 'deprecated' attribute cannot be applied to types
    typedef Q_DECL_DEPRECATED QStyleOptionToolBox QStyleOptionToolBoxV2;
            ^
    /usr/local/include/QtCore/qcompilerdetection.h:1152:31: note: expanded from macro 'Q_DECL_DEPRECATED'
    #  define Q_DECL_DEPRECATED [[deprecated]]
    

    to

    In file included from ../plugins/gui/src/channel_manager/channel_item.cpp:1:
    In file included from ../plugins/gui/include/gui/channel_manager/channel_item.h:28:
    In file included from /usr/local/Cellar/qt/5.15.2/lib/QtCore.framework/Headers/QList:1:
    In file included from /usr/local/Cellar/qt/5.15.2/lib/QtCore.framework/Headers/qlist.h:1196:
    /usr/local/include/QtCore/qstringlist.h:85:51: error: no template named 'QListSpecialMethodsBase'; did you mean 'QListSpecialMethods'?
    template <> struct QListSpecialMethods<QString> : QListSpecialMethodsBase<QString>
    

    and

    /usr/local/include/QtCore/qbytearraylist.h:83:45: error: use of undeclared identifier 'self'
        { return QtPrivate::QByteArrayList_join(self(), &sep, 1); }
    

    I have absolutely no idea what's wrong and the errors only occurred after I updated everything. Even in our CI we have on GitHub, it is no longer building properly on macOS.

    I am really stuck. My guess is that we are doing something wrong from cmake, but I cannot figure out what.

    I also had to add the Qt5_DIR to theCMakeLists. txt, so qt5 can be found at all. I did not have to do that before.

    set (Qt5_DIR "/usr/local/opt/qt/lib/cmake" )
    

    For some reason none of the above errors occur on Ubuntu and not macOS, here everything works fine.

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kkoehne
      Moderators
      wrote on 26 Mar 2021, 07:29 last edited by kkoehne
      #2

      It looks like you have a Qt 6 build in /usr/local/include, and header files from there get mixed with the Qt 5.12.2 in /usr/local/Cellar/qt.

      set (Qt5_DIR "/usr/local/opt/qt/lib/cmake" )
      

      This might be the culprit. Shouldn't this be /usr/local/Cellar/qt/5.15.2 ?

      Director R&D, The Qt Company

      1 Reply Last reply
      2
      • N Offline
        N Offline
        nils1603
        wrote on 26 Mar 2021, 09:11 last edited by nils1603
        #3

        Cannot believe that this solved all my problems. I had to delete all qt files manually though. Uninstalling them via brew did not do the trick.

        Thank you so much!

        1 Reply Last reply
        0

        1/3

        25 Mar 2021, 16:00

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved