ROS Indigo下boost 1.6及PCL 1.8的编译

9 篇文章 0 订阅
8 篇文章 5 订阅

ROS indigo版本的boost自带是1.54,PCL默认版本是1.7.1

ROS kinetic版本的boost自带是1.58,PCL默认版本是1.7.2

安装PCL 1.8需要boost≥1.56,因此就有了boost 的升级,我这里用的是boost 1.61。建议boost 1.61和PCL 1.8都安装在自己的目录下,不要和系统的混在一起。

https://blog.csdn.net/yaoxiaokui/article/details/49183909

./bootstrap.sh --prefix=/home/yake/Downloads/boost_1_61_0/yake_boost161_installed

./b2 install

查看链接库的版本

ldconfig -p | less |grep boost

 

/usr/share/cmake-3.2/Modules

这里有个问题需要注意下,在使用PCL 1.8的时候一定要和boost 1.61共用,它需要依赖于boost。

安装好以后,CMakeLists.txt的写法如下:

cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(pcl_1.8)

#/home/yake/ProgramFiles/yake_pcl180_installed/share/pcl-1.8/PCLConfig.cmake
SET(PCL_DIR /home/yake/ProgramFiles/yake_pcl180_installed/share/pcl-1.8)

SET(Boost_NO_SYSTEM_PATHS ON)
SET(Boost_INCLUDE_DIR /home/yake/Downloads/boost_1_61_0/yake_boost161_installed/include)
SET(Boost_LIBRARY_DIR /home/yake/Downloads/boost_1_61_0/yake_boost161_installed/lib)

include_directories(${Boost_INCLUDE_DIR})
link_directories(${Boost_LIBRARY_DIR})

find_package(Boost 1.61.0 EXACT REQUIRED)
message("------------------------------- Boost VERSION = ${Boost_VERSION}")
message("------------------------------- Boost Include path = ${Boost_INCLUDE_DIRS}")
message("------------------------------- Boost LIBRARY_DIRS = ${Boost_LIBRARY_DIRS}")
message("------------------------------- Boost LIBRARIES = ${Boost_LIBRARIES}\n")

find_package(PCL 1.8 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

add_executable(xtion_instric_param src/xtion_instric_param.cpp)
target_link_libraries(xtion_instric_param ${Boost_LIBRARIES} ${PCL_LIBRARIES} )

add_executable(xtion_openni2_topic src/xtion_openni2_topic.cpp)
target_link_libraries(xtion_openni2_topic ${Boost_LIBRARIES} ${PCL_LIBRARIES} )

对于PCL来说,它安装以后会在share目录下生成一个PCLConfig.cmake的文件,和opencv一样,只要利用SET(PCL_DIR /home/yake)这句指向那里就可以了也和opencv调用一样。

boost这里有点不同,因为使用的boost自带的编译工具b2编译的,它安装以后只有lib和include文件夹。

https://stackoverflow.com/questions/3897839/how-to-link-c-program-with-boost-using-cmake

上面的CMakeLists.txt的写法是参考这里的回答,可以起作用。

利用ldd命令查看链接的文件

另外的两篇关于CMakeLists.txt的文章,我觉得有这三篇一般的CMakeList.txt的问题都可以解决了

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

yaked19

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值