Re: zlib detection in Meson on Windows broken? - Mailing list pgsql-hackers

From Dave Page
Subject Re: zlib detection in Meson on Windows broken?
Date
Msg-id CA+OCxoxR143XytShw=CtJ6Mzbjm9aaBXKuB++nh1ahxE4vtU-Q@mail.gmail.com
Whole thread Raw
In response to Re: zlib detection in Meson on Windows broken?  (Nazir Bilal Yavuz <byavuz81@gmail.com>)
Responses Re: zlib detection in Meson on Windows broken?
List pgsql-hackers
Hi Sandeep, Nazir,

On Tue, 21 May 2024 at 10:14, Nazir Bilal Yavuz <byavuz81@gmail.com> wrote:
Hi,

On Tue, 21 May 2024 at 10:20, Sandeep Thakkar
<sandeep.thakkar@enterprisedb.com> wrote:
>
> Hi Dave,
>
> Is the .pc file generated after the successful build of zlib? If yes, then meson should be able to detect the installation ideally

If meson is not able to find the .pc file automatically, using 'meson
setup ... --pkg-config-path $ZLIB_PC_PATH' might help.

The problem is that on Windows there are no standard locations for a Unix-style development library installation such as this, so the chances are that the .pc file will point to entirely the wrong location.

For example, please see https://github.com/dpage/winpgbuild/actions/runs/9172187335 which is a Github action that builds a completely vanilla zlib using VC++. If you look at the uploaded artefact containing the build output and example the .pc file, you'll see it references /zlib as the location, which is simply where I built it in that action. On a developer's machine that's almost certainly not going to be where it actually ends up. For example, on the pgAdmin build farm, the dependencies all end up in C:\build64\[whatever]. On the similar Github action I'm building for PostgreSQL, that artefact will be unpacked into /build/zlib.

Of course, for my own builds I can easily make everything use consistent directories, however most people who are likely to want to build PostgreSQL may not want to also build all the dependencies themselves as well, as some are a lot more difficult than zlib. So what tends to happen is people find third party builds or upstream official builds. 

I would therefore argue that if the .pc file that's found doesn't provide correct paths for us, then Meson should fall back to searching in the paths specified on its command line for the appropriate libraries/headers (which is what it does for OpenSSL for example, as that doesn't include a .pc file). This is also what happens with PG16 and earlier.

One other thing I will note is that PG16 and earlier try to use the wrong filename for the import library. For years, it's been a requirement to do something like this: "copy \zlib\lib\zlib.lib \zlib\lib\zdll.lib" to make a build succeed against a "vanilla" zlib build. I haven't got as far as figuring out if the same is true with Meson yet.

--

pgsql-hackers by date:

Previous
From: Zhang Mingli
Date:
Subject: How to declare GIN index on array type column when bootstrap?
Next
From: Aleksander Alekseev
Date:
Subject: Re: Reading timestamp values from Datums gives garbage values