Compiling Dovecot 2.4 on OpenBSD
I'm writing to see if anyone has had success compiling Dovecot 2.4 on OpenBSD. I can't seem to find any documentation that lists prerequisites. At the moment, the 2.4.2 source tarball from the Dovecot site does not seem to compile on my OpenBSD 7.8 system and the error message is not very helpful. I'm unsure if this is just a problem of some required package not being installed. If anyone could point me to info to help move forward, I would appreciate that.
Joel
On 2026-01-18, Joel Mawhorter via dovecot <dovecot@dovecot.org> wrote:
I'm writing to see if anyone has had success compiling Dovecot 2.4 on OpenBSD. I can't seem to find any documentation that lists prerequisites. At the moment, the 2.4.2 source tarball from the Dovecot site does not seem to compile on my OpenBSD 7.8 system and the error message is not very helpful. I'm unsure if this is just a problem of some required package not being installed. If anyone could point me to info to help move forward, I would appreciate that.
Even if the error message is not helpful to you, somebody else might be able to make more of it.
Some of the problems seen in 2.4.2 on openbsd:
- building test-regex fails, it expects "pkg-config --libs libpcre2-32" to return just libraries but on OpenBSD there's also -L/usr/local/lib
/usr/bin/libtool --tag=CC --mode=compile cc -DHAVE_CONFIG_H -I. -I../.. -I../../src/lib -I../../src/lib-test -I../../src/lib-dict -I../../src/lib-doveadm -I../../src/lib-dns-client -I../../src/lib-http -I../../src/lib-ssl-iostream -I../../src/lib-settings -I../../src/lib-master -I../../src/lib-var-expand -I/usr/local/include -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -std=gnu11 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wno-duplicate-decl-specifier -Wstrict-aliasing=2 -O2 -pipe -g -MT regex.lo -MD -MP -MF .deps/regex.Tpo -c -o regex.lo regex.c gmake[3]: *** No rule to make target '-L/usr/local/lib', needed by 'test-regex'. Stop.
this can be worked-around (sort-of) by running configure --without-pcre2
- lib-charset uses iconv_open(), iconv_close() without checking if they're available; on OpenBSD these functions are in libiconv not libc, so it needs to link against -liconv. can be worked-around by running configure with the following in the environment:
CPPFLAGS="-I/usr/local/include" LDFLAGS="-L/usr/local/lib -liconv"
- there's some issue with var_expand_crypt, not sure how to deal with that. this is with openbsd's own version of libtool but there's a similar problem with gnu libtool.
/usr/bin/libtool --tag=CC --mode=link cc -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -std=gnu11 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wno-duplicate-decl-specifier -Wstrict-aliasing=2 -DDCRYPT_BUILD_DIR=\"../../src/lib-dcrypt\" -O2 -pipe -g -export-dynamic -Wl,--whole-archive,../lib/.libs/liblib.a,../lib-json/.libs/libjson.a,../lib-ssl-iostream/.libs/libssl_iostream.a,--no-whole-archive -L/usr/local/lib -liconv -o test-var-expand-crypt test_var_expand_crypt-test-var-expand-crypt.o var_expand_crypt.la ../lib-dcrypt/libdcrypt.la ../lib-var-expand/libvar_expand.la ../lib-regex/libdregex.la ../lib-json/libjson.la ../lib-settings/libsettings.la ../lib-dns/libdns.la ../lib-test/libtest.la ../lib/liblib.la warning: cannot derive -l flag from library filename /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-var-expand-crypt/.libs/var_expand_crypt.so, assuming hash key -lvar_expand_crypt libtool: link: cc -o .libs/test-var-expand-crypt -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -std=gnu11 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -Wno-duplicate-decl-specifier -Wstrict-aliasing=2 -DDCRYPT_BUILD_DIR="../../src/lib-dcrypt" -O2 -pipe -g -Wl,--whole-archive -Wl,../lib/.libs/liblib.a -Wl,../lib-json/.libs/libjson.a -Wl,../lib-ssl-iostream/.libs/libssl_iostream.a -Wl,--no-whole-archive -Wl,-E test_var_expand_crypt-test-var-expand-crypt.o /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-dcrypt/.libs/libdcrypt.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-var-expand/.libs/libvar_expand.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-regex/.libs/libdregex.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-json/.libs/libjson.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-settings/.libs/libsettings.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4 .2/src/lib-dns/.libs/libdns.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib-test/.libs/libtest.a /usr/obj/ports/dovecot-2.4.2/dovecot-2.4.2/src/lib/.libs/liblib.a -L.libs -liconv -lvar_expand_crypt -lm -Wl,-rpath,/usr/local/lib/dovecot,-rpath-link,/usr/local/lib ld: error: unable to find library -lvar_expand_crypt
(I haven't spent very long trying to find a fix for that; due to some of the policy decisions made in dovecot I'm going to have a hard time updating past 2.3.x).
On 19/01/2026 22:07 EET Stuart Henderson via dovecot <dovecot@dovecot.org> wrote:
On 2026-01-18, Joel Mawhorter via dovecot <dovecot@dovecot.org> wrote:
I'm writing to see if anyone has had success compiling Dovecot 2.4 on OpenBSD. I can't seem to find any documentation that lists prerequisites. At the moment, the 2.4.2 source tarball from the Dovecot site does not seem to compile on my OpenBSD 7.8 system and the error message is not very helpful. I'm unsure if this is just a problem of some required package not being installed. If anyone could point me to info to help move forward, I would appreciate that.
Even if the error message is not helpful to you, somebody else might be able to make more of it.
Some of the problems seen in 2.4.2 on openbsd:
- building test-regex fails, it expects "pkg-config --libs libpcre2-32" to return just libraries but on OpenBSD there's also -L/usr/local/lib
Hi!
I testbuilt dovecot on openbsd 7.7, and was able to fix some of the issues. I didn't run into the test-regex problem though. Please see
https://github.com/dovecot/core/compare/f8dcc0ddbf8772f89d4bb3650a95aa98ab3b...
Aki
On 2026/01/21 13:31, Aki Tuomi wrote:
I testbuilt dovecot on openbsd 7.7, and was able to fix some of the issues. I didn't run into the test-regex problem though. Please see
https://github.com/dovecot/core/compare/f8dcc0ddbf8772f89d4bb3650a95aa98ab3b...
That does help.
You'll see the test-regex problem if you pkg_add pcre2 before building. Same occurs whether autoconf auto-detects the library path or whether you set it yourself via LDFLAGS when running configure.
There's also an issue if you pkg_add xapian-core and don't disable flatcurve; xapian/error.h wants to pull in the C++ <version> header, but presence of the "version" file in Dovecot's source tree (pulled in via -I flags) shadows it, resulting in the error below. This is not seen if you do an out-of-source-tree build.
In file included from fts-backend-flatcurve-xapian.cc:30: In file included from /usr/local/include/xapian.h:56: In file included from /usr/local/include/xapian/error.h:30: In file included from /usr/include/c++/v1/string:589: In file included from /usr/include/c++/v1/__algorithm/max.h:14: In file included from /usr/include/c++/v1/__algorithm/max_element.h:15: In file included from /usr/include/c++/v1/__iterator/iterator_traits.h:14: In file included from /usr/include/c++/v1/__concepts/constructible.h:13: In file included from /usr/include/c++/v1/__concepts/destructible.h:13: In file included from /usr/include/c++/v1/__type_traits/is_nothrow_destructible.h:14: In file included from /usr/include/c++/v1/__type_traits/is_destructible.h:16: In file included from /usr/include/c++/v1/__type_traits/remove_all_extents.h:13: In file included from /usr/include/c++/v1/cstddef:40: ../../../version:1:1: error: expected unqualified-id 1 | 2.4.2 | ^ <...snip repeats...> fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. Error while executing c++ -DHAVE_CONFIG_H -I. -I../../.. -I../../../src/lib -I../../../src/lib-ssl-iostream -I../../../src/lib-http -I../../../src/lib-mail -I../../../src/lib-imap -I../../../src/lib-index -I../../../src/lib-settings -I../../../src/lib-storage -I../../../src/lib-doveadm -I../../../src/lib-var-expand -I../../../src/doveadm -I../../../src/plugins/fts -I/usr/local/include -I/usr/local/include -O2 -pipe -g -MT fts-backend-flatcurve-xapian.lo -MD -MP -MF .deps/fts-backend-flatcurve-xapian.Tpo -c fts-backend-flatcurve-xapian.cc -fPIC -DPIC -o .libs/fts-backend-flatcurve-xapian.o
On 21/01/2026 19:39 EET Stuart Henderson via dovecot
<[1]dovecot@dovecot.org> wrote:
On 2026/01/21 13:31, Aki Tuomi wrote:
I testbuilt dovecot on openbsd 7.7, and was able to fix some of the
issues. I didn't run into the test-regex problem though. Please see
[2]https://github.com/dovecot/core/compare/f8dcc0ddbf8772f89d4bb3650a95aa98ab3b0907%5E...1c6b67195d279836d94e141215c626c20af93af6.patch
That does help.
You'll see the test-regex problem if you pkg_add pcre2 before building.
Same occurs whether autoconf auto-detects the library path or whether
you set it yourself via LDFLAGS when running configure.
There's also an issue if you pkg_add xapian-core and don't disable
flatcurve; xapian/error.h wants to pull in the C++ <version> header,
but presence of the "version" file in Dovecot's source tree (pulled
in via -I flags) shadows it, resulting in the error below. This is
not seen if you do an out-of-source-tree build.
I did install pcre2 before and saw it being detected by configure. I'll check the version thing, oddly it does not impact anything on Linux.
Aki
References
Visible links
- mailto:dovecot@dovecot.org
- https://github.com/dovecot/core/compare/f8dcc0ddbf8772f89d4bb3650a95aa98ab3b...
participants (3)
-
Aki Tuomi
-
Joel Mawhorter
-
Stuart Henderson