Ubuntu20.04 编译 pcl1.8可能出现的问题

安装依赖项:

sudo apt-get update  
sudo apt-get install git build-essential linux-libc-dev  
sudo apt-get install cmake cmake-gui   
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev  
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common    
sudo apt-get install libflann1.8 libflann-dev  
sudo apt-get install libeigen3-dev  
sudo apt-get install libboost-all-dev  
sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev  
sudo apt-get install libqhull* libgtest-dev  
sudo apt-get install freeglut3-dev pkg-config  
sudo apt-get install libxmu-dev libxi-dev   
sudo apt-get install mono-complete  
sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre

 进入源码文件进行编译:

mkdir build && cd build
cmake  -DCMAKE_INSTALL_PREFIX=/usr/local/pcl18 \ -DBUILD_GPU=ON -DBUILD_apps=ON -DBUILD_examples=ON ..
make -j4

问题1 visualization相关

fatal error: boost/uuid/sha1.hpp: 没有那个文件或目录
  103 | #include <boost/uuid/sha1.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~

原因:sha1.hpp在电脑中的路径不一致

将pcl_visualizer.cpp文件中 103行的 <boost/uuid/sha1.hpp> 更改为<boost/uuid/detail/sha1.hpp>   

问题2 segmentation相关

error: invalid initialization of reference of type ‘const std::vector<float>&’ from expression of type ‘const boost::shared_ptr<std::vector<float> >’
  144 |         return (plane_coeff_d_);
      |                ~^~~~~~~~~~~~~~~

 解决方法:

在plane_coefficient_comparator.h文件中第144行。

将return(plane_coeff_d_) 更改为   return( *plane_coeff_d_)

问题3 kdtee相关

make[2]: *** [visualization/tools/CMakeFiles/pcl_oni_viewer.dir/build.make:281:bin/pcl_oni_viewer] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2270:visualization/tools/CMakeFiles/pcl_oni_viewer.dir/all] 错误 2
/usr/bin/ld: ../../lib/libpcl_kdtree.so.1.8.0: undefined reference to `LZ4_resetStreamHC'
/usr/bin/ld: ../../lib/libpcl_kdtree.so.1.8.0: undefined reference to `LZ4_setStreamDecode'
/usr/bin/ld: ../../lib/libpcl_kdtree.so.1.8.0: undefined reference to `LZ4_decompress_safe'
/usr/bin/ld: ../../lib/libpcl_kdtree.so.1.8.0: undefined reference to `LZ4_decompress_safe_continue'
/usr/bin/ld: ../../lib/libpcl_kdtree.so.1.8.0: undefined reference to `LZ4_compress_HC_continue'
collect2: error: ld returned 1 exit status
make[2]: *** [visualization/tools/CMakeFiles/pcl_viewer.dir/build.make:283:bin/pcl_viewer] 错误 1
make[1]: *** [CMakeFiles/Makefile2:2208:visualization/tools/CMakeFiles/pcl_viewer.dir/all] 错误 2

 打开build子路径下的 link.txt,在末尾添加   -llz4

问题4 outofcore相关

找到pcl-pcl-1.8.0/outofcore/include/pcl/outofcore/impl/octree_disk_container.hpp 文件下的76和77行代码,并将他们注释掉。

问题5 segmentation相关2

error: invalid initialization of reference of type ‘const std::vector<float>&’ from expression of type ‘const boost::shared_ptr<std::vector<float> >’
  150 |         return (plane_coeff_d_);

 找到如下路径中的ground_plane_comparator.h

将第150行代码修改如下:

 

 

 

问题6: undefined reference to symbol 'LZ4_decompress_safe'

/usr/bin/ld: CMakeFiles/pcl_feature_matching.dir/src/feature_matching.cpp.o: undefined reference to symbol 'LZ4_decompress_safe'
/usr/bin/ld: /lib/x86_64-linux-gnu/liblz4.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [apps/CMakeFiles/pcl_feature_matching.dir/build.make:292:bin/pcl_feature_matching] 错误 1
make[1]: *** [CMakeFiles/Makefile2:3754:apps/CMakeFiles/pcl_feature_matching.dir/all] 错误 2 

在终端中寻找 liblz4.so的位置

whereis liblz4.so

找到如下路径下pcl_feautre_matching.dir文件夹中的link.txt

 

 将liblz4.so的地址添加到link.txt文件中

终于编译成功了

 安装

sudo make install

安装完成后,在使用到pcl1.8代码的CMakeLists.txt中加入:

set(PCL_DIR "/usr/local/pcl18/share/pcl-1.8")

需要兼容 pcl1.10时, 在CMakeLists.txt中加入:

set(PCL_DIR "/usr/include/pcl-1.10")
find_package(PCL 1.10 REQUIRED)

参考链接:

Ubuntu20.04安装PCL1.8.0编译错误(全网最全~)_小方只会百度的博客-CSDN博客

解决undefined reference to symbol ‘LZ4_decompress_safe‘问题_努力搬砖的星期五的博客-CSDN博客_unsing symbol lz4

  • 17
    点赞
  • 61
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
回答: 在Ubuntu 20.04安装pcl时,可能会遇到一些报错。其中一个可能的原因是安装的python-pcl库与系统版本不兼容。这可能是因为python-pcl库基本已经停止维护,所以在使用pip install python-pcl安装时会出现版本不适配的问题。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [ubuntu20.04在python中使用pcl库报错:module ‘pcl‘ has no attribute ‘PointCloud](https://blog.csdn.net/qq_46304090/article/details/126469689)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [ubuntu20.04+Vtk 7.1.1+pcl 安装过程中出现问题](https://blog.csdn.net/m0_48919875/article/details/125439700)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [Ubuntu20.04安装PCL1.8.0编译错误(全网最全~)](https://blog.csdn.net/fffyyyhhh12/article/details/126889810)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值