Re: CVS source win32 mingw some comile error - Mailing list pgsql-patches

From Bruce Momjian
Subject Re: CVS source win32 mingw some comile error
Date
Msg-id 200402021721.i12HLCi04550@candle.pha.pa.us
Whole thread Raw
List pgsql-patches
Korea PostgreSQL Users' Group wrote:
> src/backend/commands/user.c file has some parse error at repalloc(), palloc() functions

Fixed.  Thanks.

> src/backend/postmaster/pgstat.c miss
> #include "tcop/tcopprot.h" line.

Fixed.

> src/utils/dllinit.c wrong include header line at MinGW.
> #include <cygwin/version.h> must be not included

Fixed.

> by the way,
> I can't compile eccp because I used lower version bison.

> and bin/pg_resetxlog too. in this case I can't find what's wrong.

The problem with pg_resetxlog is that it calls unlink in dirmod, and
that is in libport, and the libport version doesn't have FRONTEND
defined, so it fails on the elog() call.  Claudio already reported it,
and the attached patch fixes this and some others above that had not
been fixed previously, all applied to CVS.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: src/backend/commands/user.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/commands/user.c,v
retrieving revision 1.135
diff -c -c -r1.135 user.c
*** src/backend/commands/user.c    2 Feb 2004 16:37:46 -0000    1.135
--- src/backend/commands/user.c    2 Feb 2004 17:19:02 -0000
***************
*** 470,476 ****
              /* Rename active file while not holding an exclusive lock */
              char *filename = user_getfilename(), *filename_new;

!             filename_new = palloc(strlen(filename) + 1 + strlen(".new")));
              sprintf(filename_new, "%s.new", filename);
              rename(filename_new, filename);
              pfree(filename);
--- 470,476 ----
              /* Rename active file while not holding an exclusive lock */
              char *filename = user_getfilename(), *filename_new;

!             filename_new = palloc(strlen(filename) + 1 + strlen(".new"));
              sprintf(filename_new, "%s.new", filename);
              rename(filename_new, filename);
              pfree(filename);
***************
*** 489,495 ****
              /* Rename active file while not holding an exclusive lock */
              char *filename = group_getfilename(), *filename_new;

!             filename_new = palloc(strlen(filename) + 1 + strlen(".new")));
              sprintf(filename_new, "%s.new", filename);
              rename(filename_new, filename);
              pfree(filename);
--- 489,495 ----
              /* Rename active file while not holding an exclusive lock */
              char *filename = group_getfilename(), *filename_new;

!             filename_new = palloc(strlen(filename) + 1 + strlen(".new"));
              sprintf(filename_new, "%s.new", filename);
              rename(filename_new, filename);
              pfree(filename);
Index: src/bin/pg_resetxlog/Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/pg_resetxlog/Makefile,v
retrieving revision 1.3
diff -c -c -r1.3 Makefile
*** src/bin/pg_resetxlog/Makefile    29 Nov 2003 19:52:06 -0000    1.3
--- src/bin/pg_resetxlog/Makefile    2 Feb 2004 17:19:04 -0000
***************
*** 12,24 ****
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! OBJS= pg_resetxlog.o pg_crc.o

  all: submake-libpgport pg_resetxlog

  pg_resetxlog: $(OBJS)
      $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@

  pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
      rm -f $@ && $(LN_S) $< .

--- 12,30 ----
  top_builddir = ../../..
  include $(top_builddir)/src/Makefile.global

! override CPPFLAGS := $(CPPFLAGS) -DFRONTEND
!
! OBJS= pg_resetxlog.o pg_crc.o \
!       $(filter dirmod.o, $(LIBOBJS))

  all: submake-libpgport pg_resetxlog

  pg_resetxlog: $(OBJS)
      $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@

+ dirmod.c: % : $(top_srcdir)/src/port/%
+     rm -f $@ && $(LN_S) $< .
+
  pg_crc.c: $(top_srcdir)/src/backend/utils/hash/pg_crc.c
      rm -f $@ && $(LN_S) $< .

***************
*** 32,35 ****
      rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X)

  clean distclean maintainer-clean:
!     rm -f pg_resetxlog$(X) pg_resetxlog.o pg_crc.o pg_crc.c
--- 38,41 ----
      rm -f $(DESTDIR)$(bindir)/pg_resetxlog$(X)

  clean distclean maintainer-clean:
!     rm -f pg_resetxlog$(X) pg_resetxlog.o pg_crc.o pg_crc.c dirmod.c
Index: src/utils/dllinit.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/utils/dllinit.c,v
retrieving revision 1.14
diff -c -c -r1.14 dllinit.c
*** src/utils/dllinit.c    2 Nov 2002 02:00:35 -0000    1.14
--- src/utils/dllinit.c    2 Feb 2004 17:19:06 -0000
***************
*** 1,4 ****
--- 1,6 ----
+ #ifdef CYGWIN
  #include <cygwin/version.h>
+ #endif
  #if CYGWIN_VERSION_DLL_MAJOR < 1001

  /* dllinit.c -- Portable DLL initialization.

pgsql-patches by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: reading uninitialized buffer
Next
From: Jan Wieck
Date:
Subject: Re: unified diffs, PLEASE?