参考Ubuntu16.04安装PCL及及及遇到的坑坑坑_hailanglin的博客-CSDN博客
1.
sudo apt-get update
2. 安装VTK8.2版本, 在官网下载后Download | VTK
cd VTK_file
mkdir build & cd build
cmake ..
sudo make
遇到问题
[ 38%] Building C object ThirdParty/glew/vtkglew/CMakeFiles/vtkglew.dir/src/glew.c.o
make[2]: *** No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so', needed by 'lib/libvtkglew-8.2.so.1'。 停止。
CMakeFiles/Makefile2:2442: recipe for target 'ThirdParty/glew/vtkglew/CMakeFiles/vtkglew.dir/all' failed
make[1]: *** [ThirdParty/glew/vtkglew/CMakeFiles/vtkglew.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
参考No rule to make target '/usr/lib/x86_64-linux-gnu/libGL.so - acewzj - 博客园, 重新创建了libGL.so链接,问题解决。
3. cmake ..时报错
Checking for module 'libopenni2'
-- No package 'libopenni2' found
没有找到这个安装包,所以重新安装 问题解决
sudo apt-get install libopenni2-dev
4.
The imported target "vtkRenderingPythonTkWidgets" references the file
"/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.
The imported target "vtk" references the file
"/usr/bin/vtk"
but this file does not exist
创建两个软链接
sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so
sudo ln -s /usr/bin/vtk6 /usr/bin/vtk
5.
CMake Error at /usr/lib/x86_64-linux-gnu/cmake/Qt5Gui/Qt5GuiConfig.cmake:27 (message):
The imported target "Qt5::Gui" references the file
"/usr/lib/x86_64-linux-gnu/libEGL.so"
解决:
ll | grep libEGL
看到
libEGL.so -> mesa-egl/libEGL.so
删除原来的链接,重新创建软链接
sudo rm libEGL.so
sudo ln -s libEGL.so.1.1.0 libEGL.so
6. Terminal没有报错,但是有configuration incomplete,error occured, 在log.txt中发现
Determining if the pthread_create exist failed with the following output:
Change Dir: /home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_56503/fast"
/usr/bin/make -f CMakeFiles/cmTC_56503.dir/build.make CMakeFiles/cmTC_56503.dir/build
make[1]: Entering directory '/home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_56503.dir/CheckSymbolExists.c.o
/usr/bin/cc -o CMakeFiles/cmTC_56503.dir/CheckSymbolExists.c.o -c /home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_56503
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_56503.dir/link.txt --verbose=1
/usr/bin/cc CMakeFiles/cmTC_56503.dir/CheckSymbolExists.c.o -o cmTC_56503 -rdynamic
CMakeFiles/cmTC_56503.dir/CheckSymbolExists.c.o:在函数‘main’中:
CheckSymbolExists.c:(.text+0x16):对‘pthread_create’未定义的引用
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_56503.dir/build.make:97: recipe for target 'cmTC_56503' failed
make[1]: *** [cmTC_56503] Error 1
make[1]: Leaving directory '/home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_56503/fast' failed
make: *** [cmTC_56503/fast] Error 2
File /home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>
int main(int argc, char** argv)
{
(void)argv;
#ifndef pthread_create
return ((int*)(&pthread_create))[argc];
#else
(void)argc;
return 0;
#endif
}
Determining if the function pthread_create exists in the pthreads failed with the following output:
Change Dir: /home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp
Run Build Command:"/usr/bin/make" "cmTC_0d737/fast"
/usr/bin/make -f CMakeFiles/cmTC_0d737.dir/build.make CMakeFiles/cmTC_0d737.dir/build
make[1]: Entering directory '/home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_0d737.dir/CheckFunctionExists.c.o
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create -o CMakeFiles/cmTC_0d737.dir/CheckFunctionExists.c.o -c /usr/share/cmake-3.5/Modules/CheckFunctionExists.c
Linking C executable cmTC_0d737
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_0d737.dir/link.txt --verbose=1
/usr/bin/cc -DCHECK_FUNCTION_EXISTS=pthread_create CMakeFiles/cmTC_0d737.dir/CheckFunctionExists.c.o -o cmTC_0d737 -rdynamic -lpthreads
/usr/bin/ld: 找不到 -lpthreads
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_0d737.dir/build.make:97: recipe for target 'cmTC_0d737' failed
make[1]: *** [cmTC_0d737] Error 1
make[1]: Leaving directory '/home/lihao/桌面/未命名文件夹/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_0d737/fast' failed
make: *** [cmTC_0d737/fast] Error 2
查阅很久都没找到解决方法,最后想到在CMakeList.txt 中, 把这句code加到第一行了,换到最后一行,可以成功cmake
list(REMOVE_ITEM PCL_LIBRARIES "vtkproj4")
成功camke .. 之后,make
最后可以成功显示demo的点云