Install OMPL using Boost 1.64+ on Ubuntu 14.04

The last few weeks I was trying to install OMPL correctly with Boost 1.64 on Ubuntu 14.04. Believe me, it’s not straightforward if you don’t know how to do it properly.

Ubuntu 14.04 is stuck on system Boost version 1.58. If you don’t have any dependencies holding you back from upgrading to a newer version of Ubuntu, I will strongly recommend you to upgrade. However, if you are in the robotics area you will probably have a reason to stay with Ubuntu 14.04.

A bit of background. OMPL can be installed quite easily with system Boost (1.58) and not face any problems. However, if you need to use some specific features or classes you will soon run into troubles. That’s because NumPy comes with Boost library 1.64 and beyond. If you are running system boost on Ubuntu 14.04, then you are suffering from this dependency. You, therefore, need to install Boost 1.64 from source yourself, and “tell” OMPL where to find the local Boost library.

Note: This guide is specifically for Boost 1.64, but any version of Boost that needs to be compiled from source should work just fine with the same instructions.

First things first, install Boost 1.64 on Ubuntu 14.04

Let’s set where we want the local boost to be installed. Run the following command in your terminal (the path don’t need to exist yet):


The important part is to change the path to match your own configuration. Please note, that having an absolute path is important; don’t use a relative path (i.e., ~/local…). Note that this variable is just for the purposes of this tutorial, it is not used anywhere else.

Let’s create the directory where we will install Boost:


Let’s download Boost 1.64 into our Downloads directory:

cd ~/Downloads
tar xf boost_1_64_0.tar.gz
rm ~/Downloads/boost_1_64_0.tar.gz

You should now have a boost_1_64_0 directory in your Downloads directory.

Let’s now install Boost into PATH_TO_LOCAL_BOOST:

cd boost_1_64_0
./ --prefix=$PATH_TO_LOCAL_BOOST
./b2 install --prefix=$PATH_TO_LOCAL_BOOST --with=all

Let’s clean up and delete the Boost directory from the Downloads directory:

rm -rf ~/Downloads/boost_1_64_0

Fixing a bug

I found a small problem when I was compiling OMPL with Boost 1.64. I managed to fix it locally so here I will highlight how to do it. I am not sure if a newer Boost version is working without this modification, but if you try to install a newer Boost from source and you don’t have problems with OMPL, then please let’s know in the comments below.

A file called storage.hpp located under include/boost/numeric/ublas in the installed local boost directory contains the following code:

#include <boost/serialization/array.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/nvp.hpp>

For some reason, these includes were causing some errors when installing OMPL. I needed to change this file into:

#include <boost/serialization/access.hpp>
#include <boost/serialization/array_wrapper.hpp>
#include <boost/serialization/collection_size_type.hpp>
#include <boost/serialization/nvp.hpp>

We can do this using few bash commands.

Let’s first create a variable with the path of the file we would like to modify:


And now run the following commands to make the required modifications to storage.hpp:

sed -i '/#include <boost\/serialization\/array.hpp>/c\#include <boost/serialization/array_wrapper.hpp>' $FILE_TO_MODIFY
sed -i '21i #include <boost/serialization/access.hpp>' $FILE_TO_MODIFY

Not the best way to do this, but it works. In case something went wrong, double check that the file has the correct format as highlighted above.

Installing OMPL with Boost 1.64

Now that we have Boost 1.64+ locally installed, we can proceed with the OMPL installation. In here we will also install OMPL Python bindings. If you are not interested in the Python bindings, then omit the make update_bindings -j 4 command below.

I extracted some commands from the OMPL shell script and modify it to fit our purposes.

Install few dependencies first:

# Common dependencies
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install pypy
sudo apt-get install cmake curl python-dev python-qt4-dev python-qt4-gl python-opengl freeglut3-dev
sudo apt-get install libflann-dev libassimp-dev
sudo apt-get install doxygen graphviz libode-dev
sudo apt-get install gccxml
sudo -H pip install -vU pygccxml pyplusplus

sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-5 cmake pkg-config libeigen3-dev libode-dev
export CXX=g++-5
export MAKEFLAGS="-j `nproc`"

# Python Dependencies
sudo apt-get install python2-dev python2-pip
sudo -H pip2 install -vU pygccxml pyplusplus
wget -O - | tar zxf - -C $HOME
export PATH=$HOME/castxml/bin:$PATH

Now we can install OMPL:

# Install OMPL	
cd ~/Downloads
wget -O - | tar zxf -   
cd ompl-1.4.0-Source
mkdir -p build/Release
cd build/Release

make update_bindings -j 4
make -j 4
sudo make install

rm -rf ~/Downloads/ompl-1.4.0-Source

Few words about OMPL and Catkin

I needed to integrate OMPL with some catkin package. If you use catkin and ROS you are more likely to fall into the trap of having OMPL installed with Boost 1.64 and ROS and catkin packages with system Boost. This will cause segmentation faults. What I am suggesting here is to tell catkin to use Boost 1.64 (your local boost) instead of the system Boost. This command is quite long, so I created an alias in my .bashrc file:

source ~/.bashrc

Now in my catkin workspace I run catkin_make_boost instead of catkin_make and this will compile all my catkin packages with the local boost instead of the system one.

This should do the trick. Hopefully, you were successful as well. It took me way too long to do this, and I don’t want anyone else to spend that much time on this. Hopefully, I managed to achieve my goal.

Happy coding.


© 2019 Rafael Papallas
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.