admin管理员组

文章数量:1558103

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/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/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/a/5cbf9717bd9eee397113c830?lang=zh-cn

本文标签: 找不到VTKPCL