【问题标题】:How to compile Point Cloud Library (PCL) with examples (Ubuntu)?如何使用示例(Ubuntu)编译点云库(PCL)?
【发布时间】:2019-09-23 16:12:30
【问题描述】:

我使用的是 Ubuntu 18.04,但是对于任何最近的 Linux 发行版来说,这个问题应该几乎相同。

根据这篇文章:

How to install Point Cloud Library v1.8 on Ubuntu 16

我正在尝试从源代码构建Point Cloud Library,如下所示:

安装各种包:

sudo apt-get -y install g++ cmake cmake-gui doxygen mpi-default-dev openmpi-bin openmpi-common
sudo apt-get -y install libusb-1.0-0-dev libqhull* libusb-dev libgtest-dev
sudo apt-get -y install git-core freeglut3-dev pkg-config build-essential libxmu-dev libxi-dev
sudo apt-get -y install libphonon-dev libphonon-dev phonon-backend-gstreamer
sudo apt-get -y install phonon-backend-vlc graphviz mono-complete
sudo apt-get -y install qt5-default
sudo apt-get -y install libflann-dev

sudo apt-get -y install libflann1.9
sudo apt-get -y install libboost-dev
sudo apt-get -y install libeigen3-dev

编译安装VTK 8.1.1:

cd ~/Downloads
wget http://www.vtk.org/files/release/8.1/VTK-8.1.1.tar.gz
tar -zxvf VTK-8.1.1.tar.gz
cd VTK-8.1.1
mkdir build
cd build
cmake ..
make
sudo make install

编译安装 PCL 1.8.1

cd ~/Downloads
wget https://github.com/PointCloudLibrary/pcl/archive/pcl-1.8.1.tar.gz
tar -zxvf pcl-1.8.1.tar.gz
cd pcl-pcl-1.8.1
mkdir build
cd build
cmake ..
make
sudo make install

运行 ldconfig

sudo ldconfig

这很好用,但是默认情况下 PCL 示例未设置为编译,我真的希望能够运行这些示例。参考这篇文章:

Cannot compile pcl examples with cmake

我按照上面的方法进行,只是在解压PCL后,我打开了文件

~/Downloads/pcl-pcl-1.8.1/CMakeLists.txt

我为example 做了一个 Ctrl-F 并找到以下几行:

### ---[ Set up for examples
#include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake")

接下来我删除了这两行第二行开头的注释字符#,所以现在我有了:

### ---[ Set up for examples
include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake")

继续上述步骤,当我执行cmake .. 现在我得到:

~/Downloads/pcl-pcl-1.8.1/build$ cmake ..
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Using CPU native flags for SSE optimization:  -march=native
-- Performing Test HAVE_MM_MALLOC
-- Performing Test HAVE_MM_MALLOC - Success
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Success
-- Performing Test HAVE_SSE4_2_EXTENSIONS
-- Performing Test HAVE_SSE4_2_EXTENSIONS - Success
-- Performing Test HAVE_SSE4_1_EXTENSIONS
-- Performing Test HAVE_SSE4_1_EXTENSIONS - Success
-- Performing Test HAVE_SSSE3_EXTENSIONS
-- Performing Test HAVE_SSSE3_EXTENSIONS - Success
-- Performing Test HAVE_SSE3_EXTENSIONS
-- Performing Test HAVE_SSE3_EXTENSIONS - Success
-- Performing Test HAVE_SSE2_EXTENSIONS
-- Performing Test HAVE_SSE2_EXTENSIONS - Success
-- Performing Test HAVE_SSE_EXTENSIONS
-- Performing Test HAVE_SSE_EXTENSIONS - Success
-- -- GCC > 4.3 found, enabling -Wabi
-- Found OpenMP_C: -fopenmp (found version "4.5") 
-- Found OpenMP_CXX: -fopenmp (found version "4.5") 
-- Found OpenMP: TRUE (found version "4.5")  
-- Found OpenMP
-- Checking for module 'eigen3'
--   Found eigen3, version 3.3.4
-- Found Eigen: /usr/include/eigen3  
-- Eigen found (include: /usr/include/eigen3, version: 3.3.4)
-- Checking for module 'flann>=1.7.0'
--   Found flann, version 1.9.1
-- Found FLANN: /usr/lib/x86_64-linux-gnu/libflann_cpp.so (Required is at least version "1.7.0") 
-- FLANN found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libflann_cpp.so;debug;/usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Found LIBUSB_1: /usr/lib/x86_64-linux-gnu/libusb-1.0.so  
-- Checking for module 'libusb-1.0'
--   Found libusb-1.0, version 1.0.21
-- Found USB_10: /usr/lib/x86_64-linux-gnu/libusb-1.0.so  
-- Could NOT find OpenNI (missing: OPENNI_LIBRARY OPENNI_INCLUDE_DIR) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  OpenNI grabber support: not building because OpenNI not found
Call Stack (most recent call first):
  CMakeLists.txt:296 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find OpenNI2 (missing: OPENNI2_LIBRARY OPENNI2_INCLUDE_DIRS) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  OpenNI2 grabber support: not building because OpenNI2 not found
Call Stack (most recent call first):
  CMakeLists.txt:297 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find FZAPI (missing: FZAPI_LIBS FZAPI_INCLUDE_DIRS) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  Fotonic camera support: not building because FZAPI not found
Call Stack (most recent call first):
  CMakeLists.txt:298 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find ensenso (missing: ENSENSO_LIBRARY ENSENSO_INCLUDE_DIR) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  IDS-Imaging Ensenso camera support: not building because Ensenso not found
Call Stack (most recent call first):
  CMakeLists.txt:299 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find davidSDK (missing: DAVIDSDK_LIBRARY DAVIDSDK_INCLUDE_DIR) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  David Vision Systems SDK support: not building because davidSDK not found
Call Stack (most recent call first):
  CMakeLists.txt:300 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find DSSDK (missing: DSSDK_LIBRARIES DSSDK_INCLUDE_DIRS) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  DepthSense SDK support: not building because DSSDK not found
Call Stack (most recent call first):
  CMakeLists.txt:301 (PCL_ADD_GRABBER_DEPENDENCY)


-- Could NOT find RSSDK (missing: RSSDK_LIBRARIES RSSDK_INCLUDE_DIRS) 
CMake Warning at cmake/pcl_targets.cmake:864 (message):
  RealSense SDK support: not building because RSSDK not found
Call Stack (most recent call first):
  CMakeLists.txt:302 (PCL_ADD_GRABBER_DEPENDENCY)


-- Checking for module 'metslib'
--   No package 'metslib' found
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.34") 
-- Found Qhull: /usr/lib/x86_64-linux-gnu/libqhull.so  
-- QHULL found (include: /usr/include, lib: optimized;/usr/lib/x86_64-linux-gnu/libqhull.so;debug;/usr/lib/x86_64-linux-gnu/libqhull.so)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Found CUDA Toolkit v9.2
-- CUDA NVCC target flags: -gencode;arch=compute_20,code=sm_20;-gencode;arch=compute_20,code=sm_21;-gencode;arch=compute_30,code=sm_30;-gencode;arch=compute_35,code=sm_35;-gencode;arch=compute_50,code=sm_50;-gencode;arch=compute_52,code=sm_52;-gencode;arch=compute_53,code=sm_53;-gencode;arch=compute_60,code=sm_60;-gencode;arch=compute_61,code=sm_61
-- VTK_MAJOR_VERSION 8, rendering backend: OpenGL2
-- VTK found (include: /usr/local/include/vtk-8.1, lib: vtksys;vtkCommonCore;vtkCommonMath;vtkCommonMisc;vtkCommonSystem;vtkCommonTransforms;vtkCommonDataModel;vtkCommonColor;vtkCommonExecutionModel;vtkCommonComputationalGeometry;vtkFiltersCore;vtkFiltersGeneral;vtkImagingCore;vtkImagingFourier;vtkalglib;vtkFiltersStatistics;vtkFiltersExtraction;vtkInfovisCore;vtkFiltersGeometry;vtkFiltersSources;vtkRenderingCore;vtkzlib;vtkfreetype;vtkRenderingFreeType;vtkRenderingContext2D;vtkChartsCore;vtkDICOMParser;vtklz4;vtkIOCore;vtkIOLegacy;vtkexpat;vtkIOXMLParser;vtkDomainsChemistry;vtkglew;vtkRenderingOpenGL2;vtkDomainsChemistryOpenGL2;vtkIOXML;vtkParallelCore;vtkFiltersAMR;vtkFiltersFlowPaths;vtkFiltersGeneric;vtkImagingSources;vtkFiltersHybrid;vtkFiltersHyperTree;vtkImagingGeneral;vtkFiltersImaging;vtkFiltersModeling;vtkFiltersParallel;vtkFiltersParallelImaging;vtkFiltersPoints;vtkFiltersProgrammable;vtkFiltersSMP;vtkFiltersSelection;vtkFiltersTexture;vtkFiltersTopology;verdict;vtkFiltersVerdict;vtkmetaio;vtkjpeg;vtkpng;vtktiff;vtkIOImage;vtkImagingHybrid;vtkInfovisLayout;vtkInteractionStyle;vtkImagingColor;vtkRenderingAnnotation;vtkRenderingVolume;vtkInteractionWidgets;vtkViewsCore;vtkproj4;vtkGeovisCore;vtkhdf5_hl;vtkhdf5;vtkIOAMR;vtkIOEnSight;vtkNetCDF;vtkexoIIc;vtkIOExodus;vtkgl2ps;vtkRenderingGL2PSOpenGL2;vtklibharu;vtkIOExport;vtkIOExportOpenGL2;vtkIOGeometry;vtkIOImport;vtklibxml2;vtkIOInfovis;vtkIOLSDyna;vtkIOMINC;vtkoggtheora;vtkIOMovie;vtknetcdfcpp;vtkIONetCDF;vtkIOPLY;vtkjsoncpp;vtkIOParallel;vtkIOParallelXML;vtksqlite;vtkIOSQL;vtkIOTecplotTable;vtkIOVideo;vtkImagingMath;vtkImagingMorphological;vtkImagingStatistics;vtkImagingStencil;vtkInteractionImage;vtkRenderingContextOpenGL2;vtkRenderingImage;vtkRenderingLOD;vtkRenderingLabel;vtkRenderingVolumeOpenGL2;vtkViewsContext2D;vtkViewsInfovis
-- Could NOT find PCAP (missing: PCAP_LIBRARIES PCAP_INCLUDE_DIRS) 
-- Boost version: 1.65.1
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   iostreams
--   chrono
--   atomic
--   regex
CMake Error at CMakeLists.txt:431 (include):
  include could not find load file:

    /home/cdahms/Downloads/pcl-pcl-1.8.1/cmake/pcl_examples.cmake


-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- DOXYGEN_FOUND 
-- HTML_HELP_COMPILER 
-- Found CPack generators: DEB
-- The following subsystems will be built:
--   common
--   octree
--   io
--   kdtree
--   search
--   sample_consensus
--   filters
--   2d
--   geometry
--   features
--   ml
--   segmentation
--   visualization
--   surface
--   registration
--   keypoints
--   tracking
--   recognition
--   stereo
--   outofcore
--   people
--   tools
-- The following subsystems will not be built:
--   apps: No reason
--   examples: Code examples are disabled by default.
--   simulation: Disabled by default.
--   global_tests: No reason
-- Configuring incomplete, errors occurred!

由于cmake .. 步骤不成功,所以当我执行make 时,我得到:

$ make
make: *** No targets specified and no makefile found.  Stop.

我认为除了取消注释 CMakeLists.txt 中的 include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake") 行之外,还必须有其他设置?有人可以告知使示例成功编译所需的其他步骤吗?

【问题讨论】:

  • 请将答案放在答案块中。请不要添加问题的答案。稍后,您可以接受自己的答案。另见How does accepting an answer work?
  • 我非常不同意这种情况,添加完整、正确的答案对于任何后续读者来说都更加清楚
  • @cdahms 然后在回答帖子中而不是在问题中这样做。我又回滚了你的编辑,请不要放回去。

标签: linux point-cloud-library


【解决方案1】:

在您的cmake 命令中,请添加-DBUILD_examples=ON 作为启用示例的选项。

【讨论】:

  • 点云的CMakeLists.txthere,但它没有显示BUILD_examples 变量。也许您应该提供修复的参考?
  • 感谢您的建议,但是如果我将 cmake 命令更改为“cmake -D BUILD_examples=ON ..”,那么它会在“构建 CXX 对象示例/分段/CMakeFiles/pcl_example_lccp_segmentation. dir/example_lccp_segmentation.cpp.o”,错误为“example_lccp_segmentation.cpp:412:17:错误:‘class vtkUnsignedCharArray’没有名为‘InsertNextTupleValue’的成员;你的意思是‘InsertNextTuple’吗?colors->InsertNextTupleValue (color);” .也许我正在使用不兼容的 VTK 和 PCL 版本?接下来我将尝试使用 VTK 8.1.1 和 PCL 1.9.1。
  • @jww 对修复的引用是什么意思?我从CI build script 中挑选了这个。 至于VTK 和PCL 版本,很抱歉我帮不上什么忙。 PCL CI uses VTk version 6 所以这可能确实是问题所在。你能在 repo 中提交错误报告吗?
  • 我刚刚尝试使用 VTK 8.1.1 和 PCL 1.91 并成功编译。我将确保所有示例都能正常工作,如果是这样,我会接受这个作为答案并更新我的帖子,更多内容即将发布。 . .
猜你喜欢
  • 2014-04-23
  • 2017-03-28
  • 1970-01-01
  • 2016-12-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-06-10
相关资源
最近更新 更多