File: compiling.txt

package info (click to toggle)
cyrus-imapd 3.0.8-6%2Bdeb10u6
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 61,500 kB
  • sloc: ansic: 189,141; perl: 10,435; javascript: 9,404; sh: 6,159; yacc: 2,199; makefile: 1,971; cpp: 926; python: 361; lex: 320; awk: 303; asm: 262; xml: 1
file content (282 lines) | stat: -rw-r--r-- 10,771 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
.. _compiling:

=========
Compiling
=========

These instructions are based on Debian 8.0 because it has to be based on something. Other Linux distributions will be similar in the broad ideas but may differ in the specifics. If you already have a preferred distro, use that (we assume you know how to use its package management system). If you don't already have a preferred distro, maybe consider using Debian.

First make sure you have a :ref:`copy of the source <getcyrus>`. You can either fetch the latest source from git, or using one of our release tarballs.

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.

.. csv-table:: Build Dependencies
    :header: "Package", "Debian", "RedHat"

    `autoconf`_, "autoconf", "autoconf"
    `automake`_, "automake", "automake"
    `bison`_, "bison", "bison"
    `Cyrus SASL`_, "libsasl2-dev", "cyrus-sasl-devel"
    `flex`_, flex, flex
    `gcc`_, gcc, gcc
    `gperf`_, gperf, gperf
    `jansson`_, libjansson-dev, jansson-devel
    `libbsd`_ ,libbsd-dev, libbsd-devel
    `libtool`_, libtool, libtool
    `ICU`_, libicu-dev, libicu-devel
    `uuid`_, uuid-dev, libuuid-devel
    `openssl`_ :ref:`(Note about versions) <openssl-versions>`, libssl-dev, openssl-devel
    `pkgconfig`_, pkg-config, pkgconfig
    `sqlite`_, libsqlite3-dev, sqlite-devel

.. _autoconf: http://www.gnu.org/software/autoconf/
.. _automake: http://www.gnu.org/software/automake/
.. _bison: http://www.gnu.org/software/bison/
.. _Cyrus SASL: :ref:`Cyrus SASL <cyrussasl:sasl-index>`
.. _flex: http://flex.sourceforge.net/
.. _gcc: http://gcc.gnu.org
.. _gperf: http://www.gnu.org/software/gperf/
.. _jansson: http://www.digip.org/jansson/
.. _libbsd: https://libbsd.freedesktop.org/wiki/
.. _libtool: http://www.gnu.org/software/libtool/
.. _ICU: http://www.icu-project.org/
.. _uuid: https://www.kernel.org/pub/linux/utils/util-linux/
.. _openssl: http://www.openssl.org/
.. _pkgconfig: http://pkgconfig.freedesktop.org
.. _sqlite: https://www.sqlite.org/

To install all dependencies from packages on Debian Jessie, use this:

.. include:: /assets/cyrus-build-reqpkg.rst

Optional Build Dependencies
---------------------------

The following build dependencies are optional, and enable functionality,
code maintenance tasks or building the documentation.

Developers only
###############

.. csv-table::
    :header: "Package", "Debian", "RedHat",  "Required for ``make check``?", "Notes"
    :widths: 20,15,15,5,45

    `CUnit`_, libcunit1-dev, cunit-devel, "yes", "Development headers for compiling Cyrus IMAP's unit tests."
    `perl(ExtUtils::MakeMaker)`_, ??, ??, "no", "Perl library to assist in building extensions to Perl.

    Configure option: ``--with-perl``"
    `libdb-dev`, libdb-dev, libdb-devel, "no", "The -dev package must match the version of libdb you already have installed (assuming it's probably already installed). On Debian 8.0, ``libdb5.3-dev`` is needed, but ``libdb5.1-dev`` on 7.8."
    `perl-devel`_, perl-dev, perl-devel, "no", "Perl development headers to allow building binary perl libraries. Needs version 5+.

    Configure option: ``--with-perl``"
    `valgrind`_, valgrind, valgrind, "no", "Performance and memory testing."

SASL Authentication
###################

.. csv-table::
    :header: "Package", "Debian", "RedHat",  "Required for ``make check``?", "Notes"
    :widths: 20,15,15,5,45

    `Cyrus SASL Plain`_, libsasl2-modules, cyrus-sasl-plain,  "yes", "Cyrus SASL package that ships the \
    library required to pass Cyrus IMAP's PLAIN authentication unit tests."
    `Cyrus SASL MD5`_, libsasl2-modules, cyrus-sasl-md5, "yes", "Cyrus SASL library required to pass Cyrus IMAP's DIGEST-MD5
    authentication unit tests"
    `sasl binaries`_, sasl2-bin, sasl2-bin, "no", "Administration tools for managing SASL"
    `Kerberos`_, libsasl2-modules-gssapi-mit, krb5-devel, "no", "Development headers required to enable Kerberos v5 authentication
    capabilities. Otherwise also known as the authentication mechanism *GSSAPI*.

    Configure option: ``--with-krbimpl=mit`` "

Alternate database formats
##########################

.. csv-table::
    :header: "Package", "Debian", "RedHat",  "Required for ``make check``?", "Notes"
    :widths: 20,15,15,5,45

    `lmdb`_, lmdb-dev, lmdb, "no", "Lightning Memory-Mapped Database Manager (LMDB) backend for Cyrus IMAP
    databases.     LMDB requires database environments to be set to a (user-configurable)
    maximum size. The Cyrus backend uses 512MB as default size. Cyrus
    installations may override this by setting the environment variable
    CYRUSDB_LMDB_MAXSIZE. The value of this variable must be an integer,
    optionally followed (without space) by 'mb' or 'gb' to define the
    maximum size in bytes, megabytes or gigabytes. The size should be a
    multiple of the OS page size. "
    `mysql`_ or `mariadb`_, libmysqlclient-dev or libmariadb-dev, mysql-devel or mariadb-devel, "no", "MariaDB or MySQL development headers, to allow Cyrus IMAP to use
    it as the backend for its databases.

    Configure option: ``--with-mysql``, ``--with-mysql-incdir``, ``--with-mysql-libdir``"
    `postgresql`_, postgresql-dev, postgresql-devel, "no"

CalDAV and/or CardDAV
#####################

.. csv-table::
    :header: "Package", "Debian", "RedHat",  "Required for ``make check``?", "Notes"
    :widths: 20,15,15,5,45

    `libical`_, libical-dev, libical-devel, "no", "libical >= 0.48 required for scheduling support.
    **Note:** Linux distributions Enterprise Linux 6 and Debian Squeeze are
    known to ship outdated **libical** packages versions 0.43 and
    0.44 respectively. The platforms will not support scheduling."
    `libxml`_, libxml2-dev, libxml2-devel, "", "no"

Other
#####

.. csv-table::
    :header: "Package", "Debian", "RedHat",  "Required for ``make check``?", "Notes"
    :widths: 20,15,15,5,45

     SSL certificates, ssl-cert-dev, mod_ssl, "no", "Used if you're installing SSL certificates"
    `net-snmp`_, libsnmp-dev, net-snmp-devel, "no", "version 4.2 or higher"
    `openldap`_, libldap2-dev, openldap-devel, "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``"
    `tcp_wrappers`_, tcp_wrappers, xx, "no"
    `transfig`_, transfig, xx, "no"
    `zlib`_, zlib1g-dev, zlib-devel, "no", "Compression support for httpd"
    `nghttp2`_, libnghttp2-dev, libnghttp2-devel, "no", "HTTP/2 support for httpd"

.. _CUnit: http://cunit.sourceforge.net/
.. _Cyrus SASL Plain: :ref:`Cyrus SASL <cyrussasl:sasl-index>`
.. _Cyrus SASL MD5: :ref:`Cyrus SASL <cyrussasl:sasl-index`
.. _sasl binaries: :ref:`Cyrus SASL <cyrussasl:sasl-index`
.. _lmdb: http://lmdb.tech/
.. _Kerberos: http://web.mit.edu/kerberos/www/
.. _libical: http://freeassociation.sourceforge.net/
.. _libxml: http://xmlsoft.org/
.. _mysql: http://www.mysql.com
.. _mariadb: http://mariadb.org
.. _net-snmp:  http://net-snmp.sourceforge.net/
.. _openldap: http://www.openldap.org/
.. _perl(ExtUtils::MakeMaker): http://search.cpan.org/dist/ExtUtils-MakeMaker/
.. _perl-devel: http://www.perl.org/
.. _postgresql: http://www.postgresql.org/
.. _tcp_wrappers: ftp://ftp.porcupine.org/pub/security/index.html
.. _transfig: http://www.xfig.org/
.. _valgrind: http://www.valgrind.org/
.. _zlib: http://zlib.net/
.. _nghttp2: https://nghttp2.org/


Install tools for building
    * ``sudo apt-get install build-essential``


Optionally install dependencies for :ref:`building the docs <contribute-docs>`.
    * ``sudo pip install python-sphinx``
    * ``sudo cpan install Pod::POM::View::Restructured``


Compile Cyrus
=============

There are additional :ref:`compile and installation steps<imapinstall-xapian>` if you are using Xapian for searching.

Default build: mail only
------------------------

.. parsed-literal::

    $ :command:`autoreconf -i`
    $ :command:`./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:

.. parsed-literal::

    # :command:`./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.

CalDAV and CardDAV
##################

    ``./configure --enable-http --enable-calalarmd``

Murder
######

    ```./configure --enable-murder``

Replication
###########

    ```./configure --enable-replication``

Compile
-------

.. code-block:: bash

    cd /path/to/cyrus-imapd

    autoreconf -i -s   # generates a configure script, and its various dependencies

    ./configure CFLAGS="-W -Wno-unused-parameter -g -O0 -Wall -Wextra -Werror -fPIC" \
    --enable-coverage --enable-calalarmd --enable-autocreate \
    --enable-nntp --enable-http --enable-unit-tests \
    --enable-replication --with-openssl=yes --enable-murder \
    --enable-idled --prefix=/usr/cyrus

    make lex-fix   # you need this if compile fails with errors from sieve/sieve.c

    make

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

It may be of use to also add ``--std=gnu99`` to the ``CFLAGS``.  That generates TONS of warnings.

Having problems with :ref:`compilation <compilationerrors>` or
:ref:`linking <linker-warnings>`?

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
-----

.. code-block:: bash

    make check    # this runs the cunit tests.

This runs the cunit tests and is used for testing that the libraries support
all the expected behaviour. If this fails, please :ref:`report it to the
cyrus-dev mailing list <feedback-mailing-lists>` with details of your source
version, operating system and affected libraries.


Next: :ref:`installing Cyrus <installing>`.

.. _FastMail : https://www.fastmail.com