记录被坑惨的一天
安装各种依赖包
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| 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.9 libflann-dev sudo apt-get install libeigen3-dev //这个需要自己下载正确版本安装 sudo apt-get install libboost-all-dev sudo apt-get install libvtk7.1-qt sudo apt-get install libvtk7.1 sudo apt-get install libvtk7-qt-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 openjdk-8-jdk openjdk-8-jre
sudo apt-get install libopencv-dev
|
下载PCL
git clone https://github.com/PointCloudLibrary/pcl.git
- 速度受限制的话可以clone到码云再下载
- 下载后的文件名称 一定要是pcl,不能带有其他字符
编译
1 2 3 4 5 6
| cd pcl mkdir build cd build cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPU=ON-DBUILD_apps=ON -DBUILD_examples=ON \ -DCMAKE_INSTALL_PREFIX=/usr .. make //在build目录里,make -j4或-j8可加速 sudo make install
|
第五步make编译的时候可能会报错:
1 2 3 4 5 6 7 8 9
| /usr/lib/x86_64-linux-gnu/libSM.so: undefined reference to `uuid_generate@UUID_1.0' /usr/lib/x86_64-linux-gnu/libSM.so: undefined reference to `uuid_unparse_lower@UUID_1.0' collect2: error: ld returned 1 exit status outofcore/tools/CMakeFiles/pcl_outofcore_viewer.dir/build.make:367: recipe for target 'bin/pcl_outofcore_viewer' failed make[2]: *** [bin/pcl_outofcore_viewer] Error 1 CMakeFiles/Makefile2:1853: recipe for target 'outofcore/tools/CMakeFiles/pcl_outofcore_viewer.dir/all' failed make[1]: *** [outofcore/tools/CMakeFiles/pcl_outofcore_viewer.dir/all] Error 2 Makefile:151: recipe for target 'all' failed make: *** [all] Error 2
|
解决办法:
- 清空build里的文件
rm -r build
- 输入获取当前环境变量的命令
1 2 3 4
| echo $PATH /opt/ros/melodic/bin:/usr/local/anaconda3/bin:/usr/local/anaconda3/condabin: /home/qm/.local/bin:/usr/local/anconda3/bin:/usr/local/sbin:/usr/local/bin: /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
|
- 把路径中带有conda的内容删掉并复制剩余内容
- 终端执行
PATH=NEW_PATH
,其中NEW_PATH就是刚才复制的新路径(临时更改环境变量)
1 2
| PATH=/usr/local/sbin:/usr/local/bin: /usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
|
- 再次执行
echo $PATH
发现带有conda的目录被移除
1 2 3
| cmake -DCMAKE_BUILD_TYPE=None -DCMAKE_INSTALL_PREFIX=/usr \ -DBUILD_GPU=ON-DBUILD_apps=ON -DBUILD_examples=ON \ -DCMAKE_INSTALL_PREFIX=/usr .. make -j4/8 sudo make install
|
1
| sudo apt install pcl-tools
|
安装完成并验证
1 2
| cd到pcl/test目录中 pcl_viewer car6.pcd
|