在按照pcl官网上的Ubuntu16 安装步骤(https://larrylisky.com/2016/11/03/point-cloud-library-on-ubuntu-16-04-lts/),编译安装pcl的源码时候,报错出现如下问题:
../../lib/libpcl_visualization.so.1.9.0:对‘boost::filesystem::path_traits::dispatch(boost::filesystem::directory_entry const&, std::string&)’未定义的引用
collect2: error: ld returned 1 exit status
visualization/tools/CMakeFiles/pcl_hdl_viewer_simple.dir/build.make:140: recipe for target 'bin/pcl_hdl_viewer_simple' failed
make[2]: *** [bin/pcl_hdl_viewer_simple] Error 1
CMakeFiles/Makefile2:1170: recipe for target 'visualization/tools/CMakeFiles/pcl_hdl_viewer_simple.dir/all' failed
make[1]: *** [visualization/tools/CMakeFiles/pcl_hdl_viewer_simple.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2
根据提示推断出来,这个问题是boost的问题,需要将boost的版本更新一下,但是在Ubuntu中是找不到比boost1.58更新的源,所以需要自己下载源码编译并安装,更新过程如下:
1、删除boost1.58(可不删除,因为会删除ROS的一些,谨慎)
libboost1.58-all-dev
注意:在删除boost的时候会提示 要卸载ROS的一些东西,大家根据自己情况而定,因为我会使用ROS所以这一步就没操作
2、下载boost1.60源码
可以从官网上下载,但是速度特别慢
https://sourceforge.net/projects/boost/files/boost-binaries/1.60.0/
推荐在下面的链接进行下载,根据你的系统进行下载:
https://www.boost.org/users/history/version_1_60_0.html
3、解压源码并进入目录
4、查看需要单独编译模块
./bootstrap.sh --show-libraries
5、选择编译模块
./bootstrap.sh --with-libraries= atomic,chrono,container,context,coroutine,coroutine2,date_time,exception,filesystem,graph,graph_parallel,iostreams,locale,with-log,math,metaparse,mpi,program_options,python,random,regex,serialization,signals,system,test,thread,timer,type_erasure,wave
6、编译
sudo ./b2 install
7、复制头文件
sudo cp -a stage/lib /usr
sudo cp -a boost /usr/include
然后重新按照正常安装pcl即可