linux安装 Asio 库

在编译Fast_DDS : colcon build --packages-up-to fastdds的时候,可能会出现与asio库相关的错误,二进制安装或者源代码安装的参考链接见下:
https://blog.csdn.net/u012327735/article/details/124251305
https://blog.csdn.net/SMILY12138/article/details/130348448

此时可能还会有某些错误,如:

leg_ctrl@legctrl-NUC12WSHi7:~/Fast-DDS$ colcon build --packages-up-to fastdds
Starting >>> fastcdr 
Starting >>> foonathan_memory_vendor
Finished <<< fastcdr [0.04s]
[Processing: foonathan_memory_vendor]                             
--- stderr: foonathan_memory_vendor                                
Cloning into 'foo_mem-ext'...
error: RPC failed; curl 92 HTTP/2 stream 0 was not closed cleanly: CANCEL (err 8)
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Cloning into 'foo_mem-ext'...
HEAD is now at 0f07757 Release 0.7-3
---
Finished <<< foonathan_memory_vendor [52.0s]
Starting >>> fastdds
--- stderr: fastdds                              
In file included from /home/leg_ctrl/Fast-DDS/src/fastdds/src/cpp/fastdds/domain/DomainParticipantImpl.cpp:25:
/usr/local/include/asio.hpp:62:10: fatal error: asio/cancel_after.hpp: No such file or directory
   62 | #include "asio/cancel_after.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [src/cpp/CMakeFiles/fastdds.dir/build.make:440: src/cpp/CMakeFiles/fastdds.dir/fastdds/domain/DomainParticipantImpl.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:976: src/cpp/CMakeFiles/fastdds.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< fastdds [7.61s, exited with code 2]

Summary: 2 packages finished [59.7s]
  1 package failed: fastdds
  2 packages had stderr output: fastdds foonathan_memory_vendor

问题是由于 asio/cancel_after.hpp 文件无法找到导致的。
首先,确认 Asio 已正确安装。你可以通过查看 Asio 的安装路径来确认:

ls /usr/local/include/asio

如果你能看到 cancel_after.hpp 文件,说明 Asio 已正确安装。

如果此路径下没有cancel_after.hpp 文件,可以在系统中搜索这个文件,找到后复制到 /usr/local/include/asio 下。

重新编译,上述问题能够解决,但可能会出现新的文件找不到的情况,解决方法同上。

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值