Installation from Sources

Short Version

To compile assuming you have all the dependencies in your search path

git clone https://github.com/MobilityDB/MobilityDB
mkdir MobilityDB/build
cd MobilityDB/build
cmake  ..
make
sudo make install

The above commands install the master branch. If you want to install another branch, for example, develop, you can replace the first command above as follows

git clone --branch develop https://github.com/MobilityDB/MobilityDB

You should also set the following in the postgresql.conf file depending on the version of PostGIS you have installed (below we use PostGIS 3):

shared_preload_libraries = 'postgis-3'
max_locks_per_transaction = 128

If you do not preload the PostGIS library with the above configuration you will not be able to load the MobilityDB library and will get an error message such as the following one:

ERROR:  could not load library "/usr/local/pgsql/lib/libMobilityDB-1.1.so":
  undefined symbol: ST_Distance

You can find the location of the postgresql.conf file as given next.

$ which postgres
/usr/local/pgsql/bin/postgres
$ ls /usr/local/pgsql/data/postgresql.conf
/usr/local/pgsql/data/postgresql.conf

As can be seen, the PostgreSQL binaries are in the bin subdirectory while the postgresql.conf file is in the data subdirectory.

Once MobilityDB is installed, it needs to be enabled in each database you want to use it in. In the example below we use a database named mobility.

createdb mobility
psql mobility -c "CREATE EXTENSION PostGIS"
psql mobility -c "CREATE EXTENSION MobilityDB"

The two extensions PostGIS and MobilityDB can also be created using a single command.

psql mobility -c "CREATE EXTENSION MobilityDB cascade"

Get the Sources

The MobilityDB latest release can be found in https://github.com/MobilityDB/MobilityDB/releases/latest

wget

To download this release:

wget -O mobilitydb-1.0.tar.gz https://github.com/MobilityDB/MobilityDB/archive/v1.0.tar.gz

Go to the section called “Short Version” to the extract and compile instructions.

git

To download the repository

git clone https://github.com/MobilityDB/MobilityDB.git
cd MobilityDB
git checkout v1.0

Go to the section called “Short Version” to the compile instructions (there is no tar ball).

Enabling the Database

MobilityDB is an extension that depends on PostGIS. Enabling PostGIS before enabling MobilityDB in the database can be done as follows

CREATE EXTENSION postgis;
CREATE EXTENSION mobilitydb;

Alternatively, this can be done in a single command by using CASCADE, which installs the required PostGIS extension before installing the MobilityDB extension

CREATE EXTENSION mobilitydb CASCADE;

Dependencies

Compilation Dependencies

To be able to compile MobilityDB, make sure that the following dependencies are met:

  • CMake cross-platform build system.

  • C compiler gcc or clang. Other ANSI C compilers can be used but may cause problems compiling some dependencies.

  • GNU Make (gmake or make) version 3.1 or higher. For many systems, GNU make is the default version of make. Check the version by invoking make -v.

  • PostgreSQL version 12 or higher. PostgreSQL is available from http://www.postgresql.org.

  • PostGIS version 3 or higher. PostGIS is available from https://postgis.net/.

  • GNU Scientific Library (GSL). GSL is available from https://www.gnu.org/software/gsl/. GSL is used for the random number generators.

Notice that PostGIS has its own dependencies such as Proj, GEOS, LibXML2, or JSON-C, and these libraries are also used in MobilityDB. Refer to http://trac.osgeo.org/postgis/wiki/UsersWikiPostgreSQLPostGIS for a support matrix of PostGIS with PostgreSQL, GEOS, and Proj.

Optional Dependencies

For the user's documentation

  • The DocBook DTD and XSL files are required for building the documentation. For Ubuntu, they are provided by the packages docbook and docbook-xsl.

  • The XML validator xmllint is required for validating the XML files of the documentation. For Ubuntu, it is provided by the package libxml2.

  • The XSLT processor xsltproc is required for building the documentation in HTML format. For Ubuntu, it is provided by the package libxslt.

  • The program dblatex is required for building the documentation in PDF format. For Ubuntu, it is provided by the package dblatex.

  • The program dbtoepub is required for building the documentation in EPUB format. For Ubuntu, it is provided by the package dbtoepub.

For the developers's documentation

  • The program doxygen is required for building the documentation. For Ubuntu, it is provided by the package doxygen.

Example: Installing dependencies on Linux

Database dependencies

sudo apt-get install postgresql-14 postgresql-server-dev-14 postgresql-14-postgis

Build dependencies

sudo apt-get install cmake gcc libgsl-dev

Configuring

MobilityDB uses the cmake system to do the configuration. The build directory must be different from the source directory.

To create the build directory

mkdir build

To see the variables that can be configured

cd build
cmake -L ..

Build and Install

Notice that the current version of MobilityDB has been tested on Linux, MacOS, and Windows systems. It may work on other Unix-like systems, but remain untested. We are looking for volunteers to help us to test MobilityDB on multiple platforms.

The following instructions start from path/to/MobilityDB on a Linux system

mkdir build
cd build
cmake ..
make
sudo make install

When the configuration changes

rm -rf build

and start the build process as mentioned above.

Testing

MobilityDB uses ctest, the CMake test driver program, for testing. This program will run the tests and report results.

To run all the tests

ctest

To run a given test file

ctest -R '021_tbox'

To run a set of given test files you can use wildcards

ctest -R '022_*'

Documentation

MobilityDB user's documentation can be generated in HTML, PDF, and EPUB format. Furthermore, the documentation is available in English and in other languages (currently, only in Spanish). The user's documentation can be generated in all formats and in all languages, or specific formats and/or languages can be specified. MobilityDB developer's documentation can only be generated in HTML format and in English.

The variables used for generating user's and the developer's documentation are as follows:

Table 1.1. Variables for the user's and the developer's documentation

VariableDefault valueComment
DOC_ALLBOOL=OFFThe user's documentation is generated in HTML, PDF, and EPUB formats.
DOC_HTMLBOOL=OFFThe user's documentation is generated in HTML format.
DOC_PDFBOOL=OFFThe user's documentation is generated in PDF format.
DOC_EPUBBOOL=OFFThe user's documentation is generated in EPUB format.
LANG_ALLBOOL=OFFThe user's documentation is generated in English and in all available translations.
ESBOOL=OFFThe user's documentation is generated in English and in Spanish.
DOC_DEVBOOL=OFFThe English developer's documentation is generated in HTML format.

Generate the user's and the developer's documentation in all formats and in all languages.

cmake -D DOC_ALL=ON -D LANG_ALL=ON -D DOC_DEV=ON ..
make doc
make doc_dev

Generate the user's documentation in HTML format and in all languages.

cmake -D DOC_HTML=ON -D LANG_ALL=ON ..
make doc

Generate the English user's documentation in all formats.

cmake -D DOC_ALL=ON ..
make doc

Generate the user's documentation in PDF format in English and in Spanish.

cmake -D DOC_PDF=ON -D ES=ON ..
make doc