[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-02 Thread Thomas Wagner via Postfix-users
> This can be verified on Solaris with:
> 
>   /usr/bin/elfdump -re 'dyn:' path/to/binary_or_library

sorry, this must read: (solaris elfedit in read-only-mode)

   /usr/bin/elfedit -re 'dyn:' path/to/binary_or_library

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-02 Thread Thomas Wagner via Postfix-users
On Thu, Nov 02, 2023 at 03:56:16AM -0400, Viktor Dukhovni via Postfix-users 
wrote:
> On Thu, Nov 02, 2023 at 09:35:47AM +0200, Jaco Lesch via Postfix-users wrote:
> 
> > > I would have tried instead:
> > > 
> > >   PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig \
> > >   make makefiles dynamicmaps=yes shared=yes \
> > >   openssl_path="/usr/openssl/3/bin/openssl" \
> > >   CC="/usr/bin/gcc -m64" \
> > >   CCARGS="-DUSE_DB -DUSE_TLS $(pkg-config --cflags libssl 
> > > libcrypto)" \
> > >   AUXLIBS="-ldb $(pkg-config --libs libssl libcrypto)" \
> > > 
> > > but, you may still also need an explicit "-R/usr/openssl/3/lib" option,
> > > if that's not part of what "pkg-config" returns for "--libs".
> > > 
> > And Viktor your options for make compile 100%, no need for the explicit
> > "-R/usr/openssl/3/lib" option. Have compiled both static and dynamic to
> > verify. Regards
> 
> Given the output of your 'pkg-config' command, the "-R" options *are*
> likely still needed.  They augment the *run-time* shared library search
> path.  The code will compile without them, but it may not run, unless
> that directly is on the system-wide search path (not expected).

This can be verified on Solaris with:

  /usr/bin/elfdump -re 'dyn:' path/to/binary_or_library

watch for lines "NEEDED" and "RUNPATH".
If missing the runpath /usr/openssl/3/lib/64/ and needed library
files libssl.so and libcrypto.so then yes, a "-R/usr/openssl/3/lib/64/" 
should be needed.


or check what the actual run would load with:
  ldd -r path/to/binary_or_library

or watch the whole lengthy search-and-load process the runtime linker
does:
  LD_DEBUG=files,libs path/to/binary

  (or even: LD_DEBUG=files,libs,bindings path/to/binary)

Even a daemon not normally called by the user should output useful
information to verify linking to correct library entities.

Regards,
Thomas

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-02 Thread Viktor Dukhovni via Postfix-users
On Thu, Nov 02, 2023 at 09:35:47AM +0200, Jaco Lesch via Postfix-users wrote:

> > I would have tried instead:
> > 
> >   PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig \
> >   make makefiles dynamicmaps=yes shared=yes \
> >   openssl_path="/usr/openssl/3/bin/openssl" \
> >   CC="/usr/bin/gcc -m64" \
> >   CCARGS="-DUSE_DB -DUSE_TLS $(pkg-config --cflags libssl 
> > libcrypto)" \
> >   AUXLIBS="-ldb $(pkg-config --libs libssl libcrypto)" \
> > 
> > but, you may still also need an explicit "-R/usr/openssl/3/lib" option,
> > if that's not part of what "pkg-config" returns for "--libs".
> > 
> And Viktor your options for make compile 100%, no need for the explicit
> "-R/usr/openssl/3/lib" option. Have compiled both static and dynamic to
> verify. Regards

Given the output of your 'pkg-config' command, the "-R" options *are*
likely still needed.  They augment the *run-time* shared library search
path.  The code will compile without them, but it may not run, unless
that directly is on the system-wide search path (not expected).

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-02 Thread Jaco Lesch via Postfix-users



On 2023/11/01 17:53, Viktor Dukhovni via Postfix-users wrote:

On Wed, Nov 01, 2023 at 12:07:31PM +0200, Jaco Lesch via Postfix-users wrote:


    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

Can you share the output you see for:

 $ export PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig
 $ pkg-config --cflags --libs libssl libcrypto


The output from pkg-config:
~$ export PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig
~$ pkg-config --cflags --libs libssl libcrypto
-I/usr/openssl/3/include -L/usr/openssl/3/lib/amd64 -lssl -lcrypto


For comparison, my build of OpenSSL 3.2 beta from stock upstream sources
(with a custom --prefix) yields:

 $ export PKG_CONFIG_PATH=/usr/local/siteexec/lib/pkgconfig
 $ pkg-config --cflags libssl libcrypto
 -I/usr/local/siteexec/include
 $ pkg-config --libs libssl libcrypto
 -L/usr/local/siteexec/lib -lssl -lcrypto


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"

I would have tried instead:

  PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig \
  make makefiles dynamicmaps=yes shared=yes \
  openssl_path="/usr/openssl/3/bin/openssl" \
  CC="/usr/bin/gcc -m64" \
  CCARGS="-DUSE_DB -DUSE_TLS $(pkg-config --cflags libssl libcrypto)" \
  AUXLIBS="-ldb $(pkg-config --libs libssl libcrypto)" \

but, you may still also need an explicit "-R/usr/openssl/3/lib" option,
if that's not part of what "pkg-config" returns for "--libs".

And Viktor your options for make compile 100%, no need for the explicit 
"-R/usr/openssl/3/lib" option. Have compiled both static and dynamic to 
verify. 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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-01 Thread Viktor Dukhovni via Postfix-users
On Wed, Nov 01, 2023 at 12:07:31PM +0200, Jaco Lesch via Postfix-users wrote:

>    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

Can you share the output you see for:

$ export PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig
$ pkg-config --cflags --libs libssl libcrypto

For comparison, my build of OpenSSL 3.2 beta from stock upstream sources
(with a custom --prefix) yields:

$ export PKG_CONFIG_PATH=/usr/local/siteexec/lib/pkgconfig
$ pkg-config --cflags libssl libcrypto
-I/usr/local/siteexec/include
$ pkg-config --libs libssl libcrypto
-L/usr/local/siteexec/lib -lssl -lcrypto

> 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"

I would have tried instead:

 PKG_CONFIG_PATH=/usr/openssl/3/lib/64/pkgconfig \
 make makefiles dynamicmaps=yes shared=yes \
 openssl_path="/usr/openssl/3/bin/openssl" \
 CC="/usr/bin/gcc -m64" \
 CCARGS="-DUSE_DB -DUSE_TLS $(pkg-config --cflags libssl libcrypto)" \
 AUXLIBS="-ldb $(pkg-config --libs libssl libcrypto)" \

but, you may still also need an explicit "-R/usr/openssl/3/lib" option,
if that's not part of what "pkg-config" returns for "--libs".

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-11-01 Thread Jaco Lesch via Postfix-users

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-10-31 Thread Wietse Venema via Postfix-users
Viktor Dukhovni via Postfix-users:
> 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).

I missed that. Yes, Solaris prefers dynamic linking. Maybe that
should now be the default build mode.

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-10-31 Thread Viktor Dukhovni via Postfix-users
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).

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


[pfx] Re: Postfix 3.8.2 compile problem in Solaris 11.4

2023-10-31 Thread Wietse Venema via Postfix-users
Jaco Lesch via Postfix-users:
> Hello
> 
> Has anyone been able to compile Postfix 3.8 on Solaris 11.4 using GCC, 
> current "gcc version 12.2.0 (GCC)", with TLS support?
> 
> Attempting to compile with the follow settings, with OpenSSL 3.0.8 
> (Library: OpenSSL 3.0.8 7 Feb 2023):
> 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 ..."

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