最近需要PCL1.8.0调试一个代码,同时需要PCL1.8.0t添加C++11标准编译,本来是一件很简单的事,可是事情总是一波三折!!!!!!!!!!!!!!
下载PCL1.8.0的网址可以在我之前的博客找到,这里就不多说了
(1)为了添加C++11标准编译,首先在PCL的CMakeLIsts中的112行修改
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -Wextra -Wno-unknown-pragmas -fno-strict-aliasing -Wno-format-extra-args -Wno-sign-compare -Wno-invalid-offsetof -Wno-conversion
由于不想和之前的PCL1.7.2冲突,所以设置了一个路径
cmake -DCMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local/PCL1.8.0 ..
sudo make -j10 install
要找到PCL1.8.0,只在find_package(PCL REQUIRED )之前需添加:set(PCL_DIR "/usr/local/PCL1.8.0/share/pcl-1.8")
但是事实没有这么简单,由于之前使用kinectV1安装了一个openni,使得编译的时候和安装的openni版本冲突,错误如下:
error OpenNI OS Abstraction Layer - Unsupported Platform!
找到网上的博客
sudo apt-get autoremove libopenni-dev
sudo apt-get install libopenni-dev
但是卸载libopenni-dev时你会发现它会卸载很多库,一旦卸载了,之前配置的很多环境全没了
最后使用
sudo apt-get remove libopenni-dev
它会卸载下面的库
libopenni-dev libpcl-1.7-all libpcl-1.7-all-dev libpcl-all libpcl-apps-1.7-dev libpcl-io-1.7-dev libpcl-outofcore-1.7-dev libpcl-people-1.7-dev libpcl-recognition-1.7-dev libpcl-visualization-1.7-dev ros-indigo-desktop-full ros-indigo-openni-camera ros-indigo-openni-launch ros-indigo-pcl-conversions ros-indigo-pcl-ros ros-indigo-perception ros-indigo-perception-pcl
还是有点多,不过可以接受,为了避免错误,先把卸载的库保存下来,后面再装上
sudo apt-get install libpcl-1.7-all libpcl-1.7-all-dev libpcl-all libpcl-apps-1.7-dev libpcl-io-1.7-dev libpcl-outofcore-1.7-dev libpcl-people-1.7-dev libpcl-recognition-1.7-dev libpcl-visualization-1.7-dev ros-indigo-desktop-full ros-indigo-openni-camera ros-indigo-openni-launch ros-indigo-pcl-conversions ros-indigo-pcl-ros ros-indigo-perception ros-indigo-perception-pcl
这样就可以了,再次编译PCL就通过了
PCL真的是好麻烦,编译时间又长,依赖又多===================================