Re: [ovs-dev] [PATCH v2 3/4] m4: Fix linking with OpenSSL 1.1.0+ and 3+ on Windows.

2024-03-04 Thread Simon Horman
On Fri, Mar 01, 2024 at 10:10:39PM +0100, Ilya Maximets wrote:
> OpenSSL 1.1.0 changed the library names from libeay32 and ssleay32 to
> standard libssl and libcrypto.  All the versions of OpenSSL that used
> old names reached their official EoL, so it should be safe to just
> migrate to new names.  They can still be supported via premium support
> option, but I don't think that is important for us.
> 
> Also, OpenSSL installers for older versions had the following folder
> structure:
> 
>   C:\OPENSSL-WIN64\
>   +---bin
>   +---include
>   |   +---openssl
>   +---lib
>   |   libeay32.lib
>   |   ssleay32.lib
>   +---VC
>   libeay32MD.lib
>   libeay32MDd.lib
>   libeay32MT.lib
>   libeay32MTd.lib
>   ssleay32MD.lib
>   ssleay32MDd.lib
>   ssleay32MT.lib
>   ssleay32MTd.lib
> 
> With newer OpenSSL 3+ the structure is different:
> 
>   C:\OPENSSL-WIN64
>   +---bin
>   +---include
>   |   +---openssl
>   +---lib
>   +---VC
>   +---x64
>   +---MD
>   |   libcrypto.lib
>   |   libssl.lib
>   +---MDd
>   |   libcrypto.lib
>   |   libssl.lib
>   +---MT
>   |   libcrypto.lib
>   |   libssl.lib
>   +---MTd
>   libcrypto.lib
>   libssl.lib
> 
> Basically, instead of one generic library in the lib folder and a bunch
> of differently named versions of it for different type of linkage, we
> now have multiple instances of the library located in different folders
> based on the linkage type.  So, we have to provide an exact path in
> order to find the library.
> 
> 'lib/VC/x64/MT' was chosen in this patch since it is a way used for
> building in build-aux/ccl.
> MD stands for dynamic linking, MT is static, 'd' stands for debug
> versions of the libraries.
> 
> While at it, fixing documentation examples to point to Win64 default
> installation folder.
> 
> Signed-off-by: Ilya Maximets 

Acked-by: Simon Horman 

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev


[ovs-dev] [PATCH v2 3/4] m4: Fix linking with OpenSSL 1.1.0+ and 3+ on Windows.

2024-03-01 Thread Ilya Maximets
OpenSSL 1.1.0 changed the library names from libeay32 and ssleay32 to
standard libssl and libcrypto.  All the versions of OpenSSL that used
old names reached their official EoL, so it should be safe to just
migrate to new names.  They can still be supported via premium support
option, but I don't think that is important for us.

Also, OpenSSL installers for older versions had the following folder
structure:

  C:\OPENSSL-WIN64\
  +---bin
  +---include
  |   +---openssl
  +---lib
  |   libeay32.lib
  |   ssleay32.lib
  +---VC
  libeay32MD.lib
  libeay32MDd.lib
  libeay32MT.lib
  libeay32MTd.lib
  ssleay32MD.lib
  ssleay32MDd.lib
  ssleay32MT.lib
  ssleay32MTd.lib

With newer OpenSSL 3+ the structure is different:

  C:\OPENSSL-WIN64
  +---bin
  +---include
  |   +---openssl
  +---lib
  +---VC
  +---x64
  +---MD
  |   libcrypto.lib
  |   libssl.lib
  +---MDd
  |   libcrypto.lib
  |   libssl.lib
  +---MT
  |   libcrypto.lib
  |   libssl.lib
  +---MTd
  libcrypto.lib
  libssl.lib

Basically, instead of one generic library in the lib folder and a bunch
of differently named versions of it for different type of linkage, we
now have multiple instances of the library located in different folders
based on the linkage type.  So, we have to provide an exact path in
order to find the library.

'lib/VC/x64/MT' was chosen in this patch since it is a way used for
building in build-aux/ccl.
MD stands for dynamic linking, MT is static, 'd' stands for debug
versions of the libraries.

While at it, fixing documentation examples to point to Win64 default
installation folder.

Signed-off-by: Ilya Maximets 
---
 Documentation/intro/install/windows.rst | 6 +++---
 m4/ax_check_openssl.m4  | 3 ++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/Documentation/intro/install/windows.rst 
b/Documentation/intro/install/windows.rst
index fce099d5d..efdb8aebc 100644
--- a/Documentation/intro/install/windows.rst
+++ b/Documentation/intro/install/windows.rst
@@ -112,7 +112,7 @@ The following explains the steps in some detail.
   `OpenSSL for Windows `__
 
   Note down the directory where OpenSSL is installed (e.g.:
-  ``C:/OpenSSL-Win32``) for later use.
+  ``C:/OpenSSL-Win64``) for later use.
 
 .. note::
 
@@ -182,7 +182,7 @@ To configure with SSL support, add the requisite additional 
options:
--localstatedir="C:/openvswitch/var"
--sysconfdir="C:/openvswitch/etc" \
--with-pthread="C:/pthread" \
-   --enable-ssl --with-openssl="C:/OpenSSL-Win32"
+   --enable-ssl --with-openssl="C:/OpenSSL-Win64"
 
 Finally, to the kernel module also:
 
@@ -194,7 +194,7 @@ Finally, to the kernel module also:
--localstatedir="C:/openvswitch/var" \
--sysconfdir="C:/openvswitch/etc" \
--with-pthread="C:/pthread" \
-   --enable-ssl --with-openssl="C:/OpenSSL-Win32" \
+   --enable-ssl --with-openssl="C:/OpenSSL-Win64" \
--with-vstudiotarget="" \
--with-vstudiotargetver=""
 
diff --git a/m4/ax_check_openssl.m4 b/m4/ax_check_openssl.m4
index 281d4dc65..faa5babde 100644
--- a/m4/ax_check_openssl.m4
+++ b/m4/ax_check_openssl.m4
@@ -81,7 +81,8 @@ AC_DEFUN([AX_CHECK_OPENSSL], [
 SSL_INCLUDES="-I$ssldir/include"
 SSL_LDFLAGS="-L$ssldir/lib"
 if test "$WIN32" = "yes"; then
-SSL_LIBS="-lssleay32 -llibeay32"
+SSL_LDFLAGS="$SSL_LDFLAGS -L$ssldir/lib/VC/x64/MT"
+SSL_LIBS="-llibssl -llibcrypto"
 SSL_DIR=/$(echo ${ssldir} | ${SED} -e 's/://')
 else
 SSL_LIBS="-lssl -lcrypto"
-- 
2.43.0

___
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev