Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Mqtt module - client

    QtonPi
    3
    15
    5043
    Loading More Posts
    • 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
      pirates21 last edited by pirates21

      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 Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        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 Reply Quote 1
        • P
          pirates21 last edited by pirates21

          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 Reply Quote 0
          • tomasz3dk
            tomasz3dk last edited by

            As alternative you can use emqtt/qmqtt
            .

            1 Reply Last reply Reply Quote 1
            • SGaist
              SGaist Lifetime Qt Champion last edited by

              @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 Reply Quote 2
              • P
                pirates21 last edited by pirates21

                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 Reply Quote 0
                • SGaist
                  SGaist Lifetime Qt Champion last edited by

                  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 Reply Quote 2
                  • P
                    pirates21 last edited by pirates21

                    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 Reply Quote 0
                    • SGaist
                      SGaist Lifetime Qt Champion last edited by

                      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 Reply Quote 2
                      • P
                        pirates21 last edited by pirates21

                        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 Reply Quote 0
                        • SGaist
                          SGaist Lifetime Qt Champion last edited by

                          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 Reply Quote 0
                          • P
                            pirates21 last edited by pirates21

                            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 Reply Quote 0
                            • P
                              pirates21 last edited by pirates21

                              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 Reply Quote 2
                              • SGaist
                                SGaist Lifetime Qt Champion last edited by

                                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 Reply Quote 2
                                • P
                                  pirates21 last edited by

                                  Thank You very much!

                                  1 Reply Last reply Reply Quote 2
                                  • First post
                                    Last post