WARNING ** io features related to openni2 pcap png will be disabled
0. 写在最前面
本文持续更新地址:https://haoqchen.site/2019/07/22/pcl-openni2/
如果觉得写得还不错,可以找我其他文章来看看哦~~~可以的话帮我github点个赞呗。
你的Star是作者坚持下去的最大动力哦~~~
1. 问题描述
使用PCL编译某个ROS工程时出现这个waring:
** WARNING ** io features related to openni2 will be disabled
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
** WARNING ** visualization features related to openni2 will be disabled
这里其实是3个东西缺了
2. 解决办法
2.1 OpenNI2问题
找到对应log文件后发现是OpenNI没有
Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS)
所以就安装OpenNI就好:
sudo apt-get install openni2-utils
2.2 png问题
png的问题是由于pcl的cmake文件缺了相关的查找。我装ROS的时候已经默认装了libpng,如果你增加了下面这两句还是有问题,可以考虑装一个这个,但千万要小心,我更新了libpng之后不小心把ROS的东西删了,又得重装一下。
在/usr/lib/x86_64-linux-gnu/cmake/pcl
目录下找到PCLConfig.cmake
文件,用sudo gedit PCLConfig.cmake
,在466行后面(find_openni2()
下面)增加这句话:
elseif("${_lib}" STREQUAL "png")
find_package(PNG)
2.3 pcap问题
理由同上,不过libpcap这个是网络抓取包,一般系统不会帮忙装,需要自己装:
sudo apt-get install libpcap-dev
装完之后在PCLConfig.cmake
中添加下面这两句:
elseif("${_lib}" STREQUAL "pcap")
find_package(PCAP)
这个时候还不行,貌似是因为libpcap在安装的时候不会自己配置cmake。。。。。需要你到cmake的Modules目录下,我的是/usr/share/cmake-3.5/Modules
,每个人不一样,里面会有很多的Findxxx.cmake
的文件。你需要新建一个FindPCAP.cmake
,然后往里面填入以下的内容(这部分来源于这位老哥的github)
# - Try to find libpcap include dirs and libraries
#
# Usage of this module as follows:
#
# find_package(PCAP)
#
# Variables used by this module, they can change the default behaviour and need
# to be set before calling find_package:
#
# PCAP_ROOT_DIR Set this variable to the root installation of
# libpcap if the module has problems finding the
# proper installation path.
#
# Variables defined by this module:
#
# PCAP_FOUND System has libpcap, include and library dirs found
# PCAP_INCLUDE_DIR The libpcap include directories.
# PCAP_LIBRARY The libpcap library (possibly includes a thread
# library e.g. required by pf_ring's libpcap)
# HAVE_PF_RING If a found version of libpcap supports PF_RING
# HAVE_PCAP_IMMEDIATE_MODE If the version of libpcap found supports immediate mode
find_path(PCAP_ROOT_DIR
NAMES include/pcap.h
)
find_path(PCAP_INCLUDE_DIR
NAMES pcap.h
HINTS ${PCAP_ROOT_DIR}/include
)
set (HINT_DIR ${PCAP_ROOT_DIR}/lib)
# On x64 windows, we should look also for the .lib at /lib/x64/
# as this is the default path for the WinPcap developer's pack
if (${CMAKE_SIZEOF_VOID_P} EQUAL 8 AND WIN32)
set (HINT_DIR ${PCAP_ROOT_DIR}/lib/x64/ ${HINT_DIR})
endif ()
find_library(PCAP_LIBRARY
NAMES pcap wpcap
HINTS ${HINT_DIR}
)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(PCAP DEFAULT_MSG
PCAP_LIBRARY
PCAP_INCLUDE_DIR
)
include(CheckCXXSourceCompiles)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_cxx_source_compiles("int main() { return 0; }" PCAP_LINKS_SOLO)
set(CMAKE_REQUIRED_LIBRARIES)
# check if linking against libpcap also needs to link against a thread library
if (NOT PCAP_LINKS_SOLO)
find_package(Threads)
if (THREADS_FOUND)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
check_cxx_source_compiles("int main() { return 0; }" PCAP_NEEDS_THREADS)
set(CMAKE_REQUIRED_LIBRARIES)
endif (THREADS_FOUND)
if (THREADS_FOUND AND PCAP_NEEDS_THREADS)
set(_tmp ${PCAP_LIBRARY} ${CMAKE_THREAD_LIBS_INIT})
list(REMOVE_DUPLICATES _tmp)
set(PCAP_LIBRARY ${_tmp}
CACHE STRING "Libraries needed to link against libpcap" FORCE)
else (THREADS_FOUND AND PCAP_NEEDS_THREADS)
message(FATAL_ERROR "Couldn't determine how to link against libpcap")
endif (THREADS_FOUND AND PCAP_NEEDS_THREADS)
endif (NOT PCAP_LINKS_SOLO)
include(CheckFunctionExists)
set(CMAKE_REQUIRED_LIBRARIES ${PCAP_LIBRARY})
check_function_exists(pcap_get_pfring_id HAVE_PF_RING)
check_function_exists(pcap_set_immediate_mode HAVE_PCAP_IMMEDIATE_MODE)
check_function_exists(pcap_set_tstamp_precision HAVE_PCAP_TIMESTAMP_PRECISION)
set(CMAKE_REQUIRED_LIBRARIES)
mark_as_advanced(
PCAP_ROOT_DIR
PCAP_INCLUDE_DIR
PCAP_LIBRARY
)
删除下缓存重新编译就完美解决拉
参考
- https://github.com/PointCloudLibrary/pcl/issues/2651
喜欢我的文章的话Star一下呗Star
版权声明:本文为白夜行的狼原创文章,未经允许不得以任何形式转载
还没有评论,来说两句吧...