Re: Need help with postgresql build on windows - Mailing list pgsql-hackers

From Nazir Bilal Yavuz
Subject Re: Need help with postgresql build on windows
Date
Msg-id CAN55FZ3QP-mvi+JShTsFJzDevyk7nQvaWThDiJwt41E5vjwLrA@mail.gmail.com
Whole thread Raw
In response to Need help with postgresql build on windows  (Prafulla Ranadive <pprandive.pgsql@gmail.com>)
Responses Re: Need help with postgresql build on windows
List pgsql-hackers
Hi,

On Mon, 5 Jan 2026 at 08:28, Prafulla Ranadive
<pprandive.pgsql@gmail.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



pgsql-hackers by date:

Previous
From: John Naylor
Date:
Subject: Re: [PATCH] Documentation
Next
From: Dilip Kumar
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication