Mqtt module - client
-
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.
-
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.
-
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?
-
As alternative you can use emqtt/qmqtt
. -
@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.
-
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?
-
Indeed, you have to copy it over.
-
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
./clientI 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?
-
No, you need to copy the library you get once you cross-compiled it.
How did you install Qt on your Pi ?
-
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?
-
If you don't have Qt at all on your Pi, how are you running your application ?
-
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 :)