Failure during Building Postgres in Windows with Meson

Started by Shlok Kyalabout 2 years ago11 messages
#1Shlok Kyal
shlok.kyal.oss@gmail.com

Hi,
I am trying to build postgres with meson on Windows. And I am stuck in
the process.

Steps I followed:

1. I clone postgres repo

2.Installed meson and ninja
pip install meson ninja

3. Then running following command:
meson setup build --buildtype debug

4. Then I ran
cd build
ninja

Got following error
D:\project\repo\pg_meson\postgres\build>C:\Users\kyals\AppData\Roaming\Python\Python311\Scripts\ninja
ninja: error: 'src/backend/postgres_lib.a.p/meson_pch-c.obj', needed
by 'src/backend/postgres.exe', missing and no known rule to make it.

Any thoughts on how to resolve this error?

Thanks
Shlok Kumar Kyal

#2Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Shlok Kyal (#1)
Re: Failure during Building Postgres in Windows with Meson

Hi,

Adding Kyotaro to CC because Kyotaro reported a similar issue before [1]/messages/by-id/20231018.113148.1275969479525954369.horikyota.ntt@gmail.com.

On Thu, 9 Nov 2023 at 11:59, Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:

Hi,
I am trying to build postgres with meson on Windows. And I am stuck in
the process.

Steps I followed:

1. I clone postgres repo

2.Installed meson and ninja
pip install meson ninja

3. Then running following command:
meson setup build --buildtype debug

4. Then I ran
cd build
ninja

Got following error
D:\project\repo\pg_meson\postgres\build>C:\Users\kyals\AppData\Roaming\Python\Python311\Scripts\ninja
ninja: error: 'src/backend/postgres_lib.a.p/meson_pch-c.obj', needed
by 'src/backend/postgres.exe', missing and no known rule to make it.

I am able to reproduce the error. This error was introduced at meson
v1.2.0, v1.1.0 and before work successfully. It seems meson tries to
use pch files although Postgres is compiled with b_pch=false.
This error occurs when Developer Powershell for VS is used and
Postgres is compiled with b_pch=false option (which is the default on
Postgres). If the -Db_pch=true option or the default powershell is
used, Postgres gets built successfully.

[1]: /messages/by-id/20231018.113148.1275969479525954369.horikyota.ntt@gmail.com

--
Regards,
Nazir Bilal Yavuz
Microsoft

#3Tristan Partin
tristan@neon.tech
In reply to: Nazir Bilal Yavuz (#2)
Re: Failure during Building Postgres in Windows with Meson

Can you try with Meson v1.2.3?

--
Tristan Partin
Neon (https://neon.tech)

#4Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Tristan Partin (#3)
Re: Failure during Building Postgres in Windows with Meson

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

--
Regards,
Nazir Bilal Yavuz
Microsoft

#5Tristan Partin
tristan@neon.tech
In reply to: Nazir Bilal Yavuz (#4)
Re: Failure during Building Postgres in Windows with Meson

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

Please open a bug in the Meson repository which also mentions the last
known working version. I wonder what versions of Meson we use in the
build farm.

--
Tristan Partin
Neon (https://neon.tech)

#6Andrew Dunstan
andrew@dunslane.net
In reply to: Tristan Partin (#5)
Re: Failure during Building Postgres in Windows with Meson

On 2023-11-09 Th 10:42, Tristan Partin wrote:

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

Please open a bug in the Meson repository which also mentions the last
known working version. I wonder what versions of Meson we use in the
build farm.

fairywren / drongo have 1.0.1

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

#7vignesh C
vignesh21@gmail.com
In reply to: Tristan Partin (#5)
Re: Failure during Building Postgres in Windows with Meson

On Thu, 9 Nov 2023 at 21:12, Tristan Partin <tristan@neon.tech> wrote:

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

Please open a bug in the Meson repository which also mentions the last
known working version. I wonder what versions of Meson we use in the
build farm.

Should we document the supported meson version that should be used for
building from source?

Regards,
Vignesh

#8Andres Freund
andres@anarazel.de
In reply to: vignesh C (#7)
Re: Failure during Building Postgres in Windows with Meson

Hi,

On 2023-11-10 08:17:48 +0530, vignesh C wrote:

On Thu, 9 Nov 2023 at 21:12, Tristan Partin <tristan@neon.tech> wrote:

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

Please open a bug in the Meson repository which also mentions the last
known working version. I wonder what versions of Meson we use in the
build farm.

Should we document the supported meson version that should be used for
building from source?

It should be supported, I think we need to analyze the problem further
first. It's extremely odd that the problem only happens when invoked from one
version of powershell but not the other. I assume there's a difference in
PATH leading to a different version of *something* being used.

Bilal, you apparently can repro the failure happening in one shell but not the
other? Could you send the PATH variable set in either shell and
meson-logs/meson-log.txt for both the working and non-working case?

Andres

#9Nazir Bilal Yavuz
byavuz81@gmail.com
In reply to: Andres Freund (#8)
3 attachment(s)
Re: Failure during Building Postgres in Windows with Meson

Hi,

On Fri, 10 Nov 2023 at 06:06, Andres Freund <andres@anarazel.de> wrote:

Bilal, you apparently can repro the failure happening in one shell but not the
other? Could you send the PATH variable set in either shell and
meson-logs/meson-log.txt for both the working and non-working case?

Yes, all of them are attached.

--
Regards,
Nazir Bilal Yavuz
Microsoft

Attachments:

path_variables.txttext/plain; charset=US-ASCII; name=path_variables.txtDownload
working_meson-log.txttext/plain; charset=US-ASCII; name=working_meson-log.txtDownload
not_working_meson-log.txttext/plain; charset=US-ASCII; name=not_working_meson-log.txtDownload
#10Tristan Partin
tristan@neon.tech
In reply to: Nazir Bilal Yavuz (#4)
Re: Failure during Building Postgres in Windows with Meson

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

An employee at Collabora produced a fix[0]https://github.com/mesonbuild/meson/pull/12498. It might still be worthwhile
however to see why it happens in one shell and not the other.

[0]: https://github.com/mesonbuild/meson/pull/12498

--
Tristan Partin
Neon (https://neon.tech)

#11Andres Freund
andres@anarazel.de
In reply to: Tristan Partin (#10)
Re: Failure during Building Postgres in Windows with Meson

Hi,

On November 10, 2023 10:53:12 AM PST, Tristan Partin <tristan@neon.tech> wrote:

On Thu Nov 9, 2023 at 9:31 AM CST, Nazir Bilal Yavuz wrote:

Hi,

On Thu, 9 Nov 2023 at 18:27, Tristan Partin <tristan@neon.tech> wrote:

Can you try with Meson v1.2.3?

I tried with Meson v1.2.3 and upstream, both failed with the same error.

An employee at Collabora produced a fix[0].

If I understand correctly, you can thus work around the problem by enabling use of precompiled headers. Which also explains why CI didn't show this - normally on Windows you want to use pch.

It might still be worthwhile however to see why it happens in one shell and not the other.

It's gcc vs msvc due to path.

Andres

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.