Skip to content
Dane Springmeyer edited this page Dec 21, 2016 · 27 revisions

On OS X and Ubuntu systems there are two key modes you can build in:

  • ENABLE_MASON=OFF (default): this most requires all dependencies be installed externally (via apt-get, etc)
  • ENABLE_MASON=ON: this mode fetches most required dependencies automatically (no need to install deps like libboost or libstxxl)

>= Ubuntu 16.04 (ENABLE_MASON=ON)

apt-get update -y
apt-get install -y zlib1g-dev curl libstdc++-5-dev make binutils libc-dev libgcc-5-dev git
git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
./third_party/mason/mason install cmake 3.6.2
export PATH=$(./third_party/mason/mason prefix cmake 3.6.2)/bin:$PATH
mkdir build
cd build
cmake ../ -DENABLE_MASON=1
make

Ubuntu 12.04 -> 15.04 (ENABLE_MASON=ON)

apt-get update -y
apt-get install -y software-properties-common python-software-properties || true
add-apt-repository -y ppa:ubuntu-toolchain-r/test
apt-get update -y
apt-get install -y zlib1g-dev curl libstdc++-5-dev make binutils libc-dev libgcc-5-dev git
git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
./third_party/mason/mason install cmake 3.6.2
export PATH=$(./third_party/mason/mason prefix cmake 3.6.2)/bin:$PATH
mkdir build
cd build
cmake ../ -DENABLE_MASON=1
make

Ubuntu 16.04 (ENABLE_MASON=OFF)

sudo apt install build-essential git cmake pkg-config \
libbz2-dev libstxxl-dev libstxxl1v5 libxml2-dev \
libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev

Ubuntu 15.10 (ENABLE_MASON=OFF)

sudo apt-get install build-essential git cmake pkg-config \
libbz2-dev libstxxl-dev libstxxl1v5 libxml2-dev \
libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev

Ubuntu 15.04 (ENABLE_MASON=OFF)

sudo apt-get install build-essential git cmake pkg-config \
libbz2-dev libstxxl-dev libstxxl1 libxml2-dev \
libzip-dev libboost-all-dev lua5.2 liblua5.2-0-dev libtbb-dev

Ubuntu 14.04 (ENABLE_MASON=OFF)

The most critical packages which should be as recent as possible are: a compiler for C++14 (GCC 4.9+, Clang 3.4+), CMake for the buildsystem (2.8.11+) and Boost 1.55+. GCC can be upgraded using the ubuntu-toolchain-r/test ppa.

You have to update your compiler. GCC 4.8 ships per default but is too old for C++14:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install g++-6 gcc-6 build-essential git wget cmake pkg-config libbz2-dev libstxxl-dev libstxxl1 libxml2-dev libzip-dev libboost-all-dev lua5.2 liblua5.2-dev libtbb-dev

and either export the new compiler per session

export CPP=cpp-6 CC=gcc-6 CXX=g++-6

or set it globally

sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-6 20
sudo update-alternatives --install /usr/bin/cpp cpp /usr/bin/cpp-6 20

You may have to export GCC specific binutils when building with link-time optimization:

export AR=gcc-ar-4.9 NM=gcc-nm-4.9 RANLIB=gcc-ranlib-4.9

or disable link-time optimization:

cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_LTO=OFF

Earlier Ubuntu versions

You're pretty much on your own here: you need to update CMake, your compiler and have to compile every C++ dependency locally against your new compiler yourself. It's possible for sure; if you really need to do this and need help open a ticket or ping us on IRC.

Clone this wiki locally