一、MQTT(EMQ X)服务器安装极其配置
1、下载EMQ X客户端
从该网址进入
https://github.com/emqx/emqx
,下载需要的版本。我下载的是windows版本。
将下载好的文件解压到磁盘
3.1添加环境变量
将
emqx\bin
添加为环境变量
3.2启动
打开cmd命令,输入
emqx start
检测emqx是否正常开启,输入以下命令:
emqx_ctl status
3.3可视化(Dashboard)
打开浏览器,输入
http://localhost:18083/
默认账号密码是
admin;publish
这个时候我们就能查看服务器基本信息、负载情 况和统计数据等信息。
这个时候,我们的EMQ X就安装成功了。
更多细节,请移步EMQ文档
https://docs.emqx.io/broker/latest/cn/getting-started/install.html
二、Qt MQTT(QtMqtt)模块编译及配置
1、安装Qt
我安装的是5.14.2 windows版本,值得注意的是,在安装过程中,
要把Perl给选中
,如果不选中,编译时会报错。
2、下载Qt MQTT模块
https://github.com/qt/qtmqtt
3、编译Qt MQTT模块
3.1解压
将MQTT模块解压到D盘
3.2新建
(1)在Qt\Qt5.14.2\5.14.2\mingw73_64\include文件夹下新建一个
QtMqtt文件夹
.
(2)将qtmqtt-dev\src\mqtt文件夹中的所有.h的文件全部复制到(1)中的QtMqtt文件夹内。如果不复制可能会报错。
报错如下:error: QtMqtt/qmqttglobal.h: No such file or directory
3.3导入
打开Qt Creator,将MQTT项目导入
3.4 编译
选择
Release
版本,然后点击编译(也就是点击最下面的小锤子)。等待编译完成。
4、装载QtMqtt模块
将框出的文件夹内的内容放入Qt5.14.2\5.14.2\mingw73_64对应的文件夹内。这里我安装的是mingw73_64,自行选择其他。
下载好的QtMqtt源码中有自带例子,我们以simpleclient为例子。
将simpleclient导入到Qt Creator中,
这里需要注意的是需要将#include <QtMqtt/QMqttClient>替换为#include <QtMqtt/qmqttclient.h>
,不然会报错。
最后打开我们安装好的EMQ X,简单的服务器-客服端就搭建好了。
Qt 5.14.2+MQTT(EMQ X+win10一、MQTT(EMQ X)服务器安装极其配置 1、下载EMQ X客户端 从该网址进入https://github.com/emqx/emqx,下载需要的版本。我下载的是windows版本。 2、解压 将下载好的文件解压到磁盘 3、运行 3.1添加环境变量 ...
网上大多都是Windows下的
QT
MQTT
编译
安装
方法,Linux下有些不同,此文件是关于UBuntu和ARM Linux下
QT
MQTT
库的
编译
安装
详细步骤
--------------------------------------------------------
Linux版本:UBuntu 16.04 LTS
QT
版本:5.12.9
MQTT
版本:5.12.9
--------------------------------------------------------
GCC版本:4.9.3
交叉
编译
工具:gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf
Qmake版本:3.1
QT
版本:5.12.9
Arm linux目标板:周立功 DCP-1000L
--------------------------------------------------------
注:本文不包括
QT
源码ARM Linux的裁剪和交叉
编译
Building on: linux-g++ (x86_64, CPU features: mmx sse sse2)
Building for: linux-aarch64-gnu-g++ (arm64, CPU features: neon)
Target compiler: gcc 6.3.1
Configuration: cross_compile use_gold_linker compile_examples enable_new_dtags largefile neon precompile_header shared rpath release c++11 c++14 concurrent dbus reduce_exports stl
Build options:
Mode ................................... release
Optimize release build for size ........ no
Building shared libraries .............. yes
Using C standard ....................... C11
Using C++ standard ..................... C++14
Using ccache ........................... no
Using gold linker ...................... yes
Using new DTAGS ........................ yes
Using precompiled headers .............. yes
Using LTCG ............................. no
Target compiler supports:
NEON ................................. yes
Build parts ............................ libs
Qt
modules and options:
Qt
Concurrent .......................... yes
Qt
D-Bus ............................... yes
Qt
D-Bus directly linked to libdbus .... no
Qt
Gui ................................. yes
Qt
Network ............................. yes
Qt
Sql ................................. yes
Qt
Testlib ............................. yes
Qt
Widgets ............................. yes
Qt
Xml ................................. yes
Support enabled for:
Using pkg-config ....................... yes
udev ................................... no
Using system zlib ...................... yes
Qt
Core:
DoubleConversion ....................... yes
Using system DoubleConversion ........ no
GLib ................................... no
iconv .................................. yes
ICU .................................... no
Tracing backend ........................
Logging backends:
journald ............................. no
syslog ............................... no
slog2 ................................ no
Using system PCRE2 ..................... no
Qt
Network:
getifaddrs() ........................... yes
IPv6 ifname ............................ yes
libproxy ............................... no
Linux AF_NETLINK ....................... yes
OpenSSL ................................ yes
Qt
directly linked to OpenSSL ........ no
OpenSSL 1.1 ............................ no
DTLS ................................... yes
SCTP ................................... no
Use system proxies ..................... yes
Qt
Gui:
Accessibility .......................... yes
FreeType ............................... yes
Using system FreeType ................ no
HarfBuzz ............................... yes
Using system HarfBuzz ................ no
Fontconfig ............................. no
Image formats:
GIF .................................. yes
ICO .................................. yes
JPEG ................................. yes
Using system libjpeg ............... yes
PNG .................................. yes
Using system libpng ................ no
EGL .................................... no
OpenVG ................................. no
OpenGL:
Desktop OpenGL ....................... no
OpenGL ES 2.0 ........................ no
OpenGL ES 3.0 ........................ no
OpenGL ES 3.1 ........................ no
OpenGL ES 3.2 ........................ no
Vulkan ................................. no
Session Management ..................... yes
Features used by QPA backends:
evdev .................................. yes
libinput ............................... no
INTEGRITY HID .......................... no
mtdev .................................. no
tslib .................................. no
xkbcommon .............................. no
X11 specific:
XLib ................................. no
EGL on X11 ........................... no
QPA backends:
DirectFB ............................... no
EGLFS .................................. no
LinuxFB ................................ yes
VNC .................................... yes
Mir client ............................. no
Qt
Sql:
SQL item models ........................ yes
Qt
Widgets:
GTK+ ................................... no
Styles ................................. Fusion Windows
Qt
PrintSupport:
CUPS ................................... no
Qt
Sql Drivers:
DB2 (IBM) .............................. no
InterBase .............................. no
MySql .................................. no
OCI (Oracle) ........................... no
ODBC ................................... no
PostgreSQL ............................. no
SQLite2 ................................ no
SQLite ................................. yes
Using system provided SQLite ......... no
TDS (Sybase) ........................... no
Qt
Testlib:
Tester for item models ................. yes
Qt
SerialBus:
Socket CAN ............................. yes
Socket CAN FD .......................... yes
Qt
QML:
QML network support .................... yes
QML debugging and profiling support .... yes
QML sequence object .................... yes
QML list model ......................... yes
QML XML http request ................... yes
QML Locale ............................. yes
QML delegate model ..................... yes
Qt
Quick:
Direct3D 12 ............................ no
AnimatedImage item ..................... yes
Canvas item ............................ yes
Support for
Qt
Quick Designer .......... yes
Flipable item .......................... yes
GridView item .......................... yes
ListView item .......................... yes
TableView item ......................... yes
Path support ........................... yes
PathView item .......................... yes
Positioner items ....................... yes
Repeater item .......................... yes
ShaderEffect item ...................... yes
Sprite item ............................ yes
Qt
Scxml:
ECMAScript data model for
Qt
Scxml ...... yes
Qt
Gamepad:
SDL2 ................................... no
Qt
3D:
Assimp ................................. yes
System Assimp .......................... no
Output
Qt
3D Job traces ................. no
Output
Qt
3D GL traces .................. no
Use SSE2 instructions .................. no
Use AVX2 instructions .................. no
Aspects:
Render aspect ........................ yes
Input aspect ......................... yes
Logic aspect ......................... yes
Animation aspect ..................... yes
Extras aspect ........................ yes
Qt
3D Renderers:
OpenGL Renderer ........................ yes
Qt
3D GeometryLoaders:
Autodesk FBX ........................... no
Qt
Wayland Client ........................ no
Qt
Wayland Compositor .................... no
Qt
Bluetooth:
BlueZ .................................. no
BlueZ Low Energy ....................... no
Linux Crypto API ....................... no
WinRT Bluetooth API (desktop & UWP) .... no
Qt
Sensors:
sensorfw ............................... no
Qt
Quick Controls 2:
Styles ................................. Default Fusion Imagine Material Universal
Qt
Quick Templates 2:
Hover support .......................... yes
Multi-touch support .................... yes
Qt
Positioning:
Gypsy GPS Daemon ....................... no
WinRT Geolocation API .................. no
Qt
Location:
Qt
.labs.location experimental QML plugin . yes
Geoservice plugins:
OpenStreetMap ........................ yes
HERE ................................. yes
Esri ................................. yes
Mapbox ............................... yes
MapboxGL ............................. no
Itemsoverlay ......................... yes
Qt
XmlPatterns:
XML schema support ..................... yes
Qt
Multimedia:
ALSA ................................... no
GStreamer 1.0 .......................... no
GStreamer 0.10 ......................... no
Video for Linux ........................ yes
OpenAL ................................. no
PulseAudio ............................. no
Resource Policy (libresource
qt
5) ....... no
Windows Audio Services ................. no
DirectShow ............................. no
Windows Media Foundation ............... no
Qt
Tools:
QDoc ................................... no
Qt
WebEngine:
Embedded build ......................... yes
Pepper Plugins ......................... no
Printing and PDF ....................... no
Proprietary Codecs ..................... no
Spellchecker ........................... yes
Native Spellchecker .................... no
WebRTC ................................. no
Use System Ninja ....................... no
Geolocation ............................ yes
WebChannel support ..................... yes
Use v8 snapshot ........................ yes
Kerberos Authentication ................ no
Building v8 snapshot supported ......... yes
Use ALSA ............................... no
Use PulseAudio ......................... no
Optional system libraries used:
re2 .................................. no
icu .................................. no
libwebp, libwebpmux and libwebpdemux . no
opus ................................. no
ffmpeg ............................... no
libvpx ............................... no
snappy ............................... no
glib ................................. no
zlib ................................. yes
minizip .............................. no
libevent ............................. no
jsoncpp .............................. no
protobuf ............................. no
libxml2 and libxslt .................. no
lcms2 ................................ no
png .................................. no
JPEG ................................. no
harfbuzz ............................. no
freetype ............................. no
x11 .................................. no
Required system libraries:
fontconfig ........................... no
dbus ................................. no
nss .................................. no
khr .................................. no
glibc ................................ yes
Required system libraries for qpa-xcb:
libdrm ............................... no
xcomposite ........................... no
xcursor .............................. no
xi ................................... no
xrandr ............................... no
xtst ................................. no
Note: Also available for Linux: linux-clang linux-icc
1.下载
MQTT
源码下载地址:https://github.com/
qt
/
qt
mqtt
https://github.com/
qt
/
qt
mqtt
不要下载点开链接后默认出现的版本,选择和
QT
对应版本的源码2.解压源码
3.
编译
源码3.1 进入源码目录
3.2 执行qmake
执行后会生成Makefile3.3 执行make
报错1:缺少头文件q
mqtt
global.h解决方法:将src/
qt
mqtt
/下的头文件复制到include/
Qt
Mqtt
/,在没有执行make前,是没有include/
Qt
将下载下来的
qt
mqtt
压缩包解压到合法路径下
复制相关头文件
1)在
QT
安装
目录下,选择对应的
QT
版本和常用的
编译
器,笔者常用 MSVC 2017 32-bit,选择进入此
编译
版本文件夹并进入include文件夹,在此目录下新建
Qt
Mqtt
文件夹。
2)将**.\src\
mqtt
**文件夹
打开最外层的
qt
mqtt
.pro项目文件,构建中会包文件找不到,如 <
Qt
Mqtt
/q
mqtt
global.h>等文件,
主要原件是
编译
器是按照在
Qt
安装
目录下搜索的,但我们文件是我们自己随意放的目录下的 src\
mqtt
路径下。
在
安装
目下include下创建
Qt
Mqtt
文件夹,例如
Qt
5.9.9\5.9.9\mingw53_32\include\
Qt
Mqtt
1、q
mqtt
相关库和头文件
需要自己
编译
源码(源码下载地址https://github.com/
emqx
/q
mqtt
),
编译
后lib文件夹下的*.a文件即为库文件。
将源码下的所有头文件复制到一个文件夹,生成的库文件放在一个文件夹。
新项目直接包含头文件和库文件就可以使用q
mqtt
了。
2、
emq
服务器
搭建(windows)
命令行切换到
emq
目录,执行命令
emq
ttd start打...
编译
安装
Qt
Mqtt
的几个问题及解决办法
最近一个项目中要用到
MQTT
Client 的一些功能。
Qt
的发行版还没有包含相关的
模块
。但是在下面这个
Qt
的官网上已经能找到相关的
模块
了:
https://codereview.
qt
-project.org/#/admin/projects/
qt
/
qt
mqtt
github 上也能搜到不少相关的代码:
https://github.com/
qt
/
qt
mqtt
https://github.com/toni1991/
Qt
Mqtt
https://gith
在Linux/ARM下
编译
安装
Qt
MQTT
库,您可以按照以下步骤进行操作:
1. 首先,确保您已经在ARM架构的Linux系统上
安装
了必要的
编译
工具和依赖项,例如GCC、make等。可以通过包管理器或从源代码手动
安装
它们。
2. 下载
Qt
MQTT
库的源代码,可以从
Qt
官方网站或其他可靠的资源下载。确保选择与您的
Qt
版本兼容的源代码。
3. 解压源代码文件,并进入解压后的目录。
4. 打开终端,进入源代码目录,并执行以下命令来生成Makefile:
qmake
5. 接下来,使用make命令
编译
库文件:
6.
编译
过程可能会需要一些时间,具体取决于您的系统性能。请耐心等待
编译
完成。
7. 完成
编译
后,可以使用以下命令
安装
Qt
MQTT
库到系统中:
make install
8.
安装
完成后,您可以在系统的
Qt
库目录中找到
MQTT
库文件。可以通过以下命令获取库文件的位置:
qmake -query
QT
_INSTALL_LIBS
9. 接下来,您可以在
Qt
项目中使用
MQTT
库。在项目的.pro文件中添加以下行:
LIBS += -l
Qt
5
Mqtt
以上就是在Linux/ARM下
编译
安装
Qt
MQTT
库的简要步骤。请注意,这只是一般的指导,具体步骤可能会因您所使用的系统和版本而有所差异。请参考
Qt
官方文档或相关资源获取更详细的信息。
### 回答2:
在Linux/ARM平台下,
编译
安装
Qt
MQTT
库的过程如下:
1. 首先,确保系统中已经
安装
了必要的开发工具链和依赖库。可以使用以下命令
安装
:
sudo apt-get update
sudo apt-get install build-essential
sudo apt-get install libssl-dev
2. 下载
Qt
MQTT
库的源代码。可以从
Qt
官方网站的下载页面或Github上的项目页面获取最新的源代码。
3. 解压下载的源代码。可以使用以下命令:
tar -xzvf
qt
-
mqtt
-xxx.tar.gz
cd
qt
-
mqtt
-xxx
4. 创建一个用于
编译
的目录,并进入该目录:
mkdir build
cd build
5. 配置
编译
选项。运行以下命令,选择所需的配置选项:
qmake ..
你可以在此处添加其他自定义的配置选项。
6. 运行make命令进行
编译
:
这将会生成
Qt
MQTT
库的可执行文件。
7. (可选)运行make install命令进行
安装
。这将会将
Qt
MQTT
库复制到系统目录中,以便其他项目可以使用:
sudo make install
如果不想全局
安装
库,可以跳过此步骤,将生成的库文件手动复制到项目中使用。
完成上述步骤后,你就成功地在Linux/ARM平台下
编译
安装
了
Qt
MQTT
库。注意,具体的命令和选项可能会根据你所使用的Linux发行版和版本而有所不同,以上命令仅供参考。
### 回答3:
在Linux/ARM下
编译
安装
Qt
MQTT
库,需要按照以下步骤进行:
1. 首先,确保你已经
安装
了
Qt
开发环境和所需的
编译
工具链。你可以使用命令行工具或者图形界面工具进行
安装
。
2. 下载
Qt
MQTT
库的源代码。你可以在
Qt
的官方网站上找到对应的版本。下载后,解压缩源代码到你的开发环境下的任意目录。
3. 打开终端,进入解压缩后的源代码目录。使用cd命令进行切换目录。
4. 创建一个新的构建目录,并进入该目录。这个目录将用于存储
编译
生成的文件。可以使用以下命令创建并进入该目录:
mkdir build
cd build
5. 使用qmake命令生成Makefile文件。执行以下命令:
qmake ..
6. 使用make命令进行
编译
。执行以下命令:
7.
编译
完成后,可以使用make install命令进行
安装
。执行以下命令:
make install
8.
安装
完成后,你可以在系统的
Qt
库目录中找到
编译
生成的
MQTT
库文件。其中包括头文件和库文件。
9. 最后,你可以在你的项目中使用
Qt
MQTT
库。在你的项目文件中添加相应的包含路径和链接库即可开始使用。
请注意,以上步骤中涉及到的命令和路径可能需要根据你的具体环境和需求进行调整。此外,确保你已经阅读并理解了
Qt
MQTT
库的
编译
要求和依赖项,以确保顺利进行
编译
和
安装
。