Building OSRM - Project-OSRM/osrm-backend GitHub Wiki

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
# optionally checkout a particular revision/tag
git checkout v5.27.1

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 .

# to use Conan for managing dependencies
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=1

# Afterwards
sudo cmake --build . --target install

Ubuntu

For Ubuntu we support two ways of getting dependencies installed:

Debian Trixie

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

sudo apt-get install git g++ cmake libbz2-dev \
zlib1g-dev libzip-dev libgomp1 liblua5.4-dev \
pkg-config libgdal-dev libboost-all-dev libtbb-dev

Building on older version of Debian 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.

macOS

To compile the source on a Mac, first make sure either the latest Xcode or at least the Xcode command line tools are installed. And ensure you are running a recent version of macOS.

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

  • ENABLE_CONAN=OFF (default): this most requires all dependencies be installed externally (via homebrew, etc)
  • ENABLE_CONAN=ON: this mode fetches most required dependencies automatically (no need to install deps like libboost)

OS X (ENABLE_CONAN=ON)

brew install git cmake
git clone https://github.com/Project-OSRM/osrm-backend.git
cd osrm-backend
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DENABLE_CONAN=ON
make

OS X (ENABLE_CONAN=OFF)

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

brew install boost git cmake libzip libxml2 lua tbb ccache pkg-config

To be able to compile tools:

brew install GDAL

Windows

Windows Compilation

⚠️ **GitHub.com Fallback** ⚠️