Re: zlib detection in Meson on Windows broken?

Поиск
Список
Период
Сортировка
От Sandeep Thakkar
Тема Re: zlib detection in Meson on Windows broken?
Дата
Msg-id CANFyU94Z7QY_FEp2hZXsRgtp7tMx-pq=CHHoczVA5ByKdJf4=g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: zlib detection in Meson on Windows broken?  (Dave Page <dpage@pgadmin.org>)
Ответы Re: zlib detection in Meson on Windows broken?
Список pgsql-hackers
Hi Dave,


On Tue, May 21, 2024 at 3:12 PM Dave Page <dpage@pgadmin.org> wrote:
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.


The above link returned 404. But I found a successful build at https://github.com/dpage/winpgbuild/actions/runs/9175426807. I downloaded the artifact but didn't find .pc file as I wanted to look into the content of that file.

I had a word with Murali who mentioned he encountered a similar issue while building PG17 on windows. He worked-around is by using a template .pc file that includes these lines:
--
prefix=${pcfiledir}/../..
exec_prefix=${prefix}
libdir=${prefix}/lib
sharedlibdir=${prefix}/lib
includedir=${prefix}/include
--

But in general I agree with you on the issue of Meson's dependency on pkgconfig files to detect the third party libraries. 

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.

--


--
Sandeep Thakkar


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Pradeep Kumar
Дата:
Сообщение: Possible Bug in relation_open
Следующее
От: Dave Page
Дата:
Сообщение: Re: zlib detection in Meson on Windows broken?