Re: Need help with postgresql build on windows

From: Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
To: Prafulla Ranadive <pprandive(dot)pgsql(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Need help with postgresql build on windows
Date: 2026-01-05 06:39:46
Message-ID: CAN55FZ3QP-mvi+JShTsFJzDevyk7nQvaWThDiJwt41E5vjwLrA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Mon, 5 Jan 2026 at 08:28, Prafulla Ranadive
<pprandive(dot)pgsql(at)gmail(dot)com> wrote:
>
> Hello,
>
> I have started exploring Postgresql recently.
> I am trying to build Postgresql from source on a windows machine. I am referring to the page https://www.postgresql.org/docs/current/install-meson.html#INSTALL-SHORT-MESON
>
> The ninja command is failing with the error message:
>
> PS C:\PostgreSQLworkspace\postgres\build> ninja
> [142/2102] Generating src/fe_utils/psqlscan with a custom command
> FAILED: src/fe_utils/psqlscan.c
> "C:\MyPrograms\Meson\meson.exe" "runpython" "../src/tools/pgflex" "--builddir" "." "--srcdir" ".." "--privatedir" "src/fe_utils/psqlscan.c.p" "--flex" "C:\MyPrograms\GnuWin32\bin\flex.EXE" "--perl" "C:\Strawberry\perl\bin\perl.EXE" "-i" "../src/fe_utils/psqlscan.l" "-o" "src/fe_utils/psqlscan.c" "--no-backup" "--" "-Cfe" "-p" "-p"
> C:\MyPrograms\GnuWin32\bin\flex.EXE: can't open C:\PostgreSQLworkspace\postgres\build\src\fe_utils\psqlscan.c
> [146/2102] Generating src/backend/bootstrap/bootscanner with a custom command
> FAILED: src/backend/bootstrap/bootscanner.c
> "C:\MyPrograms\Meson\meson.exe" "runpython" "../src/tools/pgflex" "--builddir" "." "--srcdir" ".." "--privatedir" "src/backend/bootstrap/bootscanner.c.p" "--flex" "C:\MyPrograms\GnuWin32\bin\flex.EXE" "--perl" "C:\Strawberry\perl\bin\perl.EXE" "-i" "../src/backend/bootstrap/bootscanner.l" "-o" "src/backend/bootstrap/bootscanner.c"
> C:\MyPrograms\GnuWin32\bin\flex.EXE: can't open C:\PostgreSQLworkspace\postgres\build\src\backend\bootstrap\bootscanner.c
> [147/2102] Generating src/backend/parser/scan with a custom command
> FAILED: src/backend/parser/scan.c
> "C:\MyPrograms\Meson\meson.exe" "runpython" "../src/tools/pgflex" "--builddir" "." "--srcdir" ".." "--privatedir" "src/backend/parser/scan.c.p" "--flex" "C:\MyPrograms\GnuWin32\bin\flex.EXE" "--perl" "C:\Strawberry\perl\bin\perl.EXE" "-i" "../src/backend/parser/scan.l" "-o" "src/backend/parser/scan.c" "--no-backup" "--" "-CF" "-p" "-p"
> C:\MyPrograms\GnuWin32\bin\flex.EXE: can't open C:\PostgreSQLworkspace\postgres\build\src\backend\parser\scan.c
> ninja: build stopped: subcommand failed.
> PS C:\PostgreSQLworkspace\postgres\build>
>
> I have enabled full permission on the folder but still no luck.
>
> Can someone please help me with this? Any troubleshooting pointers would be a great help!

Could you let me know where you downloaded flex from? I am wondering
whether it might be this:
https://gnuwin32.sourceforge.net/packages/flex.htm.

For our Windows CI, we use flex and bison from this release instead:
https://github.com/lexxmark/winflexbison/releases/tag/v2.5.24.

If you have a chance, would you mind trying flex and bison from that
source to see if it helps?

--
Regards,
Nazir Bilal Yavuz
Microsoft

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2026-01-05 06:41:28 Re: Proposal: Conflict log history table for Logical Replication
Previous Message John Naylor 2026-01-05 06:39:36 Re: [PATCH] Documentation