latest cygwin build failure

Started by Andrew Dunstanabout 21 years ago2 messages
#1Andrew Dunstan
andrew@dunslane.net

with CVS tip in contrib/spi:

ccache gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wendif-labels
-fno-strict-aliasing -DREFINT_VERBOSE -I. -I../../src/include -c -o
timetravel.o timetravel.c
dlltool --export-all --output-def timetravel.def timetravel.o
dllwrap -o timetravel.dll --def timetravel.def timetravel.o
../../src/utils/dllinit.o -L../../src/backend -lpostgres
timetravel.o(.text+0x10cb):timetravel.c: undefined reference to
`_pg_strcasecmp'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
make[1]: *** [timetravel.dll] Error 1
rm refint.o autoinc.o timetravel.o moddatetime.o insert_username.o
make[1]: Leaving directory
`/home/adunstan/pgbf/root/HEAD/pgsql.blurfl/contrib/spi'

cheers

andrew

#2Reini Urban
rurban@x-ray.at
In reply to: Andrew Dunstan (#1)
1 attachment(s)
Re: latest cygwin build failure

Andrew Dunstan schrieb:

with CVS tip in contrib/spi:

ccache gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wendif-labels
-fno-strict-aliasing -DREFINT_VERBOSE -I. -I../../src/include -c -o
timetravel.o timetravel.c
dlltool --export-all --output-def timetravel.def timetravel.o
dllwrap -o timetravel.dll --def timetravel.def timetravel.o
../../src/utils/dllinit.o -L../../src/backend -lpostgres
timetravel.o(.text+0x10cb):timetravel.c: undefined reference to
`_pg_strcasecmp'
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
make[1]: *** [timetravel.dll] Error 1
rm refint.o autoinc.o timetravel.o moddatetime.o insert_username.o
make[1]: Leaving directory
`/home/adunstan/pgbf/root/HEAD/pgsql.blurfl/contrib/spi'

This was addressed in my patch I sent.

--
Reini Urban
http://xarch.tu-graz.ac.at/home/rurban/

Attachments:

cygwin1.patchtext/plain; name=cygwin1.patchDownload
Index: contrib/spi/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/contrib/spi/Makefile,v
retrieving revision 1.24
diff -u -b -r1.24 Makefile
--- contrib/spi/Makefile	20 Aug 2004 20:13:08 -0000	1.24
+++ contrib/spi/Makefile	8 Nov 2004 05:34:53 -0000
@@ -1,4 +1,4 @@
-# $PostgreSQL: pgsql/contrib/spi/Makefile,v 1.24 2004/08/20 20:13:08 momjian Exp $
+# $PostgreSQL: pgsql-server/contrib/spi/Makefile,v 1.24 2004/08/20 20:13:08 momjian Exp $
 
 MODULES = autoinc insert_username moddatetime refint timetravel
 DATA_built = $(addsuffix .sql, $(MODULES))
@@ -17,3 +17,5 @@
 include $(top_builddir)/src/Makefile.global
 include $(top_srcdir)/contrib/contrib-global.mk
 endif
+
+SHLIB_LINK += -L$(top_builddir)/src/port -lpgport 
Index: src/bin/pg_ctl/pg_ctl.c
===================================================================
RCS file: /projects/cvsroot/pgsql/src/bin/pg_ctl/pg_ctl.c,v
retrieving revision 1.45
diff -u -b -r1.45 pg_ctl.c
--- src/bin/pg_ctl/pg_ctl.c	4 Nov 2004 22:25:12 -0000	1.45
+++ src/bin/pg_ctl/pg_ctl.c	8 Nov 2004 05:35:21 -0000
@@ -22,6 +22,7 @@
 #include "getopt_long.h"
 
 #if defined(__CYGWIN__)
+#include <sys/cygwin.h>
 #include <windows.h>
 /* Cygwin defines WIN32 in windows.h, but we don't want it. */
 #undef WIN32
@@ -820,6 +821,9 @@
 {
 	static char cmdLine[MAXPGPATH];
 	int			ret;
+#ifdef __CYGWIN__
+	static char buf[MAXPGPATH];
+#endif
 
 	if (registration)
 	{
@@ -839,6 +843,11 @@
 			exit(1);
 		}
 	}
+#ifdef __CYGWIN__
+	/* need to convert to windows path */
+	cygwin_conv_to_full_win32_path (cmdLine, buf);
+	strcpy(cmdLine, buf);
+#endif
 
 	if (registration)
 	{
Index: src/interfaces/libpq/Makefile
===================================================================
RCS file: /projects/cvsroot/pgsql/src/interfaces/libpq/Makefile,v
retrieving revision 1.120
diff -u -b -r1.120 Makefile
--- src/interfaces/libpq/Makefile	16 Oct 2004 22:52:49 -0000	1.120
+++ src/interfaces/libpq/Makefile	8 Nov 2004 05:35:28 -0000
@@ -31,6 +31,10 @@
 	md5.o ip.o wchar.o encnames.o noblock.o pgstrcasecmp.o thread.o \
 	$(filter crypt.o getaddrinfo.o inet_aton.o open.o snprintf.o strerror.o, $(LIBOBJS))
 
+ifeq ($(PORTNAME), cygwin)
+override shlib = cyg$(NAME)$(DLSUFFIX)
+endif
+
 ifeq ($(PORTNAME), win32)
 OBJS += win32.o libpqrc.o
 libpqrc.o : libpq.rc
Index: src/template/cygwin
===================================================================
RCS file: /projects/cvsroot/pgsql/src/template/cygwin,v
retrieving revision 1.4
diff -u -b -r1.4 cygwin
--- src/template/cygwin	9 Oct 2003 14:40:36 -0000	1.4
+++ src/template/cygwin	8 Nov 2004 06:59:51 -0000
@@ -1 +1,6 @@
 SRCH_LIB="/usr/local/lib"
+# This is required to link pg_dump because it finds pg_toupper() in
+# libpq and pgport
+LDFLAGS="-Wl,--allow-multiple-definition -Wl,--enable-auto-import"
+# --enable-auto-import gets rid of a diagnostics linker message
+LDFLAGS_SL="-Wl,--enable-auto-import"
Index: src/include/port.h
===================================================================
RCS file: /projects/cvsroot/pgsql/src/include/port.h,v
retrieving revision 1.65
diff -u -b -r1.65 port.h
--- src/include/port.h	6 Nov 2004 01:16:14 -0000	1.65
+++ src/include/port.h	8 Nov 2004 07:00:42 -0000
@@ -72,12 +72,17 @@
 extern int find_other_exec(const char *argv0, const char *target,
 				const char *versionstr, char *retpath);
 
-#if defined(WIN32) || defined(__CYGWIN__)
-#define EXE ".exe"
-#define DEVNULL "nul"
+#if defined(WIN32) && !defined(__CYGWIN__)
+# define EXE ".exe"
+# define DEVNULL "nul"
 #else
-#define EXE ""
-#define DEVNULL "/dev/null"
+# if defined(__CYGWIN__)
+#  define EXE ".exe"
+#  define DEVNULL "/dev/null"
+# else
+#  define EXE ""
+#  define DEVNULL "/dev/null"
+# endif
 #endif
 
 /*
@@ -89,13 +94,13 @@
  *	See the "Notes" section about quotes at:
  *		http://home.earthlink.net/~rlively/MANUALS/COMMANDS/C/CMD.HTM
  */
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__)
 #define SYSTEMQUOTE "\""
 #else
 #define SYSTEMQUOTE ""
 #endif
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__)
 #define HOMEDIR "USERPROFILE"
 #else
 #define HOMEDIR "HOME"
@@ -164,8 +169,9 @@
  *	Cygwin has its own symlinks which work on Win95/98/ME where
  *	junction points don't, so use it instead.  We have no way of
  *	knowing what type of system Cygwin binaries will be run on.
+ *      Note: Some CYGWIN includes might #define WIN32.
  */
-#ifdef WIN32	
+#if defined(WIN32) && !defined(__CYGWIN__)
 extern int	pgsymlink(const char *oldpath, const char *newpath);
 #define symlink(oldpath, newpath)	pgsymlink(oldpath, newpath)
 #endif
@@ -174,7 +180,7 @@
 
 extern bool rmtree(char *path, bool rmtopdir);
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(__CYGWIN__)
 
 /* open() replacement to allow delete of held files */
 #ifndef WIN32_CLIENT_ONLY
@@ -267,7 +273,7 @@
 /* thread.h */
 extern char *pqStrerror(int errnum, char *strerrbuf, size_t buflen);
 
-#ifndef WIN32
+#if !defined(WIN32) || defined(__CYGWIN__)
 extern int pqGetpwuid(uid_t uid, struct passwd * resultbuf, char *buffer,
 		   size_t buflen, struct passwd ** result);
 #endif