linuxpoint-cloud-library

How to compile Point Cloud Library (PCL) with examples (Ubuntu)?


I'm using Ubuntu 18.04, however this questions should be pretty much the same for any reasonably recent Linux distribution.

Based on this post:

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

I'm attempting to build Point Cloud Library from source as follows:

Install various packages:

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

Compile and install 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

Compile and 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

Run an ldconfig

sudo ldconfig

This works great, however the PCL examples are not set to compile by default and I'd really like to be able to run the examples. Upon referring to this post:

Cannot compile pcl examples with cmake

I proceeded as above, only after un-taring PCL, I opened the file

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

I did a Ctrl-F for example and found the following lines:

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

Next I removed the comment out character # from the beginning of the 2nd of these two lines, so now I have:

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

Continuing with the above steps, when I do cmake .. now I get:

~/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!

Since the cmake .. step was not successful, not supprisingly now when I do make I get:

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

I gather there must be another setting other than un-commenting out the include("${PCL_SOURCE_DIR}/cmake/pcl_examples.cmake") line in CMakeLists.txt? Can somebody inform of the additional steps necessary to get the examples to successfully compile?


Solution

  • In your cmake command, please add -DBUILD_examples=ON as an option to enable examples.