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. qtmqtt make error on linux: "qmqttglobal.h: No such file or directory"
Forum Updated to NodeBB v4.3 + New Features

qtmqtt make error on linux: "qmqttglobal.h: No such file or directory"

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 6 Posters 7.1k Views 2 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.
  • Egn1n3E Egn1n3

    What happens if you do: qmake -r

    U Offline
    U Offline
    udayraj123
    wrote on last edited by udayraj123
    #3

    @Egn1n3 The qmake -r command produces output as follows -

    Reading /home/test/Documents/qtmqtt-5.11/src/src.pro [/home/test/Documents/qtmqtt-5.11/build/src]
     Reading /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro [/home/test/Documents/qtmqtt-5.11/build/src/mqtt]
    Reading /home/test/Documents/qtmqtt-5.11/examples/examples.pro [/home/test/Documents/qtmqtt-5.11/build/examples]
     Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/mqtt.pro [/home/test/Documents/qtmqtt-5.11/build/examples/mqtt]
      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/simpleclient/simpleclient.pro [/home/test/Documents/qtmqtt-5.11/build/examples/mqtt/simpleclient]
      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/subscriptions/subscriptions.pro [/home/test/Documents/qtmqtt-5.11/build/examples/mqtt/subscriptions]
    Reading /home/test/Documents/qtmqtt-5.11/tests/tests.pro [/home/test/Documents/qtmqtt-5.11/build/tests]
     Reading /home/test/Documents/qtmqtt-5.11/tests/auto/auto.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/cmake/cmake.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/cmake]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/conformance/conformance.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/conformance]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttcontrolpacket/qmqttcontrolpacket.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/qmqttcontrolpacket]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttclient/qmqttclient.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/qmqttclient]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttsubscription/qmqttsubscription.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/qmqttsubscription]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicname/qmqtttopicname.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/qmqtttopicname]
      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicfilter/qmqtttopicfilter.pro [/home/test/Documents/qtmqtt-5.11/build/tests/auto/qmqtttopicfilter]
     Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/benchmarks.pro [/home/test/Documents/qtmqtt-5.11/build/tests/benchmarks]
      Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/qmqttclient/qmqttclient.pro [/home/test/Documents/qtmqtt-5.11/build/tests/benchmarks/qmqttclient]
    
    

    But then on doing make again, same error comes up: QtMqtt/qmqttglobal.h: No such file or directory

    1 Reply Last reply
    0
    • U Offline
      U Offline
      udayraj123
      wrote on last edited by udayraj123
      #4

      Okay, seems like cmake is not installed on my system. I'm installing it and running again now.
      Update: Still exact same error. Updated the qmake -r output above.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #5

        Hi,

        Are you sure you are using the qmake executable of your Qt 5.11 ?

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

        U 1 Reply Last reply
        1
        • SifuS Offline
          SifuS Offline
          Sifu
          wrote on last edited by
          #6

          @udayraj123 said in qmqtt make error on linux: "qmqttglobal.h: No such file or directory":

          QtMqtt/

          Edit the Makefile and add the option "-I/path-to-the-QtMqtt-header file"

          jsulmJ 1 Reply Last reply
          0
          • SifuS Sifu

            @udayraj123 said in qmqtt make error on linux: "qmqttglobal.h: No such file or directory":

            QtMqtt/

            Edit the Makefile and add the option "-I/path-to-the-QtMqtt-header file"

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

            @Sifu Editing the Makefile isn't a good idea as it is auto-generated and will be overwritten next time qmake is executed.

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

            1 Reply Last reply
            0
            • SGaistS SGaist

              Hi,

              Are you sure you are using the qmake executable of your Qt 5.11 ?

              U Offline
              U Offline
              udayraj123
              wrote on last edited by udayraj123
              #8

              @SGaist Just checked, it was using from /usr/bin
              which qmake
              /usr/bin/qmake

              find ~/ -type f -executable -name 'qmake'

              /home/test/Qt/5.11.0/android_x86/bin/qmake
              /home/test/Qt/5.11.0/gcc_64/bin/qmake
              /home/test/Qt/5.11.0/android_armv7/bin/qmake

              So trying the second one now-

              /home/test/Qt/5.11.0/gcc_64/bin/qmake -version
              QMake version 3.1
              Using Qt version 5.11.0 in /home/test/Qt/5.11.0/gcc_64/lib

              cd qtmqtt-5.11
              On using this qt I am getting a different error:

              /home/test/Qt/5.11.0/gcc_64/bin/qmake -r

              Info: creating stash file /home/test/Documents/qtmqtt-5.11/.qmake.stash
              Info: creating cache file /home/test/Documents/qtmqtt-5.11/.qmake.cache
              Reading /home/test/Documents/qtmqtt-5.11/src/src.pro
               Reading /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro
              Reading /home/test/Documents/qtmqtt-5.11/examples/examples.pro
               Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/mqtt.pro
              Project ERROR: You cannot build examples inside the Qt source tree, except as part of a proper Qt build.
              

              Update: On running it again, it worked!
              /home/test/Qt/5.11.0/gcc_64/bin/qmake -r

              Reading /home/test/Documents/qtmqtt-5.11/src/src.pro
               Reading /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro
              Reading /home/test/Documents/qtmqtt-5.11/examples/examples.pro
               Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/mqtt.pro
                Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/simpleclient/simpleclient.pro
                Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/subscriptions/subscriptions.pro
                Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/quicksubscription/quicksubscription.pro
                Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/websocketsubscription/websocketsubscription.pro
              Reading /home/test/Documents/qtmqtt-5.11/tests/tests.pro
               Reading /home/test/Documents/qtmqtt-5.11/tests/auto/auto.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/cmake/cmake.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/conformance/conformance.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttcontrolpacket/qmqttcontrolpacket.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttclient/qmqttclient.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttsubscription/qmqttsubscription.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicname/qmqtttopicname.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicfilter/qmqtttopicfilter.pro
               Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/benchmarks.pro
                Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/qmqttclient/qmqttclient.pro
              

              Now make and sudo make install has finished building.
              The directory /usr/lib/x86_64-linux-gnu/qtmqtt-5.11/ is now created
              Will test with sample app now.

              U 1 Reply Last reply
              0
              • U Offline
                U Offline
                udayraj123
                wrote on last edited by udayraj123
                #9

                For changing the qmake, I replaced /usr/bin/qmake with new one using following command-

                sudo mv /usr/bin/qmake /usr/bin/qmake.old
                sudo ln -s /home/test/Qt/5.11.0/gcc_64/bin/qmake /usr/bin/qmake
                qmake -version
                 QMake version 3.1
                 Using Qt version 5.11.0 in /home/test/Qt/5.11.0/gcc_64/lib
                

                Now when I opened the qtmqtt-5.11 folder in qt creator, it first gave this warning:

                Project ERROR: Module does not define version.
                Error while parsing file /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro. Giving up.
                Project MESSAGE: This project is using private headers and will therefore be tied to this specific Qt module build version.
                Project MESSAGE: Running this project against other versions of the Qt modules may crash at any arbitrary point.
                Project MESSAGE: This is not a bug, but a result of using Qt internals. You have been warned!
                

                Still proceeded to "Build all" and it worked. But now on doing "Run" -
                I get this error:
                In file included from /home/test/Documents/qtmqtt-5.11/examples/mqtt/simpleclient/main.cpp:51:0:
                /home/test/Documents/qtmqtt-5.11/examples/mqtt/simpleclient/mainwindow.h:55:23: fatal error: QMqttClient: No such file or directory

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  You should do out of source builds. This keeps the source clean and allows you to nuke the build folder if something goes wrong.

                  Do not change your distribution provided qmake. Use the full path to the version you want to use. You can be sure that you are going to hit a wall once you update Qt to a newer version.

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

                  U 1 Reply Last reply
                  2
                  • U udayraj123

                    @SGaist Just checked, it was using from /usr/bin
                    which qmake
                    /usr/bin/qmake

                    find ~/ -type f -executable -name 'qmake'

                    /home/test/Qt/5.11.0/android_x86/bin/qmake
                    /home/test/Qt/5.11.0/gcc_64/bin/qmake
                    /home/test/Qt/5.11.0/android_armv7/bin/qmake

                    So trying the second one now-

                    /home/test/Qt/5.11.0/gcc_64/bin/qmake -version
                    QMake version 3.1
                    Using Qt version 5.11.0 in /home/test/Qt/5.11.0/gcc_64/lib

                    cd qtmqtt-5.11
                    On using this qt I am getting a different error:

                    /home/test/Qt/5.11.0/gcc_64/bin/qmake -r

                    Info: creating stash file /home/test/Documents/qtmqtt-5.11/.qmake.stash
                    Info: creating cache file /home/test/Documents/qtmqtt-5.11/.qmake.cache
                    Reading /home/test/Documents/qtmqtt-5.11/src/src.pro
                     Reading /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro
                    Reading /home/test/Documents/qtmqtt-5.11/examples/examples.pro
                     Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/mqtt.pro
                    Project ERROR: You cannot build examples inside the Qt source tree, except as part of a proper Qt build.
                    

                    Update: On running it again, it worked!
                    /home/test/Qt/5.11.0/gcc_64/bin/qmake -r

                    Reading /home/test/Documents/qtmqtt-5.11/src/src.pro
                     Reading /home/test/Documents/qtmqtt-5.11/src/mqtt/mqtt.pro
                    Reading /home/test/Documents/qtmqtt-5.11/examples/examples.pro
                     Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/mqtt.pro
                      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/simpleclient/simpleclient.pro
                      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/subscriptions/subscriptions.pro
                      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/quicksubscription/quicksubscription.pro
                      Reading /home/test/Documents/qtmqtt-5.11/examples/mqtt/websocketsubscription/websocketsubscription.pro
                    Reading /home/test/Documents/qtmqtt-5.11/tests/tests.pro
                     Reading /home/test/Documents/qtmqtt-5.11/tests/auto/auto.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/cmake/cmake.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/conformance/conformance.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttcontrolpacket/qmqttcontrolpacket.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttclient/qmqttclient.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqttsubscription/qmqttsubscription.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicname/qmqtttopicname.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/auto/qmqtttopicfilter/qmqtttopicfilter.pro
                     Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/benchmarks.pro
                      Reading /home/test/Documents/qtmqtt-5.11/tests/benchmarks/qmqttclient/qmqttclient.pro
                    

                    Now make and sudo make install has finished building.
                    The directory /usr/lib/x86_64-linux-gnu/qtmqtt-5.11/ is now created
                    Will test with sample app now.

                    U Offline
                    U Offline
                    udayraj123
                    wrote on last edited by udayraj123
                    #11

                    Actually I tried the same procedure on a different PC, but it is not working on it.
                    It is showing the QtMqtt/qmqttglobal.h not found error. I think it bypassed it in mine because yesterday I had tried building by manually adding a QtMqtt/ directory inside ~/Qt/5.11.0/gcc_64/include/

                    ls ~/Qt/5.11.0/gcc_64/include/QtMqtt/

                    qmqttclient.h        qmqttconnection_p.h     qmqttglobal.h     qmqttmessage.h         qmqttsubscription.h    qmqtttopicfilter.cpp  qmqtttopicname.cpp
                    QMqttClient      qmqttclient_p.h      qmqttcontrolpacket.cpp  QMqttMessage      QMqttSubscription      qmqttsubscription_p.h  qmqtttopicfilter.h    qmqtttopicname.h
                    qmqttclient.cpp  qmqttconnection.cpp  qmqttcontrolpacket_p.h  qmqttmessage.cpp  qmqttsubscription.cpp  QMqttTopicFilter       QMqttTopicName        QtMqttDepends
                    

                    echo ~/Qt/5.11.0/gcc_64/include/QtCore/5.11.0/QtCore/private/qmqtt*

                    /home/test/Qt/5.11.0/gcc_64/include/QtCore/5.11.0/QtCore/private/qmqttclient_p.h
                    (omitted) /private/qmqttconnection_p.h
                    (omitted) /private/qmqttcontrolpacket_p.h
                    (omitted) /private/qmqttsubscription_p.h
                    
                    SifuS 1 Reply Last reply
                    0
                    • SGaistS SGaist

                      You should do out of source builds. This keeps the source clean and allows you to nuke the build folder if something goes wrong.

                      Do not change your distribution provided qmake. Use the full path to the version you want to use. You can be sure that you are going to hit a wall once you update Qt to a newer version.

                      U Offline
                      U Offline
                      udayraj123
                      wrote on last edited by
                      #12

                      @SGaist Yes, I should use the full path. But If I am using it just for testing this one project right now, then I guess it should be fine(?)
                      About build folder - okay I'll do it from next time. Currently to restart the build I was deleting qtmqtt folder and extracting the zip again.

                      Also, how can I get this 1 reputation to be able to reply faster

                      1 Reply Last reply
                      1
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #13

                        You are invoking Murphy's Law.

                        I'd recommend doing that now so you ensure that you have a full correct build also when calling make install.

                        To get a +1 somebody has to upvote one of your question or answer.

                        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
                        1
                        • U udayraj123

                          Actually I tried the same procedure on a different PC, but it is not working on it.
                          It is showing the QtMqtt/qmqttglobal.h not found error. I think it bypassed it in mine because yesterday I had tried building by manually adding a QtMqtt/ directory inside ~/Qt/5.11.0/gcc_64/include/

                          ls ~/Qt/5.11.0/gcc_64/include/QtMqtt/

                          qmqttclient.h        qmqttconnection_p.h     qmqttglobal.h     qmqttmessage.h         qmqttsubscription.h    qmqtttopicfilter.cpp  qmqtttopicname.cpp
                          QMqttClient      qmqttclient_p.h      qmqttcontrolpacket.cpp  QMqttMessage      QMqttSubscription      qmqttsubscription_p.h  qmqtttopicfilter.h    qmqtttopicname.h
                          qmqttclient.cpp  qmqttconnection.cpp  qmqttcontrolpacket_p.h  qmqttmessage.cpp  qmqttsubscription.cpp  QMqttTopicFilter       QMqttTopicName        QtMqttDepends
                          

                          echo ~/Qt/5.11.0/gcc_64/include/QtCore/5.11.0/QtCore/private/qmqtt*

                          /home/test/Qt/5.11.0/gcc_64/include/QtCore/5.11.0/QtCore/private/qmqttclient_p.h
                          (omitted) /private/qmqttconnection_p.h
                          (omitted) /private/qmqttcontrolpacket_p.h
                          (omitted) /private/qmqttsubscription_p.h
                          
                          SifuS Offline
                          SifuS Offline
                          Sifu
                          wrote on last edited by
                          #14

                          @udayraj123 said in qmqtt make error on linux: "qmqttglobal.h: No such file or directory":

                          QtMqtt

                          Hi,
                          The reason behind the problem is the QtMqtt header files were not inside the default system include folders, when you run the make it will only take the external header files from the system include directories like /usr/include . /usr/share/include . etc,. . Here you installed the QtMqtt inside your home which is not a regular location of included. You are not telling the make that you need to include the header from a folder inside your home.

                          Solution 1 : You may set the INCLUDE_PATH in your environment variable in shell , or, update the build configuration https://doc-snapshots.qt.io/qtcreator-4.0/creator-build-settings.html

                          Soluton 2 : Install QtMqtt as root user with prefix=/usr , this may be easy

                          1 Reply Last reply
                          1
                          • U Offline
                            U Offline
                            udayraj123
                            wrote on last edited by
                            #15

                            Thanks for your solutions, I'll try them, but I have some doubts-

                            QtMqtt header files were not inside the default system include folders...

                            Shouldn't this be a problem for all then? Is it building on your system without having to do the suggested change?

                            Here you installed the QtMqtt inside your home which is not a regular location of included

                            What location would you suggest for installing it?

                            Install QtMqtt as root user with prefix=/usr , this may be easy

                            I did not get the 'prefix=/usr' part.

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #16

                              @udayraj123 said in qtmqtt make error on linux: "qmqttglobal.h: No such file or directory":

                              Thanks for your solutions, I'll try them, but I have some doubts-

                              QtMqtt header files were not inside the default system include folders...

                              Shouldn't this be a problem for all then? Is it building on your system without having to do the suggested change?

                              No, because you're not doing a system install. These headers should be found in the Qt installation you used to build the module after you called make install.

                              Here you installed the QtMqtt inside your home which is not a regular location of included

                              What location would you suggest for installing it?

                              Using the correct qmake executable, it should install the module in the correct folders.

                              Install QtMqtt as root user with prefix=/usr , this may be easy

                              I did not get the 'prefix=/usr' part.

                              When doing a full Qt build, you can configure where the installation should happen. You are not concerned by this.

                              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
                              1
                              • U udayraj123

                                Steps to reproduce my problem:

                                1. Download zip from https://github.com/qt/qtmqtt
                                2. cd into the folder and run qmake; and then make;
                                3. Following error is produced:
                                  qmqttclient.h:33:32: fatal error: QtMqtt/qmqttglobal.h: No such file or directory

                                Update: tried with qmake -r as well, but no effect.
                                I have also seen this link: https://forum.qt.io/topic/80659/how-to-add-library-qmqtt-h-in-qmqtt-client-for-windows/ but it is a bit confusing and I am still stuck. How to compile this library so that I can use mqtt in Qt?

                                Thanks,
                                Udayraj

                                Pablo J. RoginaP Offline
                                Pablo J. RoginaP Offline
                                Pablo J. Rogina
                                wrote on last edited by
                                #17

                                @udayraj123 said in qtmqtt make error on linux: "qmqttglobal.h: No such file or directory":

                                Download zip from https://github.com/qt/qtmqtt

                                I can confirm that using the .zip download from such location gave me same errors as you mention (I'm using Lubuntu 18.04 / Qt 5.11)

                                However cloning https://code.qt.io/qt/qtmqtt.git and doing:

                                qmake -r
                                qmake
                                make
                                sudo make install
                                

                                led to QtMQTT module built Ok and installed along other existing modules in my Qt installation so later on you could use the module in any application (i.e. provided examples or your own).

                                Upvote the answer(s) that helped you solve the issue
                                Use "Topic Tools" button to mark your post as Solved
                                Add screenshots via postimage.org
                                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                1 Reply Last reply
                                3

                                • Login

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