Unable to run an example using MQTT
-
Hi,
I am having an issue to run a simple QT WebAssembly example with Qt MQTT because I receive the below compilation error:
Project ERROR: Unknown module(s) in QT: mqtt
Qt version: 5.15.0
emscripten version: 1.39.8
Depending on Qt official documentation the MQTT module is supported but I can not verify it in my case.
https://wiki.qt.io/Qt_for_WebAssembly#Supported_Qt_Modules
Any suggestions or ideas why I am having this compilation error ?
Note: I am able to run normally other WebAssembly examples without using QT MQTT module.
Thanks.
-
Hi @nsourl, and welcome!
You probably have to build the Qt MQTT libraries first. Download the source code from https://code.qt.io/cgit/qt/qtmqtt.git/tree/ and build it for WebAssembly.
-
Hi @JKSH ,
Thank you for your reply!
But I have already downloaded the Qt MQTT source code during Qt 5.15.0 installation and I am running normally the MQTT app using g++ on my 64-bit desktop computer. So, this is not enough and I have to build the source code of Qt MQTT explicitly for WebAssembly?
Thanks.
-
@nsourl said in Unable to run an example using MQTT:
I have already downloaded the Qt MQTT source code during Qt 5.15.0 installation and I am running normally the MQTT app using g++ on my 64-bit desktop computer.
OK, you have the Qt MQTT libraries built for x86_64 applications.
You also need the Qt MQTT libraries built for WebAssembly applications.
So, this is not enough and I have to build the source code of Qt MQTT explicitly for WebAssembly?
Correct. x86_64 and WebAssembly are completely different and incompatible platforms.
Think of it this way: 64-bit Windows desktop libraries can only be used with 64-bit Windows desktop applications. They cannot be used in:
- 32-bit Windows desktop applications
- 64-bit Linux applications
- 64-bit macOS applications
- WebAssembly applications
- Android applications
- iOS applications
For each platform above that you want to support, you need to download or build a dedicated set of libraries.