This is a tutorial of how to compile and use Point Cloud Library (PCL) version 1.11.1 on Ubuntu 20.04.2 LTS. No need it to install!
- Boost: Used for shared pointers, and threading.
- Eigen: Used as the matrix backend for SSE optimized math
- FLANN: Used in Kdtree for fast approximate nearest neighbors search
- VTK: Used in visualization for 3D point cloud, rendering and visualization.
Use the master
version of flann from the repo instead of an official released.
- Download FLANN source code in
/opt
: FLANN - Edit
CMakeLists.txt
onflann/src/cpp/CMakeLists.txt
and replace line 32 and 86:
add_library(flann_cpp SHARED "") -> add_library(flann_cpp SHARED "main.cpp")
- Create a
main.cpp
file at the same directory - Compile and install FLANN:
$ cd build/
$ sudo cmake-gui ../
$ sudo make -j4
$ sudo make install
- Download VTK 8.1/8.2 source code in
/opt
: VTK - Create a
build
directory - Run CMake-gui:
$ cd build/
$ sudo cmake-gui ../
- Compile and install VTK:
$ sudo make -j4
$ sudo make install
- Download source code in
/opt
: PCL - Create a
build
directory - Create build files:
$ cd build/
$ sudo cmake-gui ../
- Select/Unselect pcl modules
- Compile PCL
$ sudo make -j4
- Download sample PCL code: pcl visualizer
- Create a
build
directory - Set PCL build directory in
CMakeLists.txt
in the/src
folder, line 20.
# set corresponding package directories
set(PCL_DIR /opt/pcl-1.11.1/build)
- Define CXX14 standard (optional)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
- Define common io visualization module (optional)
find_package(PCL 1.9 PATHS ${PCL_DIR} QUIET REQUIRED COMPONENTS common io visualization)
- Create build files:
$ cd build/
$ cmake ../src/
- Compile sample code:
$ make
- Download .pcd sample file: PCD file
- Test bin file
$ cd bin/
$ ./pcl-visualizer <.pcd file>
-
Issue:
Error while loading shared libraries: cannot open shared object file: No such file or directory
-
Solution:
$ sudo ldconfig -v
ref -
Issue:
undefined reference to 'LZ4_decompress_safe'
-
Solution: Use the
master
version of flann from the official repository -
Issue:
error: ‘Octree2BufBase’ does not name a type pcl
-
Solution: Instead of PCL 1.11.1 released use PCL 1.9.1