Subject: Encountering missing sourcefiles when building postgres on windows

From: Jürgen Zornig <[email-masked]>
Date: Fri, 7 Jul 2023 14:18:50 +0000

Hello List,

I'm trying to build postgres on Windows 11 Enterprise / Visual Studio 2022 Professional, so I basically followed the instructions, installed the devenvironment (flex, bison, perl, ...), got the sources from git (I've tried master and REL_15_2 branches) and ran /src/tools/msvc/build

The buildprocess itself seems to work, but I am encountering quite a lot of missing sourcefiles (and also headers) as the errors tell me:

"c:\_build\postgresql\pgsql.sln" (default target) (1) ->
"c:\_build\postgresql\initdb.vcxproj" (default target) (5) ->
"c:\_build\postgresql\libpgfeutils.vcxproj" (default target) (6) ->
(ClCompile target) ->
  c1 : fatal  error C1083: Cannot open source file: 'src/fe_utils/psqlscan.c': No such file or directory [c:\_build\pos
tgresql\libpgfeutils.vcxproj]

"c:\_build\postgresql\pgsql.sln" (default target) (1) ->
"c:\_build\postgresql\cyrillic_and_mic.vcxproj" (default target) (38) ->
"c:\_build\postgresql\postgres.vcxproj" (default target) (39) ->
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/bootstrap/bootparse.c': No such file or directory [c:\
_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/bootstrap/bootscanner.c': No such file or directory [c
:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/parser/gram.c': No such file or directory [c:\_build\p
ostgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/parser/scan.c': No such file or directory [c:\_build\p
ostgresql\postgres.vcxproj]
  c:\_build\postgresql\src\backend\parser\gramparse.h(29,10): fatal  error C1083: Cannot open include file: 'gram.h': N
o such file or directory (compiling source file src/backend/parser/parser.c) [c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/replication/repl_gram.c': No such file or directory [c
:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/replication/repl_scanner.c': No such file or directory
 [c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/replication/syncrep_gram.c': No such file or directory
 [c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/replication/syncrep_scanner.c': No such file or direct
ory [c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/utils/adt/jsonpath_gram.c': No such file or directory
[c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/utils/adt/jsonpath_scan.c': No such file or directory
[c:\_build\postgresql\postgres.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/backend/utils/misc/guc-file.c': No such file or directory [c:\
_build\postgresql\postgres.vcxproj]

"c:\_build\postgresql\pgsql.sln" (default target) (1) ->
"c:\_build\postgresql\ecpg.vcxproj" (default target) (69) ->
  c:\_build\postgresql\src\interfaces\ecpg\preproc\c_keywords.c(15,10): fatal  error C1083: Cannot open include file: '
preproc.h': No such file or directory [c:\_build\postgresql\ecpg.vcxproj]
  c:\_build\postgresql\src\interfaces\ecpg\preproc\ecpg_keywords.c(19,10): fatal  error C1083: Cannot open include file
: 'preproc.h': No such file or directory [c:\_build\postgresql\ecpg.vcxproj]
  c:\_build\postgresql\src\interfaces\ecpg\preproc\keywords.c(30,10): fatal  error C1083: Cannot open include file: 'pr
eproc.h': No such file or directory [c:\_build\postgresql\ecpg.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/interfaces/ecpg/preproc/pgc.c': No such file or directory [c:\
_build\postgresql\ecpg.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/interfaces/ecpg/preproc/preproc.c': No such file or directory
[c:\_build\postgresql\ecpg.vcxproj]
  c:\_build\postgresql\src\interfaces\ecpg\preproc\parser.c(25,10): fatal  error C1083: Cannot open include file: 'prep
roc.h': No such file or directory [c:\_build\postgresql\ecpg.vcxproj]

"c:\_build\postgresql\pgsql.sln" (default target) (1) ->
"c:\_build\postgresql\isolationtester.vcxproj" (default target) (73) ->
  c1 : fatal  error C1083: Cannot open source file: 'src/test/isolation/specparse.c': No such file or directory [c:\_bu
ild\postgresql\isolationtester.vcxproj]
  c1 : fatal  error C1083: Cannot open source file: 'src/test/isolation/specscanner.c': No such file or directory [c:\_
build\postgresql\isolationtester.vcxproj]

    16 Warning(s)
    21 Error(s)

Time Elapsed 00:07:30.09

I've also downloaded the 15.2 Tarball where some of these sourcefiles are contained and copied them each by each into the according locations. This works for most of these errors, nevertheless one file keeps missing, it's 'specparse.c' which belongs to the isolationtester test. Because of that my build doesn't run all the way through.

The purpose of my endeavour is to get windows builds of some Foreign Data Wrappers I'd like to use in our projects, mainly the jdbc_fdw. Also we want to gain more knowledge in building postgres on windows . So I would appreciate any help to get the very basic building process up and running as intended.

Best regards

juergen zornig

data engineer

[https://user-generated.getmailspring.com/asset/NmVmYzI1MzEtOGY0Mi00ZWY4LTg3OTYtOWIzYTBlZDBiMjUxL3NpZy1pbml0aWFsLnBuZw.png?t=1587377702638&msw=112&msh=52]

E: [email-masked]<mailto:[email-masked]>

P: +43 664 8816 8482<tel:+43%20664%208816%208482>

A: bahnhofsplatz 1a, 2340 mödling<https://maps.google.com/?q=bahnhofsplatz%201a%2C%202340%20m%C3%B6dling>

W: http://www.msgis.com

[LinkedIn]<http://www.linkedin.com/in/jzornig/>[Twitter]<https://twitter.com/HTGSTOP>

---

From: Tom Lane <[email-masked]>
Date: Sat, 08 Jul 2023 11:17:55 -0400

> The buildprocess itself seems to work, but I am encountering quite a lot of missing sourcefiles (and also headers) as the errors tell me:

The files you seem to be missing are precisely those that are generated
by flex or bison (if you build from a git pull instead of a tarball).
So it'd appear that either you misinstalled those tools, or something
is going wrong when the build script calls them (maybe they are not in
your PATH?).  I'd advise looking further up in the build log to get
a clue of what's going wrong.

			regards, tom lane