zlib detection in Meson on Windows broken?

From: Dave Page <dpage(at)pgadmin(dot)org>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: zlib detection in Meson on Windows broken?
Date: 2024-05-20 10:58:05
Message-ID: CA+OCxozrPZx57ue8rmhq6CD1Jic5uqKh80=vTpZurSKESn-dkw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I'm working on updating the build of PostgreSQL that pgAdmin uses in its
Windows installers to use Meson ready for the v17 release. I'm using Visual
Studio 2022, on Windows Server 2022.

I've been unable to persuade Meson to detect zlib, whilst OpenSSL seems to
be fine.

The dependencies have been built and installed as follows:

mkdir c:\build64

wget https://zlib.net/zlib-1.3.2.tar.gz
tar -zxvf zlib-1.3.2.tar.gz
cd zlib-1.3.2
cmake -DCMAKE_INSTALL_PREFIX=C:/build64/zlib -G "Visual Studio 17 2022" .
msbuild ALL_BUILD.vcxproj /p:Configuration=Release
msbuild RUN_TESTS.vcxproj /p:Configuration=Release
msbuild INSTALL.vcxproj /p:Configuration=Release
cd ..

wget https://www.openssl.org/source/openssl-3.0.13.tar.gz
tar -zxvf openssl-3.0.13.tar.gz
cd openssl-3.0.013
perl Configure VC-WIN64A no-asm --prefix=C:\build64\openssl no-ssl3 no-comp
nmake
nmake test
nmake install
cd ..

This results in the following headers and libraries being installed for
zlib:

C:\Users\dpage\git\postgresql>dir C:\build64\zlib\include
Volume in drive C has no label.
Volume Serial Number is 3AAD-5864

Directory of C:\build64\zlib\include

17/05/2024 15:56 <DIR> .
17/05/2024 15:56 <DIR> ..
17/05/2024 15:54 17,096 zconf.h
22/01/2024 19:32 96,829 zlib.h
2 File(s) 113,925 bytes
2 Dir(s) 98,842,726,400 bytes free

C:\Users\dpage\git\postgresql>dir C:\build64\zlib\lib
Volume in drive C has no label.
Volume Serial Number is 3AAD-5864

Directory of C:\build64\zlib\lib

17/05/2024 17:01 <DIR> .
17/05/2024 15:56 <DIR> ..
17/05/2024 15:55 16,638 zlib.lib
17/05/2024 15:55 184,458 zlibstatic.lib
2 File(s) 201,096 bytes
2 Dir(s) 98,842,726,400 bytes free

I then attempt to build PostgreSQL:

meson setup build
-Dextra_include_dirs=C:/build64/openssl/include,C:/build64/zlib/include
-Dextra_lib_dirs=C:/build64/openssl/lib,C:/build64/zlib/lib -Dssl=openssl
-Dzlib=enabled --prefix=c:/build64/pgsql

Which results in the output in output.txt, indicating that OpenSSL was
correctly found, but zlib was not. I've also attached the meson log.

I have very little experience with Meson, and even less interpreting it's
logs, but it seems to me that it's not including the extra lib and include
directories when it runs the test compile, given the command line it's
reporting:

cl C:\Users\dpage\git\postgresql\build\meson-private\tmpg_h4xcue\testfile.c
/nologo /showIncludes /utf-8 /EP /nologo /showIncludes /utf-8 /EP /Od /Oi-

Bug, or am I doing something silly?

--
Dave Page
pgAdmin: https://www.pgadmin.org
PostgreSQL: https://www.postgresql.org
EDB: https://www.enterprisedb.com

Attachment Content-Type Size
meson-log.txt text/plain 127.6 KB
output.txt text/plain 7.2 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Shlok Kyal 2024-05-20 10:59:50 Re: speed up a logical replica setup
Previous Message Jakub Wartak 2024-05-20 10:43:15 Re: Doc limitation update proposal: include out-of-line OID usage per TOAST-ed columns