This tutorial explains how to build the Point Cloud Library from MacPorts and source on Mac OS X platforms, and tries to guide you through the download and building of all the required dependencies.
Before getting started download and install the following prerequisites for Mac OS X:
Appleās powerful integrated development environment
An open-source community initiative to design an easy-to-use system for compiling, installing, and upgrading either command-line, X11 or Aqua based open-source software on the Mac OS X operating system.
In order to compile every component of the PCL library we need to download and compile a series of 3rd party library dependencies. We’ll cover the building, compiling and installing of everything in the following sections:
The following libraries are Required to build PCL.
Cross-platform, open-source build system.
Note
Though not a dependency per se, the PCL community relies heavily on CMake for the libraries build process.
Provides free peer-reviewed portable C++ source libraries. Used for shared pointers, and threading.
Unified matrix library. Used as the matrix backend for SSE optimized math.
FLANN version >= 1.6.8 (http://www.cs.ubc.ca/~mariusm/index.php/FLANN/FLANN) Library for performing fast approximate nearest neighbor searches in high dimensional spaces. Used in kdtree for fast approximate nearest neighbors search.
CMinPack version >= 1.1.3 (http://devernay.free.fr/hacks/cminpack/cminpack.html) Software for solving nonlinear equations and nonlinear least squares problems. Used in the sample_consensus and registration modules for non-linear (Levenberg-Marquardt) optimizations.
Software system for 3D computer graphics, image processing and visualization. Used in visualization for 3D point cloud rendering and visualization.
A cross-platform GUI and tools library for GTK, MS Windows, and MacOS. Used for pcl::RangeImage visualizations.
The following libraries are Optional and provide extended functionality within PCL, ie Kinect support.
computes the convex hull, Delaunay triangulation, Voronoi diagram, halfspace intersection about a point, furthest-site Delaunay triangulation, and furthest-site Voronoi diagram. Used for convex/concave hull decompositions in surface.
A library that gives user level applications uniform access to USB devices across many different operating systems.
The OpenNI Framework provides the interface for physical devices and for middleware components. Used to grab point clouds from OpenNI compliant devices.
The following libraries are Advanced and provide additional functionality for PCL developers:
Google’s framework for writing C++ tests on a variety of platforms. Used to build test units.
A documentation system for C++, C, Java, Objective-C, Python, IDL (Corba and Microsoft flavors), Fortran, VHDL, PHP, C#, and to some extent D.
A tool that makes it easy to create intelligent and beautiful documentation.
By now you should have downloaded and installed the latest versions of XCode and MacPorts under the Prerequisites section. We’ll be installing most dependencies available via MacPorts and the rest will be built from source.
$ sudo port install cmake
$ sudo port install boost
$ sudo port install eigen3
$ sudo port install flann
There is no MacPort currently available for CMinPack. You can either install the Prebuilt Binaries provided on the PCL downloads page (http://pointclouds.org/downloads/macosx.html), or build from source.
To build from source download the CMinPack source from http://devernay.free.fr/hacks/cminpack/cminpack.html and extract:
$ cd ~/Downloads/
$ tar -xzvf cminpack-1.1.3.tar.gz
$ cd cminpack-1.1.3
You’ll also need to grab the PCL patch, which includes various builds of CMinPack:
$ svn export http://svn.pointclouds.org/pcl/trunk/3rdparty/cminpack/cpack.patch
$ patch < cpack.patch
$ cmake -DUSE_FPIC=ON -DSHARED_LIBS=ON -DBUILD_EXAMPLES=OFF .
$ make
$ sudo make install
To install via MacPorts:
$ sudo port install vtk5 +x11
To install from source download the source from http://www.vtk.org/VTK/resources/software.html
Follow the README.html for compiling on UNIX / Cygwin / Mac OSX:
$ cd VTK
$ mkdir VTK-build
$ cd VTK-build
$ ccmake ../VTK
Press [c] for initial configuration
Press [t] to get into advanced mode and change the following:
OPENGL_INCLUDE_DIR:/usr/X11R6/include
OPENGL_gl_LIBRARY:-L/usr/X11R6/lib -lGL
OPENGL_glu_LIBRARY:-L/usr/X11R6/lib -lGLU
OPENGL_xmesa_INCLUDE_DIR:/usr/X11R6/include
VTK_USE_CARBON:OFF
VTK_USE_COCOA:OFF
VTK_USE_X:ON
Note
If you don’t see OPENGL_xmesa_INCLUDE_DIR when you first load it’s because VTK_USE_X: OFF. Once set to ON you should see it
Press [g] to generate the make files.
Press [q] to quit.
Then run:
$ make && make install
$ sudo port install wxgtk
$ sudo port install qhull
$ sudo port install libusb-devel +universal
Download the patched versions of OpenNI and Sensor from the PCL downloads page http://pointclouds.org/downloads/macosx.html
Extract, build, fix permissions and install OpenNI:
$ unzip openni_osx.zip -d openni_osx
$ cd openni_osx/Redist
$ chmod -R a+r Bin Include Lib
$ chmod -R a+x Bin Lib
$ chmod a+x Include/MacOSX Include/Linux-*
$ sudo ./install
In addition the following primesense xml config found within the patched OpenNI download needs its permissions fixed and copied to the correct location to for the Kinect to work on Mac OS X:
$ chmod a+r openni_osx/Redist/Samples/Config/SamplesConfig.xml
$ sudo cp openni_osx/Redist/Samples/Config/SamplesConfig.xml /etc/primesense/
Extract, build, fix permissions and install Sensor:
$ unzip ps_engine_osx.zip -d ps_engine_osx
$ cd ps_engine_osx/Redist
$ chmod -R a+r Bin Lib Config Install
$ chmod -R a+x Bin Lib
$ sudo ./install
At this point you should have everything needed installed to build PCL with almost no additional configuration.
Checkout the PCL source from the trunk:
$ svn co http://svn.pointclouds.org/pcl/trunk pcl
$ cd pcl
Create the build directories, configure CMake, build and install:
$ mkdir build
$ cd build
$ cmake ..
$ make
$ sudo make install
The customization of the build process is out of the scope of this tutorial and is covered in greater detail in the Customizing the PCL build process tutorial.
We finally managed to compile the Point Cloud Library (PCL) for Mac OS X. You can start using them in your project by following the using_pcl tutorial.
Install Doxygen via MacPorts:
$ sudo port install doxygen
Or install the Prebuilt binary for Mac OS X (http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc)
After installed you can build the documentation:
$ make doc
In addition to the API documentation there is also tutorial documentation built using Sphinx. The easiest way to get this installed is using pythons easy_install:
$ easy_install -U Sphinx
The Sphinx documentation also requires the third party contrib extension sphinxcontrib-doxylink (http://pypi.python.org/pypi/sphinxcontrib-doxylink) to reference the Doxygen built documentation.
To install from source you’ll also need Mercurial:
$ sudo port install mercurial
$ hg clone http://bitbucket.org/birkenfeld/sphinx-contrib
$ cd sphinx-contrib/doxylink
$ python setup.py install
After installed you can build the tutorials:
$ make Tutorials
Note
Sphinx can be installed via MacPorts but is a bit of a pain getting all the PYTHON_PATH’s in order