参考链接:https://blog.youkuaiyun.com/lilywri823/article/details/86583269
1.先安装各种依赖
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 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 libopenni-dev
sudo apt-get install libopenni2-dev
2.源码安装vtk库(很重要!!!apt安装的方式会出现.so文件缺失的情况!)
2.1首先安装依赖项X11,OpenGL,CMake-gui
x11
sudo apt-get install libx11-dev libxext-dev libxtst-dev libxrender-dev libxmu-dev libxmuu-dev
OpenGL
sudo apt-get install build-essential libgl1-mesa-dev libglu1-mesa-dev
cmake
sudo apt-get install cmake cmake-gui
2.2下载vtk源码
选择了VTK-7.1.1.tar.gz,下载完成后解压缩到你的文件安装目录。在文件目录下打开cmd窗口,输入cmake-gui打开cmake图形界面:
配置“where is the source code”的路径为vtk-7.1.1所在的目录
在vtk-7.1.1目录新建build文件夹,配置“where to build the binaries”为build文件夹
点击Configure,配置完成后提示configure done
选择“VTK_GROUP_QT”再次点击configure
配置完成后点击generate按钮,会在build文件夹下生成工程文件
2.3 切换文件目录到vtk-7.1.1文件夹下的build文件夹,然后打开cmd窗口,输入:
make
sudo make install
完成vtk库的安装.
3.安装pcl
去pcl官方github下载需要的pcl版本放到主目录下
git clone https://github.com/PointCloudLibrary/pcl.git
在文件目录下打开cmd窗口,输入cmake-gui打开cmake图形界面:
配置“where is the source code”的路径为pcl所在的目录
在pcl目录新建build文件夹,配置“where to build the binaries”为build文件夹
点击Configure,配置完成后提示configure done
勾选需要安装的可选项,再次点击configure
配置完成后点击generate按钮,会在build文件夹下生成工程文件
接着
make
sudo make install
至此安装完毕。
ps:屏蔽anaconda路径
In detail:
- delete build directory and create it again
echo $PATH
and look for anaconda lib directory- Copy the PATH output from previous step and remove reference to anaconda folder
- execute
PATH=[MODIFIED_PATH]
where[MODIFIED_PATH]
is the result from previous step - Execute
echo $PATH
again to see that anaconda directory has been removed - build the project again in the same terminal window
Now the process uses system libraries, not the anaconda ones and compilation succeeds.