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