Amit Kapila wrote:
> On Wed, Jun 6, 2018 at 3:06 PM, Kuntal Ghosh <kuntalghosh.2...@gmail.com> 
> wrote:
> > It seems the "#ifndef FRONTEND" restriction was added around
> > pgwin32_open() for building libpq with Visual C++ or Borland C++.  The
> > restriction was added in commit 422d4819 to build libpq with VC++[1].
> > Later, in commit fd7c3f67e0bc4, the support for Borland C++ was also
> > added.
> > 
> > So, I'm not sure whether removing that restriction will work for all
> > front-end modules.
> > 
> 
> Thanks for doing investigation.  I agree with you that it appears from the old
> discussion that we have added this restriction to build libpq/psql (basically 
> frontend)
> modules.  However, I tried to build those modules on windows by removing that
> restriction and it doesn't give me any problem (except one extra argument 
> error,
> which can be easily resolved).  It might be that it gives problem with certain
> version of MSVC.  I think if we want to pursue this direction, one needs to 
> verify
> on various supportted versions (of Windows) to see if things are okay.

That's what the buildfarm is for, right?

> Speaking about the issue at-hand, one way to make pg_test_fsync work in to 
> just
> include c.h and remove inclusion of postgres_fe.h, but not sure if that is 
> the best way.
> I am not sure if we have any other options to proceed in this case.
> 
> Thoughts?

I thought of a better way.
pg_test_fsync is properly listed as a server application in the documentation,
so I think it should be built as such, as per the attached patch.

Yours,
Laurenz Albe
From 032a0463072097e489f912337ea08f7373a4f107 Mon Sep 17 00:00:00 2001
From: Laurenz Albe <laurenz.a...@cybertec.at>
Date: Fri, 8 Jun 2018 04:07:55 +0200
Subject: [PATCH] Build pg_test_fsync as backend code

Including "postgres.h" rather than "postgres_fe.h" makes
pg_test_fsync use pgwin32_open() on Windows, which is the
proper thing to do because it should test the behavior on
the backend side.
---
 src/bin/pg_test_fsync/pg_test_fsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/bin/pg_test_fsync/pg_test_fsync.c b/src/bin/pg_test_fsync/pg_test_fsync.c
index e6f7ef8557..c1e1d7ef38 100644
--- a/src/bin/pg_test_fsync/pg_test_fsync.c
+++ b/src/bin/pg_test_fsync/pg_test_fsync.c
@@ -3,7 +3,7 @@
  *		tests all supported fsync() methods
  */
 
-#include "postgres_fe.h"
+#include "postgres.h"
 
 #include <sys/stat.h>
 #include <sys/time.h>
-- 
2.14.4

Reply via email to