Ubuntu18.04编译pcl时警告以及找不到vtk

warning

原始cmakelist文件如下:

cmake_minimum_required(VERSION 3.20)
project(pcl_library_test)

set(CMAKE_CXX_STANDARD 14)

find_package(PCL REQUIRED)
include_directories(${PCL_INCLUDE_DIRS})
add_executable(${PROJECT_NAME} main.cpp)
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES})

然而编译时会报如下warning

CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (PCL_COMMON)
  does not match the name of the calling package (PCL).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PCL_COMMON: /jenkins/workspace/myproj/install/lib/libpcl_common.so  
-- looking for PCL_KDTREE
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args` (PCL_KDTREE)
  does not match the name of the calling package (PCL).  This can lead to
  problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found PCL_KDTREE: /jenkins/workspace/myproj/install/lib/libpcl_kdtree.so  
-- looking for PCL_SAMPLE_CONSENSUS
CMake Warning (dev) at /usr/local/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:272 (message):
  The package name passed to `find_package_handle_standard_args`
  (PCL_SAMPLE_CONSENSUS) does not match the name of the calling package
  (PCL).  This can lead to problems in calling code that expects
  `find_package` result variables (e.g., `_FOUND`) to follow a certain
  pattern.
Call Stack (most recent call first):
  /jenkins/workspace/myproj/install/share/pcl-1.9/PCLConfig.cmake:610 (find_package_handle_standard_args)
  CMakeLists.txt:53 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

解决方法:

find_package(PCL REQUIRED)

前边加上

if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
    set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
endif()

参考:https://github.com/PointCloudLibrary/pcl/issues/3680


找不到vtk

解决了上述问题之后会出现找不到vtk的警告:

-- The imported target "vtk" references the file
   "/usr/bin/vtk"
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.

这是因为Ubuntu下,vtk是vtk6,所以创建 vtk6到vtk的软连接即可。

sudo ln -s /usr/bin/vtk6 /usr/bin/vtk

参考:https://www.twblogs.net/a/5cbf9717bd9eee397113c830?lang=zh-cn


找不到 “libvtkRenderingPythonTkWidgets.so”

-- 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.

解决方法:
首先查看python-vtk6是否安装:

ls -l  /usr/lib/python2.7/dist-packages/vtk/libvtkRendering*

如果没有该文件,那么执行:

sudo apt-get install python-vtk6

如果显示结果有,则已经安装,问题就是程序所需文件不在那个目录,那么创建软连接即可:

sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so

注意,其中libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so 这个文件名字可能不是这样子,只需要改成上一步判断是否安装时候时候显示的文件名。

参考:https://www.twblogs.net/a/5cbf9717bd9eee397113c830?lang=zh-cn

  • 7
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值