记一次在centos7上编译安装mosquitto的过程

发布时间:2022-12-05 13:00

首先把mosquitto最新源码包克隆到本地

git clone https://github.com/eclipse/mosquitto.git

或者下载压缩包

wget https://mosquitto.org/files/source/mosquitto-2.0.14.tar.gz

然后解压tar xzvf mosquitto-2.0.14.tar.gz
接着进入解压目录

cd mosquitto-2.0.14
mkdir build
cmake ..

执行到cmake ..时,提示如下

CMake Error at CMakeLists.txt:7 (cmake_minimum_required):
  CMake 3.0 or higher is required.  You are running version 2.8.12.2


-- Configuring incomplete, errors occurred!

提示cmake版本小于CMakeLists.txt定义的最小版本CMake 3.0 or higher

接下来升级cmake

wget https://github.com/Kitware/CMake/releases/download/v3.23.2/cmake-3.23.2-linux-x86_64.tar.gz
tar xzvf cmake-3.23.2-linux-x86_64.tar.gz
mv cmake-3.23.2-linux-x86_64 /opt/cmake-3.23.2
sudo yum -y remove cmake
sudo ln -s cmake-3.23.2/bin/* /usr/bin/

[root@VM-12-4-centos ~]# cmake --version
cmake version 3.23.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).

然后继续之前的步骤

[root@VM-12-4-centos build]# cmake ..
-- The C compiler identification is GNU 4.8.5
-- The CXX compiler identification is GNU 4.8.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /usr/lib64/libcrypto.so (found version "1.0.2k")  
-- WITH_DLT = OFF
-- Could NOT find cJSON (missing: CJSON_INCLUDE_DIR CJSON_LIBRARY) 
-- Optional dependency cJSON not found. Some features will be disabled.
-- Looking for getaddrinfo_a in anl
-- Looking for getaddrinfo_a in anl - found
CMake Error at man/CMakeLists.txt:29 (message):
  xsltproc not found: manpages cannot be built


-- Configuring incomplete, errors occurred!
See also "/root/mosquitto-2.0.14/build/CMakeFiles/CMakeOutput.log".

提示xsltproc not found,那就安装下

[root@VM-12-4-centos build]# sudo yum install -y xsltproc
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Determining fastest mirrors
updates                                                                                                                                                                                       | 2.9 kB  00:00:00     
updates/7/x86_64/primary_db                                                                                                                                                                   |  16 MB  00:00:01     
No package xsltproc available.
Error: Nothing to do

这时候再次cmake,以发现有新的提示

[root@VM-12-4-centos build]# cmake ..
-- WITH_DLT = OFF
-- Could NOT find cJSON (missing: CJSON_INCLUDE_DIR CJSON_LIBRARY) 
-- Optional dependency cJSON not found. Some features will be disabled.
CMake Error at man/CMakeLists.txt:29 (message):
  xsltproc not found: manpages cannot be built


-- Configuring incomplete, errors occurred!
See also "/root/mosquitto-2.0.14/build/CMakeFiles/CMakeOutput.log".

看来还需要把cJSON装上

[root@VM-12-4-centos cJSON]# git clone https://github.com/DaveGamble/cJSON.git
Cloning into 'cJSON'...
remote: Enumerating objects: 4545, done.
remote: Counting objects: 100% (59/59), done.
remote: Compressing objects: 100% (43/43), done.
remote: Total 4545 (delta 29), reused 36 (delta 16), pack-reused 4486
Receiving objects: 100% (4545/4545), 2.49 MiB | 1.78 MiB/s, done.
Resolving deltas: 100% (3014/3014), done.

cd cJSON/
cmake ../
make && make install

然后执行cmake ..还是提示xsltproc not found,原因是刚才的xsltproc没安装对,应该这样执行

[root@VM-12-4-centos build]# sudo yum -y install libxslt 
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package libxslt.x86_64 0:1.1.28-6.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=====================================================================================================================================================================================================================
 Package                                            Arch                                              Version                                                    Repository                                     Size
=====================================================================================================================================================================================================================
Installing:
 libxslt                                            x86_64                                            1.1.28-6.el7                                               os                                            242 k

Transaction Summary
=====================================================================================================================================================================================================================
Install  1 Package

Total download size: 242 k
Installed size: 486 k
Downloading packages:
libxslt-1.1.28-6.el7.x86_64.rpm                                                                                                                                                               | 242 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : libxslt-1.1.28-6.el7.x86_64                                                                                                                                                                       1/1 
  Verifying  : libxslt-1.1.28-6.el7.x86_64                                                                                                                                                                       1/1 

Installed:
  libxslt.x86_64 0:1.1.28-6.el7                                                                                                                                                                                      

Complete!

然后查看安装版本,确认安装成功OK

[root@VM-12-4-centos build]# xsltproc --version
Using libxml 20901, libxslt 10128 and libexslt 817
xsltproc was compiled against libxml 20901, libxslt 10128 and libexslt 817
libxslt 10128 was compiled against libxml 20901
libexslt 817 was compiled against libxml 20901

最后继续cmake,果然可以了

[root@VM-12-4-centos build]# cmake ../
-- WITH_DLT = OFF
-- TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /root/mosquitto-2.0.14/build

然后编译安装我们的mosquito

[root@VM-12-4-centos build]# make && make install
[  0%] Building C object lib/CMakeFiles/libmosquitto.dir/actions.c.o
[  1%] Building C object lib/CMakeFiles/libmosquitto.dir/callbacks.c.o
[  1%] Building C object lib/CMakeFiles/libmosquitto.dir/connect.c.o
[  2%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_auth.c.o
[  2%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_connack.c.o
[  3%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_disconnect.c.o
[  3%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_ping.c.o
[  4%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_pubackcomp.c.o
[  4%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_publish.c.o
[  5%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_pubrec.c.o
[  6%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_pubrel.c.o
[  6%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_suback.c.o
[  7%] Building C object lib/CMakeFiles/libmosquitto.dir/handle_unsuback.c.o
[  7%] Building C object lib/CMakeFiles/libmosquitto.dir/helpers.c.o
[  8%] Building C object lib/CMakeFiles/libmosquitto.dir/logging_mosq.c.o
[  8%] Building C object lib/CMakeFiles/libmosquitto.dir/loop.c.o
[  9%] Building C object lib/CMakeFiles/libmosquitto.dir/memory_mosq.c.o
[  9%] Building C object lib/CMakeFiles/libmosquitto.dir/messages_mosq.c.o
[ 10%] Building C object lib/CMakeFiles/libmosquitto.dir/misc_mosq.c.o
[ 10%] Building C object lib/CMakeFiles/libmosquitto.dir/mosquitto.c.o
[ 11%] Building C object lib/CMakeFiles/libmosquitto.dir/net_mosq_ocsp.c.o
[ 12%] Building C object lib/CMakeFiles/libmosquitto.dir/net_mosq.c.o
[ 12%] Building C object lib/CMakeFiles/libmosquitto.dir/options.c.o
[ 13%] Building C object lib/CMakeFiles/libmosquitto.dir/packet_datatypes.c.o
[ 13%] Building C object lib/CMakeFiles/libmosquitto.dir/packet_mosq.c.o
[ 14%] Building C object lib/CMakeFiles/libmosquitto.dir/property_mosq.c.o
[ 14%] Building C object lib/CMakeFiles/libmosquitto.dir/read_handle.c.o
[ 15%] Building C object lib/CMakeFiles/libmosquitto.dir/send_connect.c.o
[ 15%] Building C object lib/CMakeFiles/libmosquitto.dir/send_disconnect.c.o
[ 16%] Building C object lib/CMakeFiles/libmosquitto.dir/send_mosq.c.o
[ 16%] Building C object lib/CMakeFiles/libmosquitto.dir/send_publish.c.o
[ 17%] Building C object lib/CMakeFiles/libmosquitto.dir/send_subscribe.c.o
[ 18%] Building C object lib/CMakeFiles/libmosquitto.dir/send_unsubscribe.c.o
[ 18%] Building C object lib/CMakeFiles/libmosquitto.dir/socks_mosq.c.o
[ 19%] Building C object lib/CMakeFiles/libmosquitto.dir/srv_mosq.c.o
[ 19%] Building C object lib/CMakeFiles/libmosquitto.dir/strings_mosq.c.o
[ 20%] Building C object lib/CMakeFiles/libmosquitto.dir/thread_mosq.c.o
[ 20%] Building C object lib/CMakeFiles/libmosquitto.dir/time_mosq.c.o
[ 21%] Building C object lib/CMakeFiles/libmosquitto.dir/tls_mosq.c.o
[ 21%] Building C object lib/CMakeFiles/libmosquitto.dir/utf8_mosq.c.o
[ 22%] Building C object lib/CMakeFiles/libmosquitto.dir/util_mosq.c.o
[ 22%] Building C object lib/CMakeFiles/libmosquitto.dir/util_topic.c.o
[ 23%] Building C object lib/CMakeFiles/libmosquitto.dir/will_mosq.c.o
[ 24%] Linking C shared library libmosquitto.so
[ 24%] Built target libmosquitto
[ 24%] Building CXX object lib/cpp/CMakeFiles/mosquittopp.dir/mosquittopp.cpp.o
[ 25%] Linking CXX shared library libmosquittopp.so
[ 25%] Built target mosquittopp
[ 26%] Building C object client/CMakeFiles/mosquitto_pub.dir/pub_client.c.o
[ 27%] Building C object client/CMakeFiles/mosquitto_pub.dir/pub_shared.c.o
[ 27%] Building C object client/CMakeFiles/mosquitto_pub.dir/client_shared.c.o
[ 28%] Building C object client/CMakeFiles/mosquitto_pub.dir/client_props.c.o
[ 28%] Linking C executable mosquitto_pub
[ 28%] Built target mosquitto_pub
[ 28%] Building C object client/CMakeFiles/mosquitto_sub.dir/sub_client.c.o
[ 29%] Building C object client/CMakeFiles/mosquitto_sub.dir/sub_client_output.c.o
[ 29%] Building C object client/CMakeFiles/mosquitto_sub.dir/client_shared.c.o
[ 30%] Building C object client/CMakeFiles/mosquitto_sub.dir/client_props.c.o
[ 30%] Linking C executable mosquitto_sub
[ 30%] Built target mosquitto_sub
[ 30%] Building C object client/CMakeFiles/mosquitto_rr.dir/rr_client.c.o
[ 31%] Building C object client/CMakeFiles/mosquitto_rr.dir/pub_shared.c.o
[ 31%] Building C object client/CMakeFiles/mosquitto_rr.dir/sub_client_output.c.o
[ 32%] Building C object client/CMakeFiles/mosquitto_rr.dir/client_shared.c.o
[ 32%] Building C object client/CMakeFiles/mosquitto_rr.dir/client_props.c.o
[ 33%] Linking C executable mosquitto_rr
[ 33%] Built target mosquitto_rr
[ 34%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/alias_mosq.c.o
[ 34%] Building C object src/CMakeFiles/mosquitto.dir/bridge.c.o
[ 35%] Building C object src/CMakeFiles/mosquitto.dir/bridge_topic.c.o
[ 35%] Building C object src/CMakeFiles/mosquitto.dir/conf.c.o
[ 36%] Building C object src/CMakeFiles/mosquitto.dir/conf_includedir.c.o
[ 36%] Building C object src/CMakeFiles/mosquitto.dir/context.c.o
[ 37%] Building C object src/CMakeFiles/mosquitto.dir/control.c.o
[ 37%] Building C object src/CMakeFiles/mosquitto.dir/database.c.o
[ 38%] Building C object src/CMakeFiles/mosquitto.dir/handle_auth.c.o
[ 39%] Building C object src/CMakeFiles/mosquitto.dir/handle_connack.c.o
[ 39%] Building C object src/CMakeFiles/mosquitto.dir/handle_connect.c.o
[ 40%] Building C object src/CMakeFiles/mosquitto.dir/handle_disconnect.c.o
[ 40%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_ping.c.o
[ 41%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_pubackcomp.c.o
[ 41%] Building C object src/CMakeFiles/mosquitto.dir/handle_publish.c.o
[ 42%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_pubrec.c.o
[ 42%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_pubrel.c.o
[ 43%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_suback.c.o
[ 43%] Building C object src/CMakeFiles/mosquitto.dir/handle_subscribe.c.o
[ 44%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/handle_unsuback.c.o
[ 45%] Building C object src/CMakeFiles/mosquitto.dir/handle_unsubscribe.c.o
[ 45%] Building C object src/CMakeFiles/mosquitto.dir/keepalive.c.o
[ 46%] Building C object src/CMakeFiles/mosquitto.dir/logging.c.o
[ 46%] Building C object src/CMakeFiles/mosquitto.dir/loop.c.o
[ 47%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/memory_mosq.c.o
[ 47%] Building C object src/CMakeFiles/mosquitto.dir/memory_public.c.o
[ 48%] Building C object src/CMakeFiles/mosquitto.dir/mosquitto.c.o
[ 48%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/misc_mosq.c.o
[ 49%] Building C object src/CMakeFiles/mosquitto.dir/mux.c.o
[ 49%] Building C object src/CMakeFiles/mosquitto.dir/mux_epoll.c.o
[ 50%] Building C object src/CMakeFiles/mosquitto.dir/mux_poll.c.o
[ 51%] Building C object src/CMakeFiles/mosquitto.dir/net.c.o
[ 51%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/net_mosq_ocsp.c.o
[ 52%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/net_mosq.c.o
[ 52%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/packet_datatypes.c.o
[ 53%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/packet_mosq.c.o
[ 53%] Building C object src/CMakeFiles/mosquitto.dir/password_mosq.c.o
[ 54%] Building C object src/CMakeFiles/mosquitto.dir/persist_read_v234.c.o
[ 54%] Building C object src/CMakeFiles/mosquitto.dir/persist_read_v5.c.o
[ 55%] Building C object src/CMakeFiles/mosquitto.dir/persist_read.c.o
[ 55%] Building C object src/CMakeFiles/mosquitto.dir/persist_write_v5.c.o
[ 56%] Building C object src/CMakeFiles/mosquitto.dir/persist_write.c.o
[ 57%] Building C object src/CMakeFiles/mosquitto.dir/plugin.c.o
[ 57%] Building C object src/CMakeFiles/mosquitto.dir/plugin_public.c.o
[ 58%] Building C object src/CMakeFiles/mosquitto.dir/property_broker.c.o
[ 58%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/property_mosq.c.o
[ 59%] Building C object src/CMakeFiles/mosquitto.dir/read_handle.c.o
[ 59%] Building C object src/CMakeFiles/mosquitto.dir/retain.c.o
[ 60%] Building C object src/CMakeFiles/mosquitto.dir/security.c.o
[ 60%] Building C object src/CMakeFiles/mosquitto.dir/security_default.c.o
[ 61%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_mosq.c.o
[ 62%] Building C object src/CMakeFiles/mosquitto.dir/send_auth.c.o
[ 62%] Building C object src/CMakeFiles/mosquitto.dir/send_connack.c.o
[ 63%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_connect.c.o
[ 63%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_disconnect.c.o
[ 64%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_publish.c.o
[ 64%] Building C object src/CMakeFiles/mosquitto.dir/send_suback.c.o
[ 65%] Building C object src/CMakeFiles/mosquitto.dir/signals.c.o
[ 65%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_subscribe.c.o
[ 66%] Building C object src/CMakeFiles/mosquitto.dir/send_unsuback.c.o
[ 66%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/send_unsubscribe.c.o
[ 67%] Building C object src/CMakeFiles/mosquitto.dir/session_expiry.c.o
[ 68%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/strings_mosq.c.o
[ 68%] Building C object src/CMakeFiles/mosquitto.dir/subs.c.o
[ 69%] Building C object src/CMakeFiles/mosquitto.dir/sys_tree.c.o
[ 69%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/time_mosq.c.o
[ 70%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/tls_mosq.c.o
[ 70%] Building C object src/CMakeFiles/mosquitto.dir/topic_tok.c.o
[ 71%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/util_mosq.c.o
[ 71%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/util_topic.c.o
[ 72%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/utf8_mosq.c.o
[ 72%] Building C object src/CMakeFiles/mosquitto.dir/websockets.c.o
[ 73%] Building C object src/CMakeFiles/mosquitto.dir/will_delay.c.o
[ 74%] Building C object src/CMakeFiles/mosquitto.dir/__/lib/will_mosq.c.o
[ 74%] Linking C executable mosquitto
[ 74%] Built target mosquitto
[ 74%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/mosquitto_ctrl.c.o
[ 75%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/client.c.o
[ 75%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/dynsec.c.o
[ 76%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/dynsec_client.c.o
[ 76%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/dynsec_group.c.o
[ 77%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/dynsec_role.c.o
[ 78%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/__/mosquitto_passwd/get_password.c.o
[ 78%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/__/__/lib/memory_mosq.c.o
[ 79%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/__/__/src/memory_public.c.o
[ 79%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/options.c.o
[ 80%] Building C object apps/mosquitto_ctrl/CMakeFiles/mosquitto_ctrl.dir/__/__/src/password_mosq.c.o
[ 80%] Linking C executable mosquitto_ctrl
[ 80%] Built target mosquitto_ctrl
[ 81%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/mosquitto_passwd.c.o
[ 81%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/get_password.c.o
[ 82%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/__/__/lib/memory_mosq.c.o
[ 82%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/__/__/src/memory_public.c.o
[ 83%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/__/__/lib/misc_mosq.c.o
[ 83%] Building C object apps/mosquitto_passwd/CMakeFiles/mosquitto_passwd.dir/__/__/src/password_mosq.c.o
[ 84%] Linking C executable mosquitto_passwd
[ 84%] Built target mosquitto_passwd
[ 85%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/acl.c.o
[ 85%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/auth.c.o
[ 86%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/clients.c.o
[ 87%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/clientlist.c.o
[ 87%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/groups.c.o
[ 88%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/grouplist.c.o
[ 88%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/json_help.c.o
[ 89%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/plugin.c.o
[ 89%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/roles.c.o
[ 90%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/rolelist.c.o
[ 90%] Building C object plugins/dynamic-security/CMakeFiles/mosquitto_dynamic_security.dir/sub_matches_sub.c.o
[ 91%] Linking C shared module mosquitto_dynamic_security.so
[ 91%] Built target mosquitto_dynamic_security
[ 91%] Building C object plugins/message-timestamp/CMakeFiles/mosquitto_message_timestamp.dir/mosquitto_message_timestamp.c.o
[ 92%] Linking C shared module mosquitto_message_timestamp.so
[ 92%] Built target mosquitto_message_timestamp
[ 93%] Building C object plugins/payload-modification/CMakeFiles/mosquitto_payload_modification.dir/mosquitto_payload_modification.c.o
[ 93%] Linking C shared module mosquitto_payload_modification.so
[ 93%] Built target mosquitto_payload_modification
[ 94%] Built target mosquitto_ctrl.1
[ 94%] Built target mosquitto_ctrl_dynsec.1
[ 94%] Built target mosquitto_passwd.1
[ 95%] Built target mosquitto_pub.1
[ 96%] Built target mosquitto_sub.1
[ 97%] Built target mosquitto_rr.1
[ 97%] Built target libmosquitto.3
[ 98%] Built target mosquitto.conf.5
[ 99%] Built target mosquitto-tls.7
[100%] Built target mqtt.7
[100%] Built target mosquitto.8
Consolidate compiler generated dependencies of target libmosquitto
[ 24%] Built target libmosquitto
Consolidate compiler generated dependencies of target mosquittopp
[ 25%] Built target mosquittopp
Consolidate compiler generated dependencies of target mosquitto_pub
[ 28%] Built target mosquitto_pub
Consolidate compiler generated dependencies of target mosquitto_sub
[ 30%] Built target mosquitto_sub
Consolidate compiler generated dependencies of target mosquitto_rr
[ 33%] Built target mosquitto_rr
Consolidate compiler generated dependencies of target mosquitto
[ 74%] Built target mosquitto
Consolidate compiler generated dependencies of target mosquitto_ctrl
[ 80%] Built target mosquitto_ctrl
Consolidate compiler generated dependencies of target mosquitto_passwd
[ 84%] Built target mosquitto_passwd
Consolidate compiler generated dependencies of target mosquitto_dynamic_security
[ 91%] Built target mosquitto_dynamic_security
Consolidate compiler generated dependencies of target mosquitto_message_timestamp
[ 92%] Built target mosquitto_message_timestamp
Consolidate compiler generated dependencies of target mosquitto_payload_modification
[ 93%] Built target mosquitto_payload_modification
[ 94%] Built target mosquitto_ctrl.1
[ 94%] Built target mosquitto_ctrl_dynsec.1
[ 94%] Built target mosquitto_passwd.1
[ 95%] Built target mosquitto_pub.1
[ 96%] Built target mosquitto_sub.1
[ 97%] Built target mosquitto_rr.1
[ 97%] Built target libmosquitto.3
[ 98%] Built target mosquitto.conf.5
[ 99%] Built target mosquitto-tls.7
[100%] Built target mqtt.7
[100%] Built target mosquitto.8
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/etc/mosquitto/mosquitto.conf
-- Installing: /usr/local/etc/mosquitto/aclfile.example
-- Installing: /usr/local/etc/mosquitto/pskfile.example
-- Installing: /usr/local/etc/mosquitto/pwfile.example
-- Installing: /usr/local/lib64/pkgconfig/libmosquitto.pc
-- Installing: /usr/local/lib64/pkgconfig/libmosquittopp.pc
-- Installing: /usr/local/lib64/libmosquitto.so.2.0.14
-- Installing: /usr/local/lib64/libmosquitto.so.1
-- Set runtime path of "/usr/local/lib64/libmosquitto.so.2.0.14" to ""
-- Installing: /usr/local/lib64/libmosquitto.so
-- Installing: /usr/local/include/mosquitto.h
-- Installing: /usr/local/include/mqtt_protocol.h
-- Installing: /usr/local/lib64/libmosquittopp.so.2.0.14
-- Installing: /usr/local/lib64/libmosquittopp.so.1
-- Set runtime path of "/usr/local/lib64/libmosquittopp.so.2.0.14" to ""
-- Installing: /usr/local/lib64/libmosquittopp.so
-- Installing: /usr/local/include/mosquittopp.h
-- Installing: /usr/local/bin/mosquitto_pub
-- Set runtime path of "/usr/local/bin/mosquitto_pub" to ""
-- Installing: /usr/local/bin/mosquitto_sub
-- Set runtime path of "/usr/local/bin/mosquitto_sub" to ""
-- Installing: /usr/local/bin/mosquitto_rr
-- Set runtime path of "/usr/local/bin/mosquitto_rr" to ""
-- Installing: /usr/local/sbin/mosquitto
-- Installing: /usr/local/include/mosquitto_broker.h
-- Installing: /usr/local/include/mosquitto_plugin.h
-- Installing: /usr/local/bin/mosquitto_ctrl
-- Set runtime path of "/usr/local/bin/mosquitto_ctrl" to ""
-- Installing: /usr/local/bin/mosquitto_passwd
-- Installing: /usr/local/lib64/mosquitto_dynamic_security.so
-- Set runtime path of "/usr/local/lib64/mosquitto_dynamic_security.so" to ""
-- Installing: /usr/local/share/man/man1/mosquitto_ctrl.1
-- Installing: /usr/local/share/man/man1/mosquitto_ctrl_dynsec.1
-- Installing: /usr/local/share/man/man1/mosquitto_passwd.1
-- Installing: /usr/local/share/man/man1/mosquitto_pub.1
-- Installing: /usr/local/share/man/man1/mosquitto_sub.1
-- Installing: /usr/local/share/man/man1/mosquitto_rr.1
-- Installing: /usr/local/share/man/man3/libmosquitto.3
-- Installing: /usr/local/share/man/man5/mosquitto.conf.5
-- Installing: /usr/local/share/man/man7/mosquitto-tls.7
-- Installing: /usr/local/share/man/man7/mqtt.7
-- Installing: /usr/local/share/man/man8/mosquitto.8

然后进入build目录下的src目录可以看到编译后的二进制文件

[root@VM-12-4-centos src]# ls -al
total 516
drwxr-xr-x  3 root root   4096 Jul  9 11:31 .
drwxr-xr-x 10 root root   4096 Jul  9 11:31 ..
drwxr-xr-x  3 root root   4096 Jul  9 11:25 CMakeFiles
-rw-r--r--  1 root root   2338 Jul  9 11:25 cmake_install.cmake
-rw-r--r--  1 root root  79547 Jul  9 11:25 Makefile
-rwxr-xr-x  1 root root 426784 Jul  9 11:31 mosquitto

试着让mosquitto运行起来

[root@VM-12-4-centos src]# ./mosquitto -p 8023
1657337560: Warning: Unable to drop privileges to 'mosquitto' because this user does not exist. Trying 'nobody' instead.
1657337560: mosquitto version 2.0.14 starting
1657337560: Using default config.
1657337560: Starting in local only mode. Connections will only be possible from clients running on this machine.
1657337560: Create a configuration file which defines a listener to allow remote access.
1657337560: For more details see https://mosquitto.org/documentation/authentication-methods/
1657337560: Opening ipv4 listen socket on port 8023.
1657337560: Opening ipv6 listen socket on port 8023.
1657337560: mosquitto version 2.0.14 running

Ok,大功告成!

ItVuer - 免责声明 - 关于我们 - 联系我们

本网站信息来源于互联网,如有侵权请联系:561261067@qq.com

桂ICP备16001015号