When trying to use a QNAP as mailserver, one can decide to use the available QNAP-provided mailservers ... whatever the benefits of this approach, it is often not sufficient. For example it is not possible, to use ldap-based authentification together with an IMAP-server.
First install ipkg. Then install a number of needed packages:
ipkg install autoconf automake bash binutils bzip2 coreutils cyrus-sasl cyrus-sasl-libs diffutils findutils \ gawk gcc gdbm gnutls gnutls-dev grep groff gzip libc-dev libdb libdb52 libgcrypt libstdc++ make man ncurses \ ncursesw openldap openldap-libs openssl openssl-dev pcre perl readline sed tar zlib
Then make sure, that '/opt/bin' and '/opt/sbin' are FIRST in $PATH
Then add freshly installed libraries to the list of available ones
echo /opt/lib >> /etc/ld.so.conf ldconfig
make distclean ./configure --prefix=/opt --with-ldap=yes --with-ssldir=/opt/etc/ssl make make install
If configure fails e.g. with a syntax-error spawn by gawk or awk, your PATH is defective and the pre-installed QNAP versions of sed or gawk are used. Please fix your path.
If make fails with an error like "object name conflicts", you probably don't have a real sort installed - or (again) your PATH is defective.
So you might want to make *sure* that sed/find/sort/(g)awk are called from the /opt-directories and not from e.g. /bin or /usr/bin.You can check which version is used by running
If everyhing is working fine - congratulations, you can now configure dovecot at /opt/etc/dovecot
And don't forget: Changes to /etc are often not permanent and need to be repeated after rebooting your QNAP. If you start a new shell (e.g. by writing a compile-script for dovecot), you probably have to redefine e.g. $PATH.