pcl的安装错误和高翔第5讲程序编译错误recipe for target 'all' failed

今天编译程序的时候 遇到了这个错误:
Makefile:149: recipe for target ‘all’ failed

之前其实安装pcl时也遇到过,但是以为是资源或者一些小原因,就只是照着网上 cmake的时候,加了些参数,然后编译成功,当时也没记录,也没深思,以为加的参数 就像配置镜像源一样,加速而已 而且一次就成功了,就没有管

但是现在怎么编译都是错的

去网上查了查资料 ,说是opencv调用的是系统默认的gcc那些,而装了anaconda之后,anaconda自带了一些比系统默认gcc版本还要低的,而opencv调用时,会根据~/.bashrc配置文件里的anaconda环境变量找到其中的gcc,导致编译失败 虽然我自己安装了gcc这些

的确,测试了下,不链接到opencv库,就程序就不会有问题,只要链接到opencv库文件时,会出现如下错误,然后根据我前面第两篇博客,添加上软链接后,这个问题就暂时没有了,程序就OK能跑了
在这里插入图片描述

但是由于之前手欠,选择重装了pcl
个人感觉直接执行第二歩的解决办法就行,因为究其原因就是opencv用的编译器是anaconda自带的超低版本的gcc
第一个错:make的时候bin/pcl_vtk2pcd加载失败
解决办法: 安装vtk
在这里插入图片描述然后遇到了第二个错:bin/pcl_tiff2pcd加载失败
解决办法:安装的时候 把PATH中的anaconda路径删除,不是永久删除,具体操作截图在下方
在这里插入图片描述解决办法操作图例:
在这里插入图片描述自己操作 示例
在这里插入图片描述
然后再make -j4 编译成功
在这里插入图片描述
sudo make install

第5讲pcl程序编译错误

-- Found OpenNI2: /usr/lib/libOpenNI2.so  
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- The imported target "vtkRenderingPythonTkWidgets" references the file
   "/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so"
but this file does not exist.  Possible reasons include:
* The file was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and contained
   " /usr/lib/cmake/vtk-6.2/VTKTargets.cmake"
    but not all the files it references.

解决办法:
sudo apt-get install libproj-dev

然后在src中的CMakeLists.txt中添加这句
list (REMOVE_ITEM PCL_LIBRARIES “vtkproj4”)

如果这样还有问题,建议讲build里生成的文件删除,重新解析编译

发布了93 篇原创文章 · 获赞 29 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/ljl1015ljl/article/details/100039052