Compiling

These instructions assume a Debian-based system, because they have to assume something. Other Linux distributions are similar in the broad strokes but differ in specifics; if you have a preferred distro, use it and translate the package names (we assume you know how to drive its package manager).

This page is about building Cyrus from source -- typically from a release tarball -- in order to run it. If you want to develop Cyrus, don't build it by hand: use the container-based workflow in the developer quickstart, which installs every dependency and builds and tests Cyrus for you.

First make sure you have a copy of the source. You can either fetch the latest source from git, or download one of our release tarballs.

Note

Cyrus does not support compiling with Link Time Optimization, but some platforms now enable Link Time Optimization by default. If your platform does so, you will need to override it, perhaps by adding -fno-lto to CFLAGS and LDFLAGS.

Setting up dependencies

Required Build Dependencies

Building a basic Cyrus that can send and receive email: the minimum libraries required to build a functional cyrus-imapd.

Package

Debian

Notes

autoconf

autoconf

automake

automake

bison

bison

Cyrus SASL

libsasl2-dev

flex

flex

gcc

gcc

gperf

gperf

ICU

libicu-dev

version 55 or newer

jansson

libjansson-dev

libbsd

libbsd-dev

libtool

libtool

openssl

libssl-dev

perl

perl

perl App-Cmd

libapp-cmd-perl

perl Moo

libmoo-perl

pkgconfig

pkg-config

sqlite

libsqlite3-dev

uuid

uuid-dev

To install all of these from packages on Debian, use this:

sudo apt-get install git build-essential autoconf automake libtool \
    pkg-config bison flex libssl-dev libjansson-dev libxml2-dev \
    libsqlite3-dev libical-dev libsasl2-dev libpcre2-dev uuid-dev \
    libicu-dev
sudo apt-get -t jessie-backports install libxapian-dev

Build dependencies for additional functionality

The following dependencies enable additional functionality. Enable the matching features with the configure options noted below.

Note

Building from a git checkout (rather than a release tarball), regenerating the man pages, or rebuilding this documentation all need extra tooling (autotools in maintainer mode, Sphinx, and so on). Rather than chase those by hand, use the container-based developer workflow, which has all of it pre-installed.

SASL Authentication

Package

Debian

Required

Notes

Cyrus SASL Plain

libsasl2-modules

yes/no

Required to pass Cyrus IMAP's PLAIN authentication unit tests.

sasl binaries

sasl2-bin

no

Administration tools for managing SASL.

Kerberos

libsasl2-modules-gssapi-mit

no

Development headers required to enable Kerberos v5 authentication capabilities, also known as the authentication mechanism GSSAPI. Configure option: --with-gss_impl=mit.

Alternate database formats

Package

Debian

Required

Notes

mysql or mariadb

libmysqlclient-dev or libmariadb-dev

yes/no

MariaDB or MySQL development headers, required to allow Cyrus IMAP to use it as the backend for its databases. Configure options: --with-mysql, --with-mysql-incdir, --with-mysql-libdir.

postgresql

postgresql-dev

yes/no

PostgreSQL development headers, required to allow Cyrus IMAP to use it as the backend for its databases. Configure option: --with-pgsql.

CalDAV, CardDAV, or JMAP (httpd subsystem)

Package

Debian

Required

Notes

libbrotli

libbrotli-dev

no

It provides Brotli compression support for http communications (otherwise only deflate and gzip (optionally) would be available).

libchardet

libchardet-dev

yes/no

It is used by the JMAP module of httpd to detect the character set of untagged 8-bit headers. Without it, cyrus-imapd will not do character-set detection. If some piece of data has no character set coming in, it will have no character set. Required for JMAP, but otherwise is not needed.

libical

libical-dev

yes

It provides calendaring functionality for CalDAV, which can't be used without this lib. Version 4.0.0 or higher is required.

libxml

libxml2-dev

yes

A fundamental lib for all *DAV functionality.

nghttp2

libnghttp2-dev

no

HTTP/2 support for the entire httpd subsystem (*DAV & JMAP).

shapelib

shapelib

yes/no

It is required for tzdist service to have geolocation support. Otherwise it is not needed. Version 1.3.0 or higher is required when using it.

wslay

libwslay-dev

no

It provides WebSockets support in httpd. Only used with JMAP, otherwise not needed. Version 1.1.1 or higher is required when using it.

xxd

xxd

yes

Needed for the _js.h files, for CalDAV and CardDAV support.

zlib

zlib1g-dev

no

It provides gzip compression support for http communications.

Other

Package

Debian

Required

Notes

CUnit

libcunit1-dev

no

Development headers for compiling Cyrus IMAP's unit tests. Required to run make check.

SSL certificates

ssl-cert-dev

no

Used if you're installing SSL certificates.

ClamAV

libclamav-dev

no

It is used by cyr_virusscan, otherwise not needed.

CLD2

libcld2-dev

yes/no

Compact Language Detector 2 (probabilistically detects over 80 languages in Unicode UTF-8 text, either plain text or HTML/XML). Required for Xapian (--enable-xapian), otherwise not needed.

openldap

libldap2-dev

no

Development headers to enable ptloader to interface with LDAP directly, for canonification of login usernames to mailbox names, and verification of login usernames, ACL subjects and group membership. Configure option: --with-ldap.

pcre2

libpcre2-dev

yes

PCRE 2 (10.x) - for utf-8/unicode regular expression matching. Could be replaced by something else in the future. See issues/1731 for more information.

perl(Term::ReadLine)

no

Perl library needed by cyradm.

libsrs2

no package

no

It is used for implementing Sender Rewriting Scheme (SRS) functionality for messages forwarded by sieve scripts. Without it, messages forwarded by sieve scripts will not have this functionality and might have difficulty delivering to SMTP servers that insist on it.

Compile Cyrus

Default build: mail only

$ autoreconf -i
$ ./configure [options]

Check the summary after ./configure completes to ensure it matches your expectations.

To view all options, and disable or enable specific features, please see:

# ./configure --help

Tip

Passing environment variables as an argument to configure, rather than setting them in the environment before running configure, allows their values to be logged in config.log. This is useful for diagnosing problems.

Optional dependencies

Some features are disabled by default and must be explicitly enabled via configure.

Sieve is enabled by default.

JMAP

./configure --enable-jmap

Note

HTTP, CalDAV, CardDAV, WebDAV and the calendar alarm daemon are always built and no longer require configure options. libical, libxml2 and SQLite3 are required build dependencies for every Cyrus build (see the table above). JMAP remains optional because it also requires Xapian.

Murder

./configure --enable-murder

Replication

./configure --enable-replication

Compile

cd /path/to/cyrus-imapd

autoreconf -i -s   # generates the configure script and its dependencies

./configure --prefix=/usr/cyrus [feature options]

make

The --prefix option sets where Cyrus is installed to.

If you're running on Debian, and you install to /usr/local, you may need to update your library loader. Edit /etc/ld.so.conf.d/x86_64-linux-gnu.conf so it includes the following additional line:

/usr/local/lib/x86_64-linux-gnu

Without this, when you attempt to start Cyrus, it reports error while loading shared libraries: libcyrus_imap.so.0: cannot open shared object file: No such file or directory because it can't find the Cyrus library in /usr/local/lib.

Check

make check    # this runs the cunit tests.

This runs the cunit tests (which need CUnit and --enable-unit-tests) and is used for testing that the libraries support all the expected behaviour. If this fails, please report it to the cyrus-dev mailing list with details of your source version, operating system and affected libraries.

Next: installing Cyrus.