I've been having trouble compiling PG 17 using msys2 / mingw64 (sorry my meson setup is a bit broken at moment, so couldn't test that.).
Both my msys2 envs (Rev2, Built by MSYS2 project) 13.2.0 and my older setup (x86_64-posix-seh-rev0, Built by MinGW-W64 project) 8.1.0 Have the same issue: The error is rm -f '../../src/include/storage/lwlocknames.h' cp -pR ../../backend/storage/lmgr/lwlocknames.h '../../src/include/storage/lwlocknames.h' cp: cannot stat '../../backend/storage/lmgr/lwlocknames.h': No such file or directory make[1]: *** [Makefile:143: ../../src/include/storage/lwlocknames.h] Error 1 make[1]: Leaving directory '/projects/postgresql/postgresql-git/src/backend' make: *** [../../src/Makefile.global:382: submake-generated-headers] Error 2 I traced the issue down to this change in https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=721856ff24b $(top_builddir)/src/include/storage/lwlocknames.h: storage/lmgr/lwlocknames.h - prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ - cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "$$prereqdir/$(notdir $<)" . + rm -f '$@' + $(LN_S) ../../backend/$< '$@' $(top_builddir)/src/include/utils/wait_event_types.h: utils/activity/wait_event_types.h - prereqdir=`cd '$(dir $<)' >/dev/null && pwd` && \ - cd '$(dir $@)' && rm -f $(notdir $@) && \ - $(LN_S) "$$prereqdir/$(notdir $<)" . + rm -f '$@' + $(LN_S) ../../backend/$< '$@' Reverting just the above change fixes the issue. I'm not sure what all that does to be honest, so not sure the best way to move forward. My linux autoconf build systems do not have this issue. Thanks, Regina