安装ros过程中找不到Boost

在树莓派上安装ROS Kinetic时,遇到Boost库找不到的错误。尝试重装和手动下载安装boost_1.58.0未果,也未成功通过修改CMakeLists.txt或FindBoost.cmake解决。最终,通过在命令行设置环境变量的方式成功解决,例如设置BOOST_ROOT为boost文件夹路径。

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

在树莓派上基于raspbian(Buster)安装ros
参考网页:http://wiki.ros.org/ROSberryPi/Installing ROS Kinetic on the Raspberry Pi

在执行:sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
首先遇到错误:'boost/tr1/unordered_set.hpp' file not found
这在参考网页中有提到,On Raspbian Buster the compilation may fail with "'boost/tr1/unordered_set.hpp' file not found". This is because rospack version used in Kinetic is dependent on boost 1.58. To fix this error try installing boost 1.58 manually.之后便手动下载安装boost_1.58.0

接着遇到第二个错误:
CMake Error at usr/share/cmake/Modules/FindBoost.cmake:1138 (message): Unable to find the requested Boost libraries. Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost’s headers. Call Stack (most recent call first): benchmark/throughput/asio_from_chenshuo/CMakeLists.txt:1 (find_package)
楼主1.先尝试了重装ros和boost,相同错误;2.然后,准备修改每个项目的CMakeLists.txt,然而项目目标较多,完全手改难以实现,而使用sed进行批量修改的话,也比较麻烦,主要担心会引发更多未知的问题;3.之后,又准备尝试修改cmake的位于usr/share/cmake-3.13/Modules的FindBoost.cmake,其中接触到了set(ENV(BOOST_ROOT) path/to/boost)和cmake_policy(SET CMP0074 NEW)等,无奈,由于楼主接触linux和cmake不久,能力有限,未能成功解决问题,便又百度了一番,终于找到了正解,4.很简单使用的方法:在./src/catkin/bin/catkin_make_isolated命令中设置参数
-DBOOST_ROOT=path/to/boost
例如我的boost文件夹在/home/pi/Downloads/boost_1_58_0下,所以执行命令

sudo ./src/catkin/bin/catkin_make_isolated --install --DBOOST_ROOT=/home/pi/Downloads/boost_1_58_0 
-DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic

问题解决,方法4的参考网页:
https://blog.csdn.net/alex_bean/article/details/84135925

开发板推荐:天空星STM32F407VET6开发板

超高性价比 STM32主控 | 超高主频 | 一板兼容百芯 | 比赛神器 | 沉金彩色丝印

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值