Hi there,

i try to install dovecot from source with the following configuration:
./configure --prefix=/test/core/dovecot --with-ssldir=/test/core/dovecot/tls

the configuration runs fine with the following output at the end:
Install prefix . : /test/core/dovecot
File offsets ... : 64bit
I/O polling .... : epoll
I/O notifys .... : inotify
SSL ............ : yes (OpenSSL)
GSSAPI ......... : no
passdbs ........ : static passwd passwd-file shadow checkpassword
                 : -pam -bsdauth -ldap -sql
userdbs ........ : static prefetch passwd passwd-file checkpassword
                 : -ldap -sql
CFLAGS ......... : -std=gnu99 -g -O2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -I/test/dep/openssl/include
SYSTEMD ........ : notify - /lib/systemd/system/dovecot.service
SQL drivers .... :
                 : -pgsql -mysql -sqlite -cassandra
Full text search : squat
                 : -lucene -solr

But when i start to build (make) after a while i get the following error:
*** Warning: Linking the executable test-iostream-ssl against the loadable module
*** libssl_iostream_openssl.so is not portable!
libtool: link: gcc -std=gnu99 -g -O2 -fstack-protector-strong -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -mfunction-return=keep -mindirect-branch=keep -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast -fno-builtin-strftime -Wstrict-aliasing=2 -I/test/dep/openssl/include -o .libs/test-iostream-ssl test-iostream-ssl.o  ./.libs/libssl_iostream_openssl.so ./.libs/libssl_iostream.a ../lib-test/.libs/libtest.a ../lib/.libs/liblib.a -L/test/dep/openssl/lib64 -lssl -lcrypto -ldl -Wl,-rpath -Wl,/test/core/dovecot/lib/dovecot
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `ERR_free_strings'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `ENGINE_cleanup'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `SSL_library_init'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `OBJ_cleanup'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `CRYPTO_cleanup_all_ex_data'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `OpenSSL_add_all_algorithms'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `SSL_CTX_set_tmp_rsa_callback'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `EVP_cleanup'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `SSL_load_error_strings'
/usr/bin/ld: ./.libs/libssl_iostream_openssl.so: undefined reference to `SSL_CTX_need_tmp_RSA'
collect2: error: ld returned 1 exit status
make[3]: *** [Makefile:655: test-iostream-ssl] Error 1
make[3]: Leaving directory '/test/tmp/dovecot-2.3.17.1/src/lib-ssl-iostream'
make[2]: *** [Makefile:573: all-recursive] Error 1
make[2]: Leaving directory '/test/tmp/dovecot-2.3.17.1/src'
make[1]: *** [Makefile:702: all-recursive] Error 1
make[1]: Leaving directory '/test/tmp/dovecot-2.3.17.1'
make: *** [Makefile:546: all] Error 2

I've searched for the error and find some posts about set explicitly CPPFLAGS and LDFLAGS
and something about missing shared libraries of openssl.

My openssl have shared libraries (libcrypto.so libssl.so ...) and the explicit use of CPPFLAGS and LDFLAGS to my openssl hasn't changed anything

I use Openssl 3.0 but i've tested also 1.1.1m and 1.1.1g for example, same error!
Dovecot is the latest 2.3.17.1
My OS is Ubuntu 21.04

Can anyone help me with this please?
Thanks!