On 2023/10/31 17:30, Viktor Dukhovni via Postfix-users wrote:
On Tue, Oct 31, 2023 at 09:39:36AM -0400, Wietse Venema via Postfix-users wrote:

make makefiles \
          CC="/usr/bin/gcc" \
          CCARGS="-m64 -DHAS_DB -DNO_NIS -DUSE_TLS -I/usr/openssl/3/include" \
          AUXLIBS="-R/usr/openssl/3/lib -L/usr/openssl/3/lib -ldb -lssl 
-lcrypto" \
          openssl_path="/usr/openssl/3/bin/openssl"

Getting the following compilation errors:
=========================================================================
Undefined                       first referenced
   symbol                             in file
SSL_in_init ../../lib/libtls.a(tls_session.o)
[many more libssl functions missing]

Such errors are symptomatic of an include file / library file
mismatch. You appear to be compiling with the OpenSSL 3.x include
file, but linking with an older libssl version. The SSL_in_init()
function does not exist in OpenSSL 1.0.1 libssl, but it does exist
in OpenSSL 1.1.0 and later libssl.

Maybe twiddle the linker options:

AUXLIBS="-ldb -R/usr/openssl/3/lib -L/usr/openssl/3/lib -lssl ..."
I agree that the evidence points to use of older OpenSSL libraries, but
IIRC the relative of order of "-l" and "-L" options is not significant
in the linker, only the internal order within each of the two sets
matters.  All the "-L" options are taken together to form a search path,
that is then used to find all the "-l" libraries.

The issue may be related to presence or absence of the right type (
shared vs. static perhaps) on the search path, with the preferred
type found in the default locations?

Perhaps "/usr/openssl/3/lib" contains only static OpenSSL libraries?  Or
only "runtime" libraries (.so.3*).  Or the wrong machine architecture?

My advice by the way is to use dynamic not static linking.  The latter
is not recommended, especially on Solaris.  Dynamic linking is much
more adept at avoiding symbol conflics, and is better "supported" on
Solaris.

     make -f Makefile.init dynamicmaps=yes shared=yes ...

Make sure that /usr/openssl/3/lib contains usable dynamic OpenSSL
libraries, not just "runtime" (.so.3*), but also "devel" (.so).

Victor and Wietse

Thanks for the help, with the info you guys provided and the openssl.7openssl manpage I got it working. Here is the extract from the manpage, "man -M /usr/openssl/3/share/man openssl.7openssl", on building an application:

   Building an OpenSSL Application
       The development files are available in the /usr/openssl/3/ sub-directo-        ries.  To  build  an  OpenSSL application, use the following cc command
       line options:

         export PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig
         cc `pkg-config --cflags --libs libssl libcrypto` [ flag... ] file


To compile the Postix source I used the following options for make:
=================================================================================
export PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig

make makefiles dynamicmaps=yes shared=yes \
       CC="/usr/bin/gcc `pkg-config --cflags --libs libssl libcrypto`" \
       CCARGS="-m64 -DUSE_DB -DUSE_TLS -I/usr/openssl/3/include" \
       AUXLIBS="-ldb -R/usr/openssl/3/lib -L/usr/openssl/3/lib -lssl -lcrypto" \
       openssl_path="/usr/openssl/3/bin/openssl"
=================================================================================

And this links the binaries to the correct runtime libraries for OpenSSL version 3.

Regards



--
---
Jaco Lesch
SAIX HLS
Emai: ja...@saix.net

_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to