Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. Mqtt module - client
Forum Update on Monday, May 27th 2025

Mqtt module - client

Scheduled Pinned Locked Moved Solved QtonPi
15 Posts 3 Posters 5.9k 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.
  • P Offline
    P Offline
    pirates21
    wrote on 18 Apr 2018, 11:00 last edited by pirates21
    #1

    Hello. I use qtrpi in my projects (cross compile on Debian 8). There, the supported version of Qt is 5.7. I would like to use the mqtt module (http://doc.qt.io/QtMQTT/index.html), unfortunately here the Qt version should be 5.10. Do you see the possibility of using Mqtt and Qtrpi simultaneously? Alternatively, how implement the Mqtt client without the Mqtt module, do you use some library? - Server Mqtt on Raspberry is Mosquito.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 18 Apr 2018, 21:31 last edited by
      #2

      Hi,

      The module was released with 5.10 but you can still try to build it with your version of Qt. Otherwise there are several projects you can find on GitHub that implements the protocol even some Qt based solution.

      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
      • P Offline
        P Offline
        pirates21
        wrote on 21 Apr 2018, 10:13 last edited by pirates21
        #3

        Thank you for your answer. There is a detailed description somewhere (step by step) how to install the official mqtt module (https://code.qt.io/qt/qtmqtt.git) in QtCreator?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tomasz3dk
          wrote on 21 Apr 2018, 18:19 last edited by
          #4

          As alternative you can use emqtt/qmqtt
          .

          1 Reply Last reply
          1
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 21 Apr 2018, 19:50 last edited by
            #5

            @pirates21 Qt Creator is just an IDE.

            To build a Qt module:

            mkdir build_qtmodule
            pushd build_qtmodule
            qmake /path/to/qtmodule
            make
            make install
            

            You can also build the module with Qt Creator, using the Qt version you want to build your application with.

            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
            2
            • P Offline
              P Offline
              pirates21
              wrote on 23 Apr 2018, 18:51 last edited by pirates21
              #6

              tomasz3dk, SGaist: thank you for your answer. At the moment I installed the library given by tomasz3dk. I am using a cross-compiler (QTRpi) in the QtCreator environment. If I run the project on ubuntu (host) it works, no problem. When the project run on raspberry pi (target), I have an error: "error while loading shared libraries: libqmqtt.so.1: cannot open shared object file: No such file or directory". I guess the library should go to raspberry pi. How should I do it?

              0_1524509495290_blad.png

              1 Reply Last reply
              0
              • S Offline
                S Offline
                SGaist
                Lifetime Qt Champion
                wrote on 23 Apr 2018, 19:53 last edited by
                #7

                Indeed, you have to copy it over.

                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
                2
                • P Offline
                  P Offline
                  pirates21
                  wrote on 23 Apr 2018, 20:33 last edited by pirates21
                  #8

                  I installed the library on ubuntu in this way:
                  cd <projects folder>
                  git clone https://github.com/emqtt/qmqtt.git
                  cd qmqtt
                  mkdir build
                  cd build
                  qmake -r ..
                  sudo make install
                  mkdir mqtt-client
                  cd mqtt-client
                  qmake -r ../../examples/mqtt/client
                  make
                  ./client

                  I had errors when compiling (library) in raspberry. Can I transfer a library from ubuntu to raspberry? SGaist, you could describe in more detail how to do it?

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on 23 Apr 2018, 20:44 last edited by
                    #9

                    No, you need to copy the library you get once you cross-compiled it.

                    How did you install Qt on your Pi ?

                    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
                    2
                    • P Offline
                      P Offline
                      pirates21
                      wrote on 24 Apr 2018, 09:10 last edited by pirates21
                      #10

                      SGaist: Thank you for your help.

                      Only the binary file is sent to Pi. I do not have Qt on raspberry installed. For example, the libqmqtt.so.1 file is located on ubuntu, in the location given in the picture. Where should this file be in raspberry?

                      0_1524561043950_lib.png

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on 24 Apr 2018, 09:42 last edited by
                        #11

                        If you don't have Qt at all on your Pi, how are you running your application ?

                        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
                        • P Offline
                          P Offline
                          pirates21
                          wrote on 24 Apr 2018, 10:09 last edited by pirates21
                          #12

                          I compile applications on Ubuntu with QTrpi. If I do not use the mqtt module in it, it starts normally on raspberry. I'm sorry, I'm a beginner.0_1524566171480_pro.png

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            pirates21
                            wrote on 24 Apr 2018, 13:50 last edited by pirates21
                            #13

                            In the * .pro file, I added: QMAKE_LFLAGS + = -Wl, -rpath, "'$$ ORIGIN'". I put a library on raspberry in the same location as on Ubuntu. It looks like it works.

                            1 Reply Last reply
                            2
                            • S Offline
                              S Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on 24 Apr 2018, 20:22 last edited by
                              #14

                              Good move, so the executable can find it when it's beside it in the same folder.

                              Since you have it working now, then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

                              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
                              2
                              • P Offline
                                P Offline
                                pirates21
                                wrote on 25 Apr 2018, 15:38 last edited by
                                #15

                                Thank You very much!

                                1 Reply Last reply
                                2

                                1/15

                                18 Apr 2018, 11:00

                                • Login

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