ubuntu 20.04 +PCL1.8.1安装
安装PCL需要py的版本支持,刚装系统自带的python3不兼容,要重新安装python2,
检查python版本
python --version
如果是python3xxx,大概安装pcl会报错
boost/python/detail/wrap_python.hpp:50:11: fatal error: pyconfig.h:
没有那个文件或目录 50 | # include <pyconfig.h>
sudo apt-get install python-dev
安装python2.x的版本,我装的2.7
如果原来存在PCL库的,卸载可以用
sudo apt-get remove libboost-all-dev
下载Boost库的源代码:前往Boost官方网站(https://www.boost.org/users/download/)下载1.63版本的源代码压缩包(例如boost_1_63_0.tar.gz)。tar -xzf boost_1_63_0.tar.gz
cd boost_1_63_0
sudo ./bootstrap.sh --prefix=/usr/local
sudo ./b2 install
配置Boost库环境变量:为了确保系统能够找到新安装的Boost库,你需要将Boost库的路径添加到环境变量中。编辑你的shell配置文件(例如~/.bashrc
或~/.bash_profile
),并添加以下行:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
export CPLUS_INCLUDE_PATH=/usr/local/include:$CPLUS_INCLUDE_PATH
更新配置环境
source ~/.bashrc
检查安装成功后的boost版本:
cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"
安装PCL报错并记录
[ 34%] Building CXX object filters/CMakeFiles/pcl_filters.dir/src/conditional_removal.cpp.o cc1plus: warning: ‘-Wabi’ won’t warn about anything [-Wabi] cc1plus: note: ‘-Wabi’ warns about differences from the most up-to-date ABI, which is also used by default cc1plus: note: use e.g. ‘-Wabi=11’ to warn about changes from GCC 7 /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_resetStreamHC' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_setStreamDecode' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_decompress_safe' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_decompress_safe_continue' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_compress_HC_continue' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_resetStreamHC' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_setStreamDecode' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_decompress_safe' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_decompress_safe_continue' /usr/bin/ld: ../lib/libpcl_kdtree.so.1.8.1: undefined reference to `LZ4_compress_HC_continue' collect2: error: ld returned 1 exit status collect2: error: ld returned 1 exit status make[2]: *** [tools/CMakeFiles/pcl_marching_cubes_reconstruction.dir/build.make:281:bin/pcl_marching_cubes_reconstruction] 错误 1 make[2]: *** [tools/CMakeFiles/pcl_gp3_surface.dir/build.make:281:bin/pcl_gp3_surface] 错误 1 make[1]: *** [CMakeFiles/Makefile2:3148:tools/CMakeFiles/pcl_marching_cubes_reconstruction.dir/all] 错误 2 make[1]: *** 正在等待未完成的任务.... make[1]: *** [CMakeFiles/Makefile2:3078:tools/CMakeFiles/pcl_gp3_surface.dir/all] 错误 2
检查LZ4库是否安装上
sudo apt-get install liblz4-dev
如果装上还是不行,
在该路径文件末尾加 -llz4。
报错:
pcl/segmentation/plane_coefficient_comparator.h:144:17: 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_)
最后编译通过。