1

I am trying to compile libpq 17.5 on Windows 11 linking against my own build openssl 3.5.0.

When running the meson setup command it only finds openssl 3.3.0 from Strawberry perl. I tried to put my own openssl in the path but it still fails and only finds the 3.3.0 that is shipped with Strawberry Perl.

My command it this:

C:\src\pq>meson setup build -Dldap=disabled -Dnls=disabled -Dplperl=disabled -Dplpython=disabled -Dpltcl=disabled -Dllvm=disabled -Dicu=disabled -Dlz4=disabled -Dzstd=disabled -Dgssapi=disabled -Dpam=disabled -Dbsd_auth=disabled -Dsystemd=disabled -Dbonjour=disabled -Dlibxml=disabled -Dlibxslt=disabled -Dselinux=disabled -Dssl=openssl -Dextra_include_dirs="C:\src\openssl\install\include" -Dextra_lib_dirs="C:\src\openssl\install\lib" --prefix="C:\src\pq\install
The Meson build system
Version: 1.8.0
Source dir: C:\src\pq
Build dir: C:\src\pq\build
Build type: native build
Project name: postgresql
Project version: 17.5
C compiler for the host machine: cl (msvc 19.16.27054 "Microsoft (R) C/C++-Optimierungscompiler Version 19.16.27054 f�r x64")
C linker for the host machine: link link 14.16.27054.0
Host machine cpu family: x86_64
Host machine cpu: x86_64
Run-time dependency threads found: YES
Library ws2_32 found: YES
Library secur32 found: YES
Program perl found: YES (C:\Strawberry\perl\bin\perl.EXE)
Program python found: YES (C:\Users\naa\AppData\Local\Programs\Python\Python313\python.EXE)
Program win_flex found: YES 2.6.4 2.6.4 (C:\Program Files\win_flex_bison-2.5.25\win_flex.EXE)
Program win_bison found: YES 3.8.2 3.8.2 (C:\Program Files\win_flex_bison-2.5.25\win_bison.EXE)
Program gsed sed found: NO
Program prove found: YES (C:\Strawberry\perl\bin\prove.BAT)
Program tar found: YES (C:\WINDOWS\system32\tar.EXE)
Program gzip found: NO
Program lz4 found: NO
Program openssl found: YES (C:\src\openssl\install\bin\openssl.EXE)
Program zstd found: NO
Program dtrace skipped: feature dtrace disabled
Program config/missing found: YES (sh C:\src\pq\config/missing)
Program cp found: NO
Program xmllint found: YES (C:\Strawberry\c\bin\xmllint.EXE)
Program xsltproc found: YES (C:\Strawberry\c\bin\xsltproc.EXE)
Program wget found: NO
Program C:\Users\naa\AppData\Local\Programs\Python\Python313\Scripts\meson found: YES (C:\Users\naa\AppData\Local\Programs\Python\Python313\Scripts\meson.exe)
Check usable header "bsd_auth.h" skipped: feature bsd_auth disabled
Check usable header "dns_sd.h" skipped: feature bonjour disabled
Program fop found: NO
Compiler for language cpp skipped: feature llvm disabled
Found pkg-config 'C:\\Strawberry\\perl\\bin\\pkg-config.BAT' but it is Strawberry Perl and thus broken. Ignoring...
Found pkg-config: NO
Found CMake: C:\Strawberry\c\bin\cmake.EXE (3.29.2)
Run-time dependency readline found: NO (tried pkgconfig and cmake)
Library readline found: NO
Run-time dependency libedit found: NO (tried pkgconfig and cmake)
Library libedit found: NO
Dependency libselinux skipped: feature selinux disabled
Dependency libsystemd skipped: feature systemd disabled
Run-time dependency openssl (modules: OpenSSL::Crypto, OpenSSL::SSL) found: YES 3.3.0
Has header "openssl/ssl.h" with dependency OpenSSL: YES
Has header "openssl/err.h" with dependency OpenSSL: YES
Checking for function "CRYPTO_new_ex_data" with dependency OpenSSL: YES
Checking for function "SSL_new" with dependency OpenSSL: YES
Checking for function "SSL_CTX_set_cert_cb" with dependency OpenSSL: YES
Checking for function "OPENSSL_init_ssl" with dependency OpenSSL: YES
Checking for function "BIO_meth_new" with dependency OpenSSL: YES
Checking for function "ASN1_STRING_get0_data" with dependency OpenSSL: YES
Checking for function "HMAC_CTX_new" with dependency OpenSSL: YES
Checking for function "HMAC_CTX_free" with dependency OpenSSL: YES
....

As you can see it finds my openssl.exe, but there is an output: Run-time dependency openssl (modules: OpenSSL::Crypto, OpenSSL::SSL) found: YES 3.3.0. Although it still links against "C:\Strawberry\c\bin\libpq__.dll" and "C:\Strawberry\c\bin\libcrypto-3-x64__.dll".

With the old build tools in src/tools/msvc it was quite easy, I just had to put the openssl dir (C:\src\openssl\install) into the config.pl. I don't know how to do that with the Meson build and I was not able to find any information about that.

How can I define the path to use my own OpenSSL?

1 Answer 1

1

Set the environment variable to point to the directory that contains the .pc files for your version of OpenSSL:

set PKG_CONFIG_PATH="C:\src\openssl\install\lib\pkgconfig"

meson setup ...

That should do the trick.

Sign up to request clarification or add additional context in comments.

1 Comment

The path was a bit different but that worked. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.