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. QtPlatformHeaders not available on macOS Qt 5.15.0
Forum Updated to NodeBB v4.3 + New Features

QtPlatformHeaders not available on macOS Qt 5.15.0

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
4 Posts 3 Posters 541 Views 1 Watching
  • 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.
  • cmartelC Offline
    cmartelC Offline
    cmartel
    wrote on last edited by
    #1

    Trying to use QtPlatformHeaders in a qmake project leads to the following error:

    #include <QtPlatformHeaders/QCocoaNativeContext> // 'QtPlatformHeaders/QCocoaNativeContext' file not found
    

    I've tried making an empty project just to exclude my own project configuration, with the same result. It's as if Qt's entire include directory is just not available. It should be available out of the box according to the documentation:

    As the module is header-only, no further modifications to the .pro files are required to use it.
    
    Note: The module name (QtPlatformHeaders) must appear in the #include directive.
    
    Note: It is not necessary to enclose the code in #ifdef directives depending on platform.
    

    I had worked around this in previous Qt versions with a gigantic hack by adding the qtopenglextensions module, which in turn added its submodule to qmake's INCLUDEPATH, so that I could then define a relative includepath that'd actually make QtPlatformHeaders available:

    macx {
        QT += openglextensions
        INCLUDEPATH += "QtOpenGLExtensions/.."
    }
    

    However, this hack broke in 5.15 because the build configuration is looking for libQt5OpenGLExtensions_debug.a, but 5.15 only appears to ship with non-debug libraries (or there's no debug libraries, and the build configuration hasn't been updated accordingly). I'd rather not have to rely on a hack to begin with, so what am I missing?

    Somebody else had the same issue but never solved it--they ended up using a different method instead. Unfortunately, I do need the cocoa handle, not the CGL handle, so I have to go through this platform header.

    jsulmJ 1 Reply Last reply
    0
    • cmartelC cmartel

      Trying to use QtPlatformHeaders in a qmake project leads to the following error:

      #include <QtPlatformHeaders/QCocoaNativeContext> // 'QtPlatformHeaders/QCocoaNativeContext' file not found
      

      I've tried making an empty project just to exclude my own project configuration, with the same result. It's as if Qt's entire include directory is just not available. It should be available out of the box according to the documentation:

      As the module is header-only, no further modifications to the .pro files are required to use it.
      
      Note: The module name (QtPlatformHeaders) must appear in the #include directive.
      
      Note: It is not necessary to enclose the code in #ifdef directives depending on platform.
      

      I had worked around this in previous Qt versions with a gigantic hack by adding the qtopenglextensions module, which in turn added its submodule to qmake's INCLUDEPATH, so that I could then define a relative includepath that'd actually make QtPlatformHeaders available:

      macx {
          QT += openglextensions
          INCLUDEPATH += "QtOpenGLExtensions/.."
      }
      

      However, this hack broke in 5.15 because the build configuration is looking for libQt5OpenGLExtensions_debug.a, but 5.15 only appears to ship with non-debug libraries (or there's no debug libraries, and the build configuration hasn't been updated accordingly). I'd rather not have to rely on a hack to begin with, so what am I missing?

      Somebody else had the same issue but never solved it--they ended up using a different method instead. Unfortunately, I do need the cocoa handle, not the CGL handle, so I have to go through this platform header.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @cmartel said in QtPlatformHeaders not available on macOS Qt 5.15.0:

      #include <QtPlatformHeaders/QCocoaNativeContext>

      You should include without module name:

      #include <QCocoaNativeContext>
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      cmartelC SGaistS 2 Replies Last reply
      0
      • jsulmJ jsulm

        @cmartel said in QtPlatformHeaders not available on macOS Qt 5.15.0:

        #include <QtPlatformHeaders/QCocoaNativeContext>

        You should include without module name:

        #include <QCocoaNativeContext>
        
        cmartelC Offline
        cmartelC Offline
        cmartel
        wrote on last edited by
        #3

        @jsulm said in QtPlatformHeaders not available on macOS Qt 5.15.0:

        @cmartel said in QtPlatformHeaders not available on macOS Qt 5.15.0:

        #include <QtPlatformHeaders/QCocoaNativeContext>

        You should include without module name:

        #include <QCocoaNativeContext>
        

        Sadly, even though the documentation says the module name must appear in the include, I think that was one of my first reactions when I first used platform headers in 5.12. I tried again, just in case:

        QtRenderManager_macOS.mm:6:10: fatal error: 'QCocoaNativeContext' file not found
        #include <QCocoaNativeContext>
                 ^~~~~~~~~~~~~~~~~~~~~
        1 error generated.
        make[1]: *** [QtRenderManager_macOS.o] Error 1
        

        Really, even though the documentation says no change to qmake project files is needed, that's not the case of any other Qt module so I find that rather suspicious. There's no global addition in qmake spec anywhere that'd make platform headers available. I took a peek at the source to see if there was a special case for QtPlatformHeaders, but couldn't find anything.

        Instead, what I noticed is that these headers are used from within the Qt libraries proper in a few places, but never in an example project or something that references Qt. To the extent that I wonder whether using these headers from within a client project was ever something that was tested, let alone supported.

        1 Reply Last reply
        0
        • jsulmJ jsulm

          @cmartel said in QtPlatformHeaders not available on macOS Qt 5.15.0:

          #include <QtPlatformHeaders/QCocoaNativeContext>

          You should include without module name:

          #include <QCocoaNativeContext>
          
          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          @jsulm said in QtPlatformHeaders not available on macOS Qt 5.15.0:

          @cmartel said in QtPlatformHeaders not available on macOS Qt 5.15.0:

          #include <QtPlatformHeaders/QCocoaNativeContext>

          You should include without module name:

          #include <QCocoaNativeContext>
          

          That is the one exception from the usual no module prefix for includes.

          @cmartel You should not need to have any hacks for these headers to be used. It looks that it could be an issue with the set of paths for these includes because they are available. You should check the but report system for that issue and if nothing can be found, please consider opening a new ticket for that. Note that I do not have that issue with my developer build of Qt.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

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