我正在尝试寻找一种在 Ubuntu 16.04.2 [LTS] 上安装 C++ PCL v1.8 的直接方法
更新 - - -
分别解决各种问题后:
这是安装点云库 v1.8 的多种方法的混合
在 Ubuntu Server 16.04.2 [LTS] 的干净实例上进行了测试
旨在成为一种简单的安装方法,因此仅包括必需的包和先决条件 ----- ----- ----- ----- -----
还添加了在 Ubuntu 17.10 上安装 PCL 1.8.1
答案1
安装
安装 oracle-java8-jdk:
sudo add-apt-repository -y ppa:webupd8team/java && sudo apt update && sudo apt -y install oracle-java8-installer
安装通用先决条件:
sudo apt -y install g++ cmake cmake-gui doxygen mpi-default-dev openmpi-bin openmpi-common libusb-1.0-0-dev libqhull* libusb-dev libgtest-dev
sudo apt -y install git-core freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev libphonon-dev libphonon-dev phonon-backend-gstreamer
sudo apt -y install phonon-backend-vlc graphviz mono-complete qt-sdk libflann-dev
为了PCL v1.8,Ubuntu 16.04.2输入以下内容:
sudo apt -y install libflann1.8 libboost1.58-all-dev
cd ~/Downloads
wget http://launchpadlibrarian.net/209530212/libeigen3-dev_3.2.5-4_all.deb
sudo dpkg -i libeigen3-dev_3.2.5-4_all.deb
sudo apt-mark hold libeigen3-dev
wget http://www.vtk.org/files/release/7.1/VTK-7.1.0.tar.gz
tar -xf VTK-7.1.0.tar.gz
cd VTK-7.1.0 && mkdir build && cd build
cmake ..
make
sudo make install
cd ~/Downloads
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.0.tar.gz
tar -xf pcl-1.8.0.tar.gz
cd pcl-pcl-1.8.0 && mkdir build && cd build
cmake ..
make
sudo make install
cd ~/Downloads
rm libeigen3-dev_3.2.5-4_all.deb VTK-7.1.0.tar.gz pcl-1.8.0.tar.gz
sudo rm -r VTK-7.1.0 pcl-pcl-1.8.0
为了PCL v1.8.1,Ubuntu 17.10输入以下内容:
sudo apt -y install libflann1.9 libboost1.63-all-dev libeigen3-dev
cd ~/Downloads
wget http://www.vtk.org/files/release/8.0/VTK-8.0.1.tar.gz
tar -xf VTK-8.0.1.tar.gz
cd VTK-8.0.1 && mkdir build && cd build
cmake ..
make
sudo make install
cd ~/Downloads
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz
tar -xf pcl-1.8.1.tar.gz
cd pcl-pcl-1.8.1 && mkdir build && cd build
cmake ..
make
sudo make install
cd ~/Downloads
rm VTK-8.0.1.tar.gz pcl-1.8.1.tar.gz
sudo rm -r VTK-8.0.1 pcl-pcl-1.8.1
验证
cd ~
mkdir pcl-test && cd pcl-test
创建 CMakeLists.txt 文件:
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(pcl-test)
find_package(PCL 1.2 REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})
add_executable(pcl-test main.cpp)
target_link_libraries(pcl-test ${PCL_LIBRARIES})
SET(COMPILE_FLAGS "-std=c++11")
add_definitions(${COMPILE_FLAGS})
创建一个 main.cpp 文件:
#include <iostream>
int main() {
std::cout << "hello, world!" << std::endl;
return (0);
}
编译:
mkdir build && cd build
cmake ..
make
测试:
./pcl-test
输出 ->hello, world!
此安装方法旨在尽可能兼容,并提供一种轻松启动和运行点云库的方法。此方法不包括 Kinect 配置,因为 Kinect 配置要求在设置 pcl 之前先安装其他软件包。