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...
Thanks Aki and Stuart for your helpful input on this. I still was not able to build the latest code from github but I'm thankful smarter people than me are making progress on this.
Joel
On Wed, 21 Jan 2026 13:31:14 +0200 (EET) Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
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
Details would be useful.
Aki
On 27/01/2026 23:33 EET Joel Mawhorter via dovecot <dovecot@dovecot.org> wrote:
Thanks Aki and Stuart for your helpful input on this. I still was not able to build the latest code from github but I'm thankful smarter people than me are making progress on this.
Joel
On Wed, 21 Jan 2026 13:31:14 +0200 (EET) Aki Tuomi <aki.tuomi@open-xchange.com> wrote:
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
dovecot mailing list -- dovecot@dovecot.org To unsubscribe send an email to dovecot-leave@dovecot.org
On 2026-01-27, Joel Mawhorter via dovecot <dovecot@dovecot.org> wrote:
Thanks Aki and Stuart for your helpful input on this. I still was not able to build the latest code from github but I'm thankful smarter people than me are making progress on this.
If you show the commands you're using to run the build, output from running 'configure', the error messages and a screenful or so of the lines from before the error, you'll have a lot better chance of getting help.
On Wed, 28 Jan 2026 10:48:07 -0000 (UTC) Stuart Henderson via dovecot <dovecot@dovecot.org> wrote:
On 2026-01-27, Joel Mawhorter via dovecot <dovecot@dovecot.org> wrote:
Thanks Aki and Stuart for your helpful input on this. I still was not able to build the latest code from github but I'm thankful smarter people than me are making progress on this.
If you show the commands you're using to run the build, output from running 'configure', the error messages and a screenful or so of the lines from before the error, you'll have a lot better chance of getting help.
Sorry if it seemed like my email was an obtuse request for help. I had just settled on compiling dovecot 2.3 on debian 13 instead of trying to get dovecot 2.4 on OpenBSD (I'm running redundant mailservers but with different OSes and not having much success with dsync between versions).
However, I'm happy to post what I did and my results:
I followed instructions on this page: https://doc.dovecot.org/main/installation/installation.html
So after checking out from git and installed pre-reqs, I did:
./autogen.sh ./configure --enable-maintainer-mode make
Build fails with this:
Making all in lib-regex CC regex.lo CCLD libdregex.la CCLD test-regex Making all in lib-var-expand make all-am CC test-var-expand.o CC expansion-parameter.lo CC expansion-statement.lo CC expansion-filter.lo CC expansion-filter-if.lo CC expansion-filter-crypt.lo CC expansion-program.lo CC var-expand.lo CC var-expand-parser.lo CCLD libvar_expand.la CCLD test-var-expand Making all in lib-dns CCLD test-dns-util Making all in lib-settings Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:1346) *** Error 1 in src (Makefile:632 'all-recursive': @fail=; if (target_option=k; case ${target_option-} in ?) ;; *) echo "am__make_running_...) *** Error 1 in . (Makefile:769 'all-recursive': @fail=; if (target_option=k; case ${target_option-} in ?) ;; *) echo "am__make_running_wi...) *** Error 2 in /home/joel/dovecot (Makefile:586 'all')
On Wed, Jan 28, 2026 at 3:05 PM Matthias Fechner via dovecot < dovecot@dovecot.org> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make on BSD you must use gmake if you want to use GNU make and not BSD make.
I tried compiling on OpenBSD7.8 too. Here is what I did:
#!/usr/bin/env bash
export AUTOCONF_VERSION=2.72 export AUTOMAKE_VERSION=1.18 export LIBTOOL=glibtool export PATH="/usr/local/bin:$PATH"
./autogen.sh &&
./configure
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2
gmake -j$(sysctl -n hw.ncpu) doas gmake install
And here is where it fails:
<cut> gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-doveadm' Making install in lib-var-expand-crypt gmake[2]: Entering directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' CCLD test-var-expand-crypt
*** Warning: Linking the executable test-var-expand-crypt against the loadable module *** var_expand_crypt.so is not portable! ld: error: unable to find library -lvar_expand_crypt cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: *** [Makefile:829: test-var-expand-crypt] Error 1 gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' gmake[1]: *** [Makefile:607: install-recursive] Error 1 gmake[1]: Leaving directory '/home/wash/Dovecot/dovecot/src' gmake: *** [Makefile:744: install-recursive] Error 1 bash-5.3$ </cut>
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
On Wed, Jan 28, 2026 at 3:05PM Matthias Fechner via dovecot <[1]dovecot@dovecot.org> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
> ./autogen.sh
> ./configure --enable-maintainer-mode
> make
on BSD you must use gmake if you want to use GNU make and not BSD make.
I tried compiling on OpenBSD7.8 too. Here is what I did: #!/usr/bin/env bash
export AUTOCONF_VERSION=2.72 export AUTOMAKE_VERSION=1.18 export LIBTOOL=glibtool export PATH="/usr/local/bin:$PATH"
./autogen.sh &&
./configure
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2
gmake -j$(sysctl -n hw.ncpu) doas gmake install And here is where it fails:
<cut> gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-doveadm' Making install in lib-var-expand-crypt gmake[2]: Entering directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' CCLD test-var-expand-crypt
*** Warning: Linking the executable test-var-expand-crypt against the loadable module *** var_expand_crypt.so is not portable! ld: error: unable to find library -lvar_expand_crypt cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[2]: *** [Makefile:829: test-var-expand-crypt] Error 1 gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' gmake[1]: *** [Makefile:607: install-recursive] Error 1 gmake[1]: Leaving directory '/home/wash/Dovecot/dovecot/src' gmake: *** [Makefile:744: install-recursive] Error 1 bash-5.3$ </cut>
Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' -\_(Tu)_/- :-) [How to ask smart questions: [2]http://www.catb.org/~esr/faqs/smart-questions.html]
References
Visible links
- mailto:dovecot@dovecot.org
- http://www.catb.org/~esr/faqs/smart-questions.html
On 2026/01/28 16:58, Washington Odhiambo wrote:
#!/usr/bin/env bash
export AUTOCONF_VERSION=2.72 export AUTOMAKE_VERSION=1.18 export LIBTOOL=glibtool export PATH="/usr/local/bin:$PATH"
./autogen.sh && ./configure
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2gmake -j$(sysctl -n hw.ncpu) doas gmake install
Bad idea to run the install as root unconditionally. If the build failed, you'll re-run part of the build again as root as a dependency of "make install".
There are various ways to avoid this; "set -e" at the top of the script is probably simplest.
And here is where it fails:
<cut> gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-doveadm' Making install in lib-var-expand-crypt gmake[2]: Entering directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' CCLD test-var-expand-crypt
*** Warning: Linking the executable test-var-expand-crypt against the loadable module *** var_expand_crypt.so is not portable! ld: error: unable to find library -lvar_expand_crypt
You'll at least need either the patchset that Aki mentioned, or git head https://github.com/dovecot/core/compare/f8dcc0ddbf877%5E...1c6b67195d279836d... and then you may also hit the problems I ran into with xapian/pcre2.
On Wed, Jan 28, 2026 at 5:20 PM Stuart Henderson <stu@spacehopper.org> wrote:
On 2026/01/28 16:58, Washington Odhiambo wrote:
#!/usr/bin/env bash
export AUTOCONF_VERSION=2.72 export AUTOMAKE_VERSION=1.18 export LIBTOOL=glibtool export PATH="/usr/local/bin:$PATH"
./autogen.sh && ./configure
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2gmake -j$(sysctl -n hw.ncpu) doas gmake install
Bad idea to run the install as root unconditionally. If the build failed, you'll re-run part of the build again as root as a dependency of "make install".
There are various ways to avoid this; "set -e" at the top of the script is probably simplest.
And here is where it fails:
<cut> gmake[2]: Leaving directory '/home/wash/Dovecot/dovecot/src/lib-doveadm' Making install in lib-var-expand-crypt gmake[2]: Entering directory '/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt' CCLD test-var-expand-crypt
*** Warning: Linking the executable test-var-expand-crypt against the loadable module *** var_expand_crypt.so is not portable! ld: error: unable to find library -lvar_expand_crypt
You'll at least need either the patchset that Aki mentioned, or git head
https://github.com/dovecot/core/compare/f8dcc0ddbf877%5E...1c6b67195d279836d... and then you may also hit the problems I ran into with xapian/pcre2.
- How do I get the 'git head'? I just cloned the repo a few hours ago?
- How did you deal with the xapian/pcre2 issue?
I suppose that's why the OP abandoned his quest for running dovecot on OpenBSD, right? Because it's not as straightforward as on Debian-based Linux.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
On Wed, Jan 28, 2026 at 5:20PM Stuart Henderson <[1]stu@spacehopper.org> wrote:
On 2026/01/28 16:58, Washington Odhiambo wrote:
> #!/usr/bin/env bash
>
> export AUTOCONF_VERSION=2.72
> export AUTOMAKE_VERSION=1.18
> export LIBTOOL=glibtool
> export PATH="/usr/local/bin:$PATH"
>
>
> ./autogen.sh &&
> ./configure \
> --enable-maintainer-mode \
> --with-sql=yes \
> --with-mysql \
> --with-pgsql \
> --enable-experimental-mail-utf8 \
> --with-pcre2
>
> gmake -j$(sysctl -n hw.ncpu)
> doas gmake install
Bad idea to run the install as root unconditionally. If the build
failed,
you'll re-run part of the build again as root as a dependency of "make
install".
There are various ways to avoid this; "set -e" at the top of the script
is probably simplest.
> And here is where it fails:
>
> <cut>
> gmake[2]: Leaving directory
'/home/wash/Dovecot/dovecot/src/lib-doveadm'
> Making install in lib-var-expand-crypt
> gmake[2]: Entering directory
'/home/wash/Dovecot/dovecot/src/lib-var-expand-crypt'
> CCLD test-var-expand-crypt
>
> *** Warning: Linking the executable test-var-expand-crypt against the
loadable module
> *** var_expand_crypt.so is not portable!
> ld: error: unable to find library -lvar_expand_crypt
You'll at least need either the patchset that Aki mentioned, or git head
[2]https://github.com/dovecot/core/compare/f8dcc0ddbf877%5E...1c6b67195d279836d94e.patch
and then you may also hit the problems I ran into with xapian/pcre2.
1. How do I get the 'git head'? I just cloned the repo a few hours ago? 2. How did you deal with the xapian/pcre2 issue? I suppose that's why the OP abandoned his quest for running dovecot on OpenBSD, right? Because it's not as straightforward as on Debian-based Linux.
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' -\_(Tu)_/- :-) [How to ask smart questions: [3]http://www.catb.org/~esr/faqs/smart-questions.html]
References
Visible links
On 2026/01/28 13:05, Matthias Fechner wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make on BSD you must use gmake if you want to use GNU make and not BSD make.
Yes you do need that if you're using a git checkout (the target to generate settings-history-core.h using $< is not compatible with BSD make). Most of the build system is however OK for OpenBSD's make (at least it used to be, and the failures seen now are the same with make or gmake).
(The other problem that Odhiambo ran into should have been fixed by https://github.com/dovecot/core/commit/1c6b67195d2798 though).
On Wed, Jan 28, 2026 at 6:54 PM Stuart Henderson via dovecot < dovecot@dovecot.org> wrote:
On 2026/01/28 13:05, Matthias Fechner wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make on BSD you must use gmake if you want to use GNU make and not BSD make.
Yes you do need that if you're using a git checkout (the target to generate settings-history-core.h using $< is not compatible with BSD make). Most of the build system is however OK for OpenBSD's make (at least it used to be, and the failures seen now are the same with make or gmake).
(The other problem that Odhiambo ran into should have been fixed by https://github.com/dovecot/core/commit/1c6b67195d2798 though).
Any reason why I still ran into the problem despite checking out HEAD?
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
On Wed, Jan 28, 2026 at 6:54PM Stuart Henderson via dovecot <[1]dovecot@dovecot.org> wrote:
On 2026/01/28 13:05, Matthias Fechner wrote:
> Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
> > ./autogen.sh
> > ./configure --enable-maintainer-mode
> > make
> on BSD you must use gmake if you want to use GNU make and not BSD
make.
Yes you do need that if you're using a git checkout (the target to
generate settings-history-core.h using $< is not compatible with BSD
make).
Most of the build system is however OK for OpenBSD's make (at least it
used to be, and the failures seen now are the same with make or gmake).
(The other problem that Odhiambo ran into should have been fixed by
[2]https://github.com/dovecot/core/commit/1c6b67195d2798 though).
Any reason why I still ran into the problem despite checking out HEAD?
Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' -\_(Tu)_/- :-) [How to ask smart questions: [3]http://www.catb.org/~esr/faqs/smart-questions.html]
References
Visible links
- mailto:dovecot@dovecot.org
- https://github.com/dovecot/core/commit/1c6b67195d2798
- http://www.catb.org/~esr/faqs/smart-questions.html
On Wed, 28 Jan 2026 13:05:20 +0100 Matthias Fechner <idefix@fechner.net> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make
on BSD you must use gmake if you want to use GNU make and not BSD make.
Thanks. That was my problem. It now seems to work with the latest from Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel with 2.3 on OpenBSD until I can get everything moved over and wonder if there is any easy way with the current Makefiles to install under somewhere else other than /usr/local/?
Joel
On Sun, Feb 1, 2026 at 3:44 AM Joel Mawhorter via dovecot < dovecot@dovecot.org> wrote:
On Wed, 28 Jan 2026 13:05:20 +0100 Matthias Fechner <idefix@fechner.net> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make on BSD you must use gmake if you want to use GNU make and not BSD make.
Thanks. That was my problem. It now seems to work with the latest from Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel with 2.3 on OpenBSD until I can get everything moved over and wonder if there is any easy way with the current Makefiles to install under somewhere else other than /usr/local/?
You can always run ./configure --prefix=/SOME/OTHER/PATH, e.g. --prefix=/opt/ Why don't you run the other one in a VM?
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
On Sun, Feb 1, 2026 at 3:44AM Joel Mawhorter via dovecot <[1]dovecot@dovecot.org> wrote:
On Wed, 28 Jan 2026 13:05:20 +0100
Matthias Fechner <[2]idefix@fechner.net> wrote:
> Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
> > ./autogen.sh
> > ./configure --enable-maintainer-mode
> > make
> on BSD you must use gmake if you want to use GNU make and not BSD
make.
Thanks. That was my problem. It now seems to work with the latest from
Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel
with 2.3 on OpenBSD until I can get everything moved over and wonder if
there is any easy way with the current Makefiles to install under
somewhere else other than /usr/local/?
You can always run ./configure --prefix=/SOME/OTHER/PATH, e.g. --prefix=/opt/ Why don't you run the other one in a VM?
Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' -\_(Tu)_/- :-) [How to ask smart questions: [3]http://www.catb.org/~esr/faqs/smart-questions.html]
References
Visible links
- mailto:dovecot@dovecot.org
- mailto:idefix@fechner.net
- http://www.catb.org/~esr/faqs/smart-questions.html
On Sun, 1 Feb 2026 11:45:54 +0300 Washington Odhiambo <odhiambo@gmail.com> wrote:
On Sun, Feb 1, 2026 at 3:44 AM Joel Mawhorter via dovecot < dovecot@dovecot.org> wrote:
On Wed, 28 Jan 2026 13:05:20 +0100 Matthias Fechner <idefix@fechner.net> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make
on BSD you must use gmake if you want to use GNU make and not BSD make.Thanks. That was my problem. It now seems to work with the latest from Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel with 2.3 on OpenBSD until I can get everything moved over and wonder if there is any easy way with the current Makefiles to install under somewhere else other than /usr/local/?
You can always run ./configure --prefix=/SOME/OTHER/PATH, e.g. --prefix=/opt/ Why don't you run the other one in a VM?
Oddly, when I compile the latest Github HEAD branch after ¨./configure" without any options, everything builds fine. If I compile after "./configure --prefix=/opt/dovecot", I get the following build error:
gmake[3]: Entering directory '/home/joel/dovecot/src/lib-charset' CC charset-iconv.lo charset-iconv.c:7:10: fatal error: 'iconv.h' file not found 7 | #include <iconv.h> | ^~~~~~~~~ 1 error generated. gmake[3]: *** [Makefile:810: charset-iconv.lo] Error 1 gmake[3]: Leaving directory '/home/joel/dovecot/src/lib-charset' gmake[2]: *** [Makefile:607: all-recursive] Error 1 gmake[2]: Leaving directory '/home/joel/dovecot/src' gmake[1]: *** [Makefile:744: all-recursive] Error 1 gmake[1]: Leaving directory '/home/joel/dovecot' gmake: *** [Makefile:586: all] Error 2
On Sun, Feb 1, 2026 at 2:44 PM Joel Mawhorter via dovecot < dovecot@dovecot.org> wrote:
On Sun, 1 Feb 2026 11:45:54 +0300 Washington Odhiambo <odhiambo@gmail.com> wrote:
On Sun, Feb 1, 2026 at 3:44 AM Joel Mawhorter via dovecot < dovecot@dovecot.org> wrote:
On Wed, 28 Jan 2026 13:05:20 +0100 Matthias Fechner <idefix@fechner.net> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make on BSD you must use gmake if you want to use GNU make and not BSD make.
Thanks. That was my problem. It now seems to work with the latest from Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel with 2.3 on OpenBSD until I can get everything moved over and wonder if there is any easy way with the current Makefiles to install under somewhere else other than /usr/local/?
You can always run ./configure --prefix=/SOME/OTHER/PATH, e.g. --prefix=/opt/ Why don't you run the other one in a VM?
Oddly, when I compile the latest Github HEAD branch after ¨./configure" without any options, everything builds fine. If I compile after "./configure --prefix=/opt/dovecot", I get the following build error:
gmake[3]: Entering directory '/home/joel/dovecot/src/lib-charset' CC charset-iconv.lo charset-iconv.c:7:10: fatal error: 'iconv.h' file not found 7 | #include <iconv.h> | ^~~~~~~~~ 1 error generated. gmake[3]: *** [Makefile:810: charset-iconv.lo] Error 1 gmake[3]: Leaving directory '/home/joel/dovecot/src/lib-charset' gmake[2]: *** [Makefile:607: all-recursive] Error 1 gmake[2]: Leaving directory '/home/joel/dovecot/src' gmake[1]: *** [Makefile:744: all-recursive] Error 1 gmake[1]: Leaving directory '/home/joel/dovecot' gmake: *** [Makefile:586: all] Error 2
That's expected. Autoconf switches to prefix-relative include/library probing and stops checking the base system paths correctly for some feature tests (including iconv). As a result:
HAVE_ICONV is misdetected lib-charset is still built
but iconv.h is no longer in the compiler’s active include set during sub-builds That’s why the failure only appears with --prefix=/opt/dovecot.
I was able to reproduce that failure, and resolved it by: export CPPFLAGS="-I/usr/include" export LDFLAGS="-L/usr/lib"
./configure
--prefix=/opt/dovecot
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2
--disable-static
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
On Sun, Feb 1, 2026 at 2:44PM Joel Mawhorter via dovecot <[1]dovecot@dovecot.org> wrote:
On Sun, 1 Feb 2026 11:45:54 +0300
Washington Odhiambo <[2]odhiambo@gmail.com> wrote:
> On Sun, Feb 1, 2026 at 3:44AM Joel Mawhorter via dovecot <
> [3]dovecot@dovecot.org> wrote:
>
> > On Wed, 28 Jan 2026 13:05:20 +0100
> > Matthias Fechner <[4]idefix@fechner.net> wrote:
> >
> > > Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
> > > > ./autogen.sh
> > > > ./configure --enable-maintainer-mode
> > > > make
> > > on BSD you must use gmake if you want to use GNU make and not BSD
make.
> >
> > Thanks. That was my problem. It now seems to work with the latest
from
> > Github on OpenBSD 7.8. Thanks to everyone for your help.
> >
> > One more quick question. I'm planning to try to install 2.4 in
parallel
> > with 2.3 on OpenBSD until I can get everything moved over and wonder
if
> > there is any easy way with the current Makefiles to install under
somewhere
> > else other than /usr/local/?
> >
>
> You can always run ./configure --prefix=/SOME/OTHER/PATH,
> e.g. --prefix=/opt/
> Why don't you run the other one in a VM?
>
>
Oddly, when I compile the latest Github HEAD branch after "./configure"
without any options, everything builds fine. If I compile after
"./configure --prefix=/opt/dovecot", I get the following build error:
gmake[3]: Entering directory '/home/joel/dovecot/src/lib-charset'
CC charset-iconv.lo
charset-iconv.c:7:10: fatal error: 'iconv.h' file not found
7 | #include <iconv.h>
| ^~~~~~~~~
1 error generated.
gmake[3]: *** [Makefile:810: charset-iconv.lo] Error 1
gmake[3]: Leaving directory '/home/joel/dovecot/src/lib-charset'
gmake[2]: *** [Makefile:607: all-recursive] Error 1
gmake[2]: Leaving directory '/home/joel/dovecot/src'
gmake[1]: *** [Makefile:744: all-recursive] Error 1
gmake[1]: Leaving directory '/home/joel/dovecot'
gmake: *** [Makefile:586: all] Error 2
That's expected. Autoconf switches to prefix-relative include/library probing and stops checking the base system paths correctly for some feature tests (including iconv). As a result:
HAVE_ICONV is misdetected lib-charset is still built
but iconv.h is no longer in the compiler's active include set during sub-builds That's why the failure only appears with --prefix=/opt/dovecot. I was able to reproduce that failure, and resolved it by: export CPPFLAGS="-I/usr/include" export LDFLAGS="-L/usr/lib"
./configure
--prefix=/opt/dovecot
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2
--disable-static
Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 In an Internet failure case, the #1 suspect is a constant: DNS. "Oh, the cruft.", egrep -v '^$|^.*#' -\_(Tu)_/- :-) [How to ask smart questions: [5]http://www.catb.org/~esr/faqs/smart-questions.html]
References
Visible links
- mailto:dovecot@dovecot.org
- mailto:odhiambo@gmail.com
- mailto:dovecot@dovecot.org
- mailto:idefix@fechner.net
- http://www.catb.org/~esr/faqs/smart-questions.html
On Sun, 1 Feb 2026 15:28:39 +0300 Washington Odhiambo <odhiambo@gmail.com> wrote:
On Sun, Feb 1, 2026 at 2:44 PM Joel Mawhorter via dovecot < dovecot@dovecot.org> wrote:
On Sun, 1 Feb 2026 11:45:54 +0300 Washington Odhiambo <odhiambo@gmail.com> wrote:
On Sun, Feb 1, 2026 at 3:44 AM Joel Mawhorter via dovecot <
dovecot@dovecot.org> wrote:On Wed, 28 Jan 2026 13:05:20 +0100 Matthias Fechner <idefix@fechner.net> wrote:
Am 28.01.2026 um 12:58 schrieb Joel Mawhorter via dovecot:
./autogen.sh ./configure --enable-maintainer-mode make
on BSD you must use gmake if you want to use GNU make and not BSD
make.Thanks. That was my problem. It now seems to work with the latest from Github on OpenBSD 7.8. Thanks to everyone for your help.
One more quick question. I'm planning to try to install 2.4 in parallel with 2.3 on OpenBSD until I can get everything moved over and wonder if there is any easy way with the current Makefiles to install under
somewhere
else other than /usr/local/?You can always run ./configure --prefix=/SOME/OTHER/PATH, e.g. --prefix=/opt/ Why don't you run the other one in a VM?
Oddly, when I compile the latest Github HEAD branch after ¨./configure" without any options, everything builds fine. If I compile after "./configure --prefix=/opt/dovecot", I get the following build error:
gmake[3]: Entering directory '/home/joel/dovecot/src/lib-charset' CC charset-iconv.lo charset-iconv.c:7:10: fatal error: 'iconv.h' file not found 7 | #include <iconv.h> | ^~~~~~~~~ 1 error generated. gmake[3]: *** [Makefile:810: charset-iconv.lo] Error 1 gmake[3]: Leaving directory '/home/joel/dovecot/src/lib-charset' gmake[2]: *** [Makefile:607: all-recursive] Error 1 gmake[2]: Leaving directory '/home/joel/dovecot/src' gmake[1]: *** [Makefile:744: all-recursive] Error 1 gmake[1]: Leaving directory '/home/joel/dovecot' gmake: *** [Makefile:586: all] Error 2
That's expected. Autoconf switches to prefix-relative include/library probing and stops checking the base system paths correctly for some feature tests (including iconv). As a result:
HAVE_ICONV is misdetected lib-charset is still built
but iconv.h is no longer in the compiler’s active include set during sub-builds That’s why the failure only appears with --prefix=/opt/dovecot.
I was able to reproduce that failure, and resolved it by: export CPPFLAGS="-I/usr/include" export LDFLAGS="-L/usr/lib"
./configure
--prefix=/opt/dovecot
--enable-maintainer-mode
--with-sql=yes
--with-mysql
--with-pgsql
--enable-experimental-mail-utf8
--with-pcre2
--disable-static
Thanks for looking into this. Your solution makes sense to me. However, I was not able to reproduce your fix using the same exported variables and configure parameters. It still failed not able to find iconv.h. For me, iconv.h is in /usr/local/include so I added that to the CPPFLAGS and /usr/local/lib to LDFLAGS and got past the previous problem and now I have this build problem:
gmake[3]: Entering directory '/home/joel/dovecot/src/lib-var-expand-crypt' CC test_var_expand_crypt-test-var-expand-crypt.o CC var-expand-crypt.lo CCLD var_expand_crypt.la CCLD test-var-expand-crypt
*** Warning: Linking the executable test-var-expand-crypt against the loadable module *** var_expand_crypt.so is not portable! ld: error: unable to find library -lvar_expand_crypt cc: error: linker command failed with exit code 1 (use -v to see invocation) gmake[3]: *** [Makefile:829: test-var-expand-crypt] Error 1 gmake[3]: Leaving directory '/home/joel/dovecot/src/lib-var-expand-crypt' gmake[2]: *** [Makefile:607: all-recursive] Error 1 gmake[2]: Leaving directory '/home/joel/dovecot/src' gmake[1]: *** [Makefile:744: all-recursive] Error 1 gmake[1]: Leaving directory '/home/joel/dovecot' gmake: *** [Makefile:586: all] Error 2
It seems this is the same error that Stuart got earlier that I think was fixed by the patch Aki did so I'm not sure what to do about that.
Joel
participants (6)
-
Aki Tuomi
-
Joel Mawhorter
-
Matthias Fechner
-
Stuart Henderson
-
Stuart Henderson
-
Washington Odhiambo