Skip to content
Aun Johnsen edited this page May 30, 2017 · 128 revisions

General build instructions from source

OSRM source is available via git or source archives, and is built with CMake.

Git

To download from Git, run the following commands:

git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend

If you would like to build a specific release (optional), you can list the release tags with git tag -l and then checkout a specific tag using git checkout tags/<tag_name>.

Source Release

OSRM can be built from the source archives available on the releases page. Example:

wget https://github.com/Project-OSRM/osrm-backend/archive/vX.Y.Z.tar.gz
tar -xzf vX.Y.Z.tar.gz
cd osrm-backend-X.Y.Z

Building

See below for required dependencies.

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .
sudo cmake --build . --target install

Ubuntu

For Ubuntu we support two ways of getting dependencies installed:

Debian Jessie

Use the following command to install the dependencies (git is used to fetch the source):

sudo apt-get install git g++ cmake libboost-dev libboost-filesystem-dev libboost-thread-dev \
libboost-system-dev libboost-regex-dev libstxxl-dev libxml2-dev libsparsehash-dev libbz2-dev \
zlib1g-dev libzip-dev libgomp1 liblua5.1-0-dev \
pkg-config libgdal-dev libboost-program-options-dev libboost-iostreams-dev \
libboost-test-dev libtbb-dev libexpat1-dev

Building on Squeeze and Wheezy requires getting a recent gcc, boost, and other packages. Probably building them from source. It can be done but is unsupported and not recommended. Open a ticket if you need help there.

Mac OS X 10.7.1, 10.8.2

To compile the source on a Mac, first make sure the latest XCode is installed. And ensure you are running at least OS X >= 10.10.

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 homebrew, etc)
  • ENABLE_MASON=ON: this mode fetches most required dependencies automatically (no need to install deps like libboost or libstxxl)

OS X with MacPorts

Download and compile stxxl[0] manually

port install build-essential git cmake pkg-config libbz2 libxml2 libzip boost lua tbb

[0] https://sourceforge.net/projects/stxxl/files/stxxl/

OS X (ENABLE_MASON=ON)

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

OS X (ENABLE_MASON=OFF)

Please install the homebrew package system. It will provide all necessary dependencies:

brew install boost git cmake libzip libstxxl libxml2 lua tbb ccache

To be able to compile tools:

brew install GDAL

Red Hat Enterprise Linux, Fedora, or CentOS

See this issue about CentOS/RHEL 6 compiler versions.

See this issue about Fedora and Lua 5.3.

See this page to install osrm-backend on Centos 6.

If compiling on Red Hat Enterprise Linux, Fedora, or CentOS then you will need to enable the EPEL repositories in order to satisfy dependencies.

To compile on Fedora 14 you will need to first install at least the following dependencies:

yum install gcc-c++ libxml2-devel stxxl-devel boost-devel bzip2-devel cmake

To compile on Fedora 15 you will need to first install the following dependencies:

yum install gcc-c++ libxml2-devel stxxl-devel boost-devel boost-regex bzip2-devel libzip-devel

To compile on Fedora 20 you will need to first install the following dependencies:

sudo yum install git cmake gcc-c++

sudo yum install libxml2-devel boost-devel boost-regex bzip2-devel \
     libzip-devel stxxl-devel \
     lua.x86_64 lua-devel.x86_64 luajit.x86_64 luajit-devel.x86_64 \
     expat expat-devel tbb tbb-devel

Finally, follow the installation of Project-OSRM:

git clone https://github.com/Project-OSRM/osrm-backend.git
mkdir –p Project-OSRM/build
cd Project-OSRM/build
cmake ..
make
sudo make install

To compile on Cent OS 6 / RHEL 6 you will need to first install the following dependencies:

yum install gcc-c++ libxml2-devel boost-devel bzip2-devel cmake

stxxl-devel is not available in the repositories for these distributions a the time of writing, and must be obtained separately. It needs to be manually downloaded, extracted and installed on your system (clear instructions can be found in the stxxl documentation). You then need to specify the location of your stxxl installation when you use cmake using the -DSTXXL_LIBRARY=/somewhere/libstxxl.a flag (see above).

OSRM cannot be compiled on RHEL 5 / CentOS 5 without manually compiling a recent version of libboost.

Windows

Windows Compilation