Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)

From: Darek Ślusarczyk <dslusarczyk(at)splunk(dot)com>
To: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Daniel Gustafsson <daniel(at)yesql(dot)se>
Subject: Re: add support for the old naming libs convention on windows (ssleay32.lib and libeay32.lib)
Date: 2025-01-07 18:25:08
Message-ID: CAHrt6663W9qjpxXsnUbYdGL45xGLMdAjOc9c0TEf50NyFpZxKQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

Thanks for reviewing the patch - I've added a few changes and it looks as
follows:

diff --git a/meson.build b/meson.build
index e5ce437a5c7..37d4e9ca741 100644
--- a/meson.build
+++ b/meson.build
@@ -1343,14 +1343,41 @@ if sslopt in ['auto', 'openssl']

# via library + headers
if not ssl.found()
+ is_windows = host_system == 'windows'
+
+ ssl_lib_common_params = {
+ 'dirs': test_lib_d,
+ 'header_include_directories': postgres_inc,
+ 'has_headers': ['openssl/ssl.h', 'openssl/err.h'],
+ }
ssl_lib = cc.find_library('ssl',
- dirs: test_lib_d,
- header_include_directories: postgres_inc,
- has_headers: ['openssl/ssl.h', 'openssl/err.h'],
- required: openssl_required)
+ kwargs: ssl_lib_common_params,
+ required: openssl_required and not is_windows
+ )
+ # before openssl version 1.1.0, there was a different naming
convention for libraries on win
+ # the counterpart for libssl.[lib|dll] was ssleay32.[lib|dll]
+ # more details in
https://github.com/openssl/openssl/issues/10332#issuecomment-549027653
+ # hence if 'ssl' is not found and it's windows, try 'ssleay32'
+ if not ssl_lib.found() and is_windows
+ ssl_lib = cc.find_library('ssleay32',
+ kwargs: ssl_lib_common_params,
+ required: openssl_required
+ )
+ endif
+
crypto_lib = cc.find_library('crypto',
dirs: test_lib_d,
- required: openssl_required)
+ required: openssl_required and not is_windows)
+ # before openssl version 1.1.0, there was a different naming
convention for libraries on win
+ # the counterpart for libcrypto.[lib|dll] was libeay32.[lib|dll]
+ # more details in
https://github.com/openssl/openssl/issues/10332#issuecomment-549027653
+ # hence if 'crypto' is not found and it's windows, try 'libeay32'
+ if not crypto_lib.found() and is_windows
+ crypto_lib = cc.find_library('libeay32',
+ dirs: test_lib_d,
+ required: openssl_required)
+ endif
+
if ssl_lib.found() and crypto_lib.found()
ssl_int = [ssl_lib, crypto_lib]
ssl = declare_dependency(dependencies: ssl_int, include_directories:
postgres_inc)

btw I also submitted a pull request on GitHub, which can be found here:
https://github.com/postgres/postgres/pull/197

thnx,
ds
--
marines() {
return Darek_Slusarczyk;
}

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Mahendra Singh Thalor 2025-01-07 19:04:47 Re: Non-text mode for pg_dumpall
Previous Message Thomas Munro 2025-01-07 18:21:42 Re: Meson bug in detection of 64 atomics