Compilation and Installation of OctoMap

Felix Endres edited this page Oct 6, 2016 · 7 revisions


Download a released source package, or clone the latest development version from our git repository with:

git clone git://

Older releases are generally available as tags at

If you want to use OctoMap in the Robot Operating System (ROS), see the documentation on the ROS wiki and the octomap_mapping stack for map building. Pre-compiled packages for most platforms are already available and directly integrated.


To build the OctoMap libraries, you need a current version of GCC (tested with 4.3 - 4.6 under Ubuntu 9.04 - 12.04, 32 and 64 Bit) and cmake. The 3D viewer application requires Qt4 and OpenGL, and is based on libQGLViewer.

Ubuntu Prerequisites

You can either install libQGLViewer as a system-wide package (libqglviewer-qt4-dev in Ubuntu), or use the version we provide in the "external" directory. If the CMake compilation can't find an installed qglviewer, it will automatically compile our supplied version and link against it. For building the GUI, you need to make sure that qmake for Qt4 is used (qmake -v). If yours is set to Qt3 in Ubuntu, you can change it to qmake-qt4 by running sudo update-alternatives --config qmake after installing the dependencies below.

All dependencies for the library and viewer on Ubuntu 12.04 can be met by running:

sudo apt-get install build-essential cmake doxygen libqt4-dev \
    libqt4-opengl-dev libqglviewer-qt4-dev

Note: On Ubuntu 14.04 the last package should be "libqglviewer-dev" and on 16.04 it is "libqglviewer-dev-qt4".

Mac OS Prerequisites

Note: Work in progress.

brew install cmake doxygen libqglviewer

First Build

Build the complete project by creating a "build" directory, changing into it and running cmake:

mkdir build
cd build
cmake ..

Type make to compile afterwards. This will create all CMake files cleanly in the "build" folder (Out-of-source build). Executables will end up in "bin", libraries in "lib". You can also build the library and viewer separately, just have a look at the enclosed README.txt for details.

A debug configuration can be created by running:

cmake -DCMAKE_BUILD_TYPE=Debug .. 

in "build" or a different directory (e.g. "build-debug").

After compiling, you can verify that all is working as expected by running our units tests with make test. You can install the library system-wide with make install (be sure to set the correct CMAKE_INSTALL_PREFIX before).

Getting started

Jump right in and have a look at the example src/octomap/simple.cpp or start the 3D viewer bin/octovis. You will find an example scan to load at octomap/share/data/scan.dat.bz2 (please bunzip2 it first). More datasets are available in our dataset repository. Please refer to our online API documentation for further details.