Search code examples
linuxqtmqtt

Install MQTT Module in Open Source QT


The mqtt module in Qt is only under commercial license available. However you can do it in Open Source Version too, if you have a Linux Distro on your PC.


Solution

  • Im gonna answer question myself, so that others could avoid spending hours of searching in Internet.

    First of all, download and install Qt Creator from official Website. Once you've done it, remember where have you installed it,because you will need its own qmake for the installation mqtt-module and not qmake from your distro.

    Secondly, clone mqtt-git from GitHub into folder, where your Qt was installed. Important to use the branch version of the git, so it must be the newest. Currently the newest branch is 6.1 (but please see the link to sure):

    git clone https://github.com/qt/qtmqtt.git --branch 6.1
    

    After you've cloned that, go the new folder (qtmqtt) and install the module typing following commands (remember that you may installed Qt in another from me directory):

    sudo ~/Qt/6.0.1/gcc_64/bin/qmake
    sudo make
    sudo make install
    

    As you've done this steps, the mqtt module can be imported and used in Qt!