Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module
Qt 6.11 is out! See what's new in the release blog

Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.5k 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.
  • D Offline
    D Offline
    devjb
    wrote on last edited by
    #1

    Hi,

    i have QT += quick in one of my qmake project files. Because I build several projects within my subdirs project, I want certain target environments to compile only the stuff that does not depend on graphical stuff because the targets are headless.

    So I decided to entirely skip the build of the gui dependent pro files via

    qtHaveModule(quick){
    DEFINES += \
    	BLABLA_UI_LIBRARY
    QT += quick
    
    [...]
    }
    else
    {
    message("QtQuick not available, skipping building the blabla-ui lib")
    }
    

    However those headless systems fail to run qmake. They successfully print the error message that quick is not available and afterwards fail nonetheless:

    Project MESSAGE: QtQuick not available, skipping building the blabla ui lib
    Project ERROR: Unknown module(s) in QT: gui
    

    Any ideas what to do further? Thanks in advance.

    The full log, starting with the skip is here:

    https://gist.github.com/darkmattercoder/e82b62638ec76597fb7365e1cf404275

    KroMignonK 1 Reply Last reply
    0
    • D devjb

      Hi,

      i have QT += quick in one of my qmake project files. Because I build several projects within my subdirs project, I want certain target environments to compile only the stuff that does not depend on graphical stuff because the targets are headless.

      So I decided to entirely skip the build of the gui dependent pro files via

      qtHaveModule(quick){
      DEFINES += \
      	BLABLA_UI_LIBRARY
      QT += quick
      
      [...]
      }
      else
      {
      message("QtQuick not available, skipping building the blabla-ui lib")
      }
      

      However those headless systems fail to run qmake. They successfully print the error message that quick is not available and afterwards fail nonetheless:

      Project MESSAGE: QtQuick not available, skipping building the blabla ui lib
      Project ERROR: Unknown module(s) in QT: gui
      

      Any ideas what to do further? Thanks in advance.

      The full log, starting with the skip is here:

      https://gist.github.com/darkmattercoder/e82b62638ec76597fb7365e1cf404275

      KroMignonK Offline
      KroMignonK Offline
      KroMignon
      wrote on last edited by KroMignon
      #2

      @devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:

      Project ERROR: Unknown module(s) in QT: gui

      If you don't you gui, you should insert in your PRO file QT -= gui

      qtHaveModule(quick){
      DEFINES += \
      	BLABLA_UI_LIBRARY
      QT += quick
      
      [...]
      }
      else
      {
          message("QtQuick not available, skipping building the blabla-ui lib")
          QT -= gui
      }
      

      It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

      1 Reply Last reply
      1
      • D Offline
        D Offline
        devjb
        wrote on last edited by
        #3

        Well, that was a quick and obvious fix... worked

        However, I do not understand why the error appears in the first place. Because qmake should not process the file at all.
        I have several other project files, some of them contain QT-=gui and some of them don't, however they all build successfully, even those where I did not put that in.

        Furthermore, the project file in question is practically empty beside the qthavemodule check, so why tries qmake to do something else afterwards.

        I simply want to get at least a kind of understanding of what goes on here.

        KroMignonK 1 Reply Last reply
        0
        • D devjb

          Well, that was a quick and obvious fix... worked

          However, I do not understand why the error appears in the first place. Because qmake should not process the file at all.
          I have several other project files, some of them contain QT-=gui and some of them don't, however they all build successfully, even those where I did not put that in.

          Furthermore, the project file in question is practically empty beside the qthavemodule check, so why tries qmake to do something else afterwards.

          I simply want to get at least a kind of understanding of what goes on here.

          KroMignonK Offline
          KroMignonK Offline
          KroMignon
          wrote on last edited by
          #4

          @devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:

          I simply want to get at least a kind of understanding of what goes on here.

          As describe here ==> https://doc.qt.io/qt-5/qtgui-index.html
          GUI module is included by default and must be removed if not required/used

          It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

          1 Reply Last reply
          1
          • D Offline
            D Offline
            devjb
            wrote on last edited by devjb
            #5

            @KroMignon thanks for the clarification

            Well, my approach was even wrong in the first place.
            What I wanted to achieve is done via one line in the *.pro file:

            requires(qtHaveModule(quick))
            

            this is was I was looking for and gives me the correct results that I am expecting.

            KroMignonK 1 Reply Last reply
            2
            • D devjb

              @KroMignon thanks for the clarification

              Well, my approach was even wrong in the first place.
              What I wanted to achieve is done via one line in the *.pro file:

              requires(qtHaveModule(quick))
              

              this is was I was looking for and gives me the correct results that I am expecting.

              KroMignonK Offline
              KroMignonK Offline
              KroMignon
              wrote on last edited by
              #6

              @devjb said in Despite skipping a *.pro file via qtHaveModule(quick), qmake fails due to missing gui module:

              this is was I was looking for and gives me the correct results that I am expecting.

              Sorry, I have readed too fast your post! Yes, using requires() is the right way to do what you want!

              It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

              1 Reply Last reply
              1

              • Login

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