Postfix OpenLDAP LMDB Howto


Postfix uses databases of various kinds to store and look up information. Postfix databases are specified as "type:name". OpenLDAP LMDB implements the Postfix database type "lmdb". The name of a Postfix OpenLDAP LMDB database is the name of the database file without the ".lmdb" suffix. OpenLDAP LMDB databases are maintained with the postmap(1) command.

This document describes:

  1. How to build Postfix with OpenLDAP LMDB support.

  2. How to configure LMDB settings.

  3. Missing pthread library trouble.

Caution: the current Postfix LMDB client has unexpected limitations. For this reason, LMDB support is not part of the stable Postfix release.

Building Postfix with OpenLDAP LMDB support

Postfix normally does not enable OpenLDAP LMDB support. To build Postfix after you installed OpenLDAP LMDB from source code, use something like:

% make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
    AUXLIBS="-L/usr/local/lib -llmdb"
% make

Solaris needs this:

% make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
    AUXLIBS="-R/usr/local/lib -L/usr/local/lib -llmdb"
% make

The exact pathnames depend on how OpenLDAP LMDB was installed.

Configure LMDB settings

Postfix provides a configuration parameter that controls how large an OpenLDAP LMDB database may grow.

Missing pthread library trouble

When building Postfix fails with:

undefined reference to `pthread_mutexattr_destroy'
undefined reference to `pthread_mutexattr_init'
undefined reference to `pthread_mutex_lock'

Add the "-lpthread" library to the "make makefiles" command.

% make makefiles .... AUXLIBS="... -lpthread"

Source code for OpenLDAP LMDB is available at More information is available at

Limitations of Postfix LMDB databases.