mqtt_cpp编译过程中遇到的问题

CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Boost: Found unsuitable version "1.71.0", but required is at
  least "1.74.0" (found /usr/include)
Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE)
  /usr/share/cmake-3.16/Modules/FindBoost.cmake:2179 (find_package_handle_standard_args)
  CMakeLists.txt:131 (FIND_PACKAGE)


-- Configuring incomplete, errors occurred!
See also "/home/drh/workspace/cpp/MQTT/mqtt_cpp/build/CMakeFiles/CMakeOutput.log".
See also "/home/drh/workspace/cpp/MQTT/mqtt_cpp/build/CMakeFiles/CMakeError.log".

提示Boost版本不对。

执行 sudo apt install libboost-all-dev 没有解决.

Boost源码获取https://www.boost.org/users/download/

参考了https://blog.csdn.net/qq_35395195/article/details/126222063编译并安装源码之后顺利编译成功。

执行make test后出现:

Test project /home/drh/workspace/cpp/MQTT/mqtt_cpp/build
      Start  1: st_connect
 1/46 Test  #1: st_connect .......................***Failed    0.00 sec
      Start  2: st_underlying_timeout
 2/46 Test  #2: st_underlying_timeout ............***Failed    0.00 sec
      Start  3: st_as_buffer_sub
 3/46 Test  #3: st_as_buffer_sub .................***Failed    0.00 sec
      Start  4: st_topic_alias
 4/46 Test  #4: st_topic_alias ...................***Failed    0.00 sec
      Start  5: st_as_buffer_pubsub
 5/46 Test  #5: st_as_buffer_pubsub ..............***Failed    0.00 sec
      Start  6: st_shared_sub
 6/46 Test  #6: st_shared_sub ....................***Failed    0.00 sec
      Start  7: st_maximum_packet_size
 7/46 Test  #7: st_maximum_packet_size ...........***Failed    0.00 sec
      Start  8: st_receive_maximum
 8/46 Test  #8: st_receive_maximum ...............***Failed    0.00 sec
      Start  9: st_pubsub_1
 9/46 Test  #9: st_pubsub_1 ......................***Failed    0.00 sec
      Start 10: st_sub
10/46 Test #10: st_sub ...........................***Failed    0.00 sec
      Start 11: st_pubsub_2
11/46 Test #11: st_pubsub_2 ......................***Failed    0.00 sec
      Start 12: st_pubsub_no_strand
12/46 Test #12: st_pubsub_no_strand ..............***Failed    0.00 sec
      Start 13: st_as_buffer_async_pubsub_1
13/46 Test #13: st_as_buffer_async_pubsub_1 ......***Failed    0.00 sec
      Start 14: st_multi_sub
14/46 Test #14: st_multi_sub .....................***Failed    0.00 sec
      Start 15: st_as_buffer_async_pubsub_2
15/46 Test #15: st_as_buffer_async_pubsub_2 ......***Failed    0.00 sec
      Start 16: st_async_pubsub_1
16/46 Test #16: st_async_pubsub_1 ................***Failed    0.00 sec
      Start 17: st_reqres
17/46 Test #17: st_reqres ........................***Failed    0.00 sec
      Start 18: st_resend
18/46 Test #18: st_resend ........................***Failed    0.00 sec
      Start 19: st_retain_1
19/46 Test #19: st_retain_1 ......................***Failed    0.00 sec
      Start 20: st_resend_new_client
20/46 Test #20: st_resend_new_client .............***Failed    0.00 sec
      Start 21: st_retain_2
21/46 Test #21: st_retain_2 ......................***Failed    0.00 sec
      Start 22: st_will
22/46 Test #22: st_will ..........................***Failed    0.00 sec
      Start 23: st_offline
23/46 Test #23: st_offline .......................***Failed    0.00 sec
      Start 24: st_manual_publish
24/46 Test #24: st_manual_publish ................***Failed    0.00 sec
      Start 25: st_async_pubsub_2
25/46 Test #25: st_async_pubsub_2 ................***Failed    0.00 sec
      Start 26: st_issue_749
26/46 Test #26: st_issue_749 .....................***Failed    0.00 sec
      Start 27: st_broker_offline_message
27/46 Test #27: st_broker_offline_message ........***Failed    0.01 sec
      Start 28: st_remaining_length
28/46 Test #28: st_remaining_length ..............***Failed    0.01 sec
      Start 29: st_utf8string_validate
29/46 Test #29: st_utf8string_validate ...........***Failed    0.01 sec
      Start 30: st_resend_serialize
30/46 Test #30: st_resend_serialize ..............***Failed    0.01 sec
      Start 31: st_length_check
31/46 Test #31: st_length_check ..................***Failed    0.01 sec
      Start 32: st_resend_serialize_ptr_size
32/46 Test #32: st_resend_serialize_ptr_size .....***Failed    0.01 sec
      Start 33: ut_buffer
33/46 Test #33: ut_buffer ........................***Failed    0.01 sec
      Start 34: ut_code
34/46 Test #34: ut_code ..........................***Failed    0.01 sec
      Start 35: ut_utf8string_validate
35/46 Test #35: ut_utf8string_validate ...........***Failed    0.01 sec
      Start 36: ut_packet_id
36/46 Test #36: ut_packet_id .....................***Failed    0.01 sec
      Start 37: ut_topic_alias
37/46 Test #37: ut_topic_alias ...................***Failed    0.01 sec
      Start 38: ut_message
38/46 Test #38: ut_message .......................***Failed    0.01 sec
      Start 39: ut_property
39/46 Test #39: ut_property ......................***Failed    0.01 sec
      Start 40: ut_subscription_map
40/46 Test #40: ut_subscription_map ..............***Failed    0.01 sec
      Start 41: ut_retained_topic_map
41/46 Test #41: ut_retained_topic_map ............***Failed    0.01 sec
      Start 42: ut_shared_subscriptions
42/46 Test #42: ut_shared_subscriptions ..........***Failed    0.01 sec
      Start 43: ut_subscription_map_broker
43/46 Test #43: ut_subscription_map_broker .......***Failed    0.01 sec
      Start 44: ut_retained_topic_map_broker
44/46 Test #44: ut_retained_topic_map_broker .....***Failed    0.01 sec
      Start 45: ut_value_allocator
45/46 Test #45: ut_value_allocator ...............***Failed    0.01 sec
      Start 46: ut_broker_security
46/46 Test #46: ut_broker_security ...............***Failed    0.01 sec

0% tests passed, 46 tests failed out of 46

Total Test time (real) =   0.23 sec

The following tests FAILED:
	  1 - st_connect (Failed)
	  2 - st_underlying_timeout (Failed)
	  3 - st_as_buffer_sub (Failed)
	  4 - st_topic_alias (Failed)
	  5 - st_as_buffer_pubsub (Failed)
	  6 - st_shared_sub (Failed)
	  7 - st_maximum_packet_size (Failed)
	  8 - st_receive_maximum (Failed)
	  9 - st_pubsub_1 (Failed)
	 10 - st_sub (Failed)
	 11 - st_pubsub_2 (Failed)
	 12 - st_pubsub_no_strand (Failed)
	 13 - st_as_buffer_async_pubsub_1 (Failed)
	 14 - st_multi_sub (Failed)
	 15 - st_as_buffer_async_pubsub_2 (Failed)
	 16 - st_async_pubsub_1 (Failed)
	 17 - st_reqres (Failed)
	 18 - st_resend (Failed)
	 19 - st_retain_1 (Failed)
	 20 - st_resend_new_client (Failed)
	 21 - st_retain_2 (Failed)
	 22 - st_will (Failed)
	 23 - st_offline (Failed)
	 24 - st_manual_publish (Failed)
	 25 - st_async_pubsub_2 (Failed)
	 26 - st_issue_749 (Failed)
	 27 - st_broker_offline_message (Failed)
	 28 - st_remaining_length (Failed)
	 29 - st_utf8string_validate (Failed)
	 30 - st_resend_serialize (Failed)
	 31 - st_length_check (Failed)
	 32 - st_resend_serialize_ptr_size (Failed)
	 33 - ut_buffer (Failed)
	 34 - ut_code (Failed)
	 35 - ut_utf8string_validate (Failed)
	 36 - ut_packet_id (Failed)
	 37 - ut_topic_alias (Failed)
	 38 - ut_message (Failed)
	 39 - ut_property (Failed)
	 40 - ut_subscription_map (Failed)
	 41 - ut_retained_topic_map (Failed)
	 42 - ut_shared_subscriptions (Failed)
	 43 - ut_subscription_map_broker (Failed)
	 44 - ut_retained_topic_map_broker (Failed)
	 45 - ut_value_allocator (Failed)
	 46 - ut_broker_security (Failed)
Errors while running CTest
make: *** [Makefile:130:test] 错误 8

删掉build文件夹,重新编译能解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值