Thread: Re: [pgsql-hackers-win32] VC++ psql build broken
> -----Original Message----- > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] > Sent: 10 September 2004 17:41 > To: pgman@candle.pha.pa.us > Cc: Dave Page; PgSQL Win32 developers > Subject: Re: [pgsql-hackers-win32] VC++ psql build broken > > > Now that I think of it, flex will not work because there is > no *.mak rule to run it. You would have to run it manually, > or write a *.mak rule for it. If someone does, please do > bcc.make too. Patch attached. It works find under VC++, but the Borland mod is an untested copy/paste. Unfortunately, psql still doesn't build giving the errors below. I should point out that I have no interest in psql but am happy to keep testing the build. I do wonder if there is any need to maintain these makefiles at all now it builds under Mingw - it's not like psql is a library like libpq that vc++ or bcc needs to link to (which I do need). Regards, Dave. cd ..\..\bin\psql nmake /f win32.mak Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 Copyright (C) Microsoft Corp 1988-1998. All rights reserved. flex.exe -Cfe -opsqlscan.c psqlscan.l echo #define PGBINDIR "" >"..\..\port\pg_config_paths.h" echo #define PGSHAREDIR "" >>"..\..\port\pg_config_paths.h" echo #define SYSCONFDIR "" >>"..\..\port\pg_config_paths.h" echo #define INCLUDEDIR "" >>"..\..\port\pg_config_paths.h" echo #define PKGINCLUDEDIR "" >>"..\..\port\pg_config_paths.h" echo #define INCLUDEDIRSERVER "" >>"..\..\port\pg_config_paths.h" echo #define LIBDIR "" >>"..\..\port\pg_config_paths.h" echo #define PKGLIBDIR "" >>"..\..\port\pg_config_paths.h" echo #define LOCALEDIR "" >>"..\..\port\pg_config_paths.h" cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nma03280. sprompt.c cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmb03280. getopt.c cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmc03280. getopt_long.c cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmd03280. path.c cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nme03280. command.c C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : redefini tion; different linkage ..\..\include\port.h(167) : see declaration of 'pgrename' C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : redefini tion; different linkage ..\..\include\port.h(168) : see declaration of 'pgunlink' common.c C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : redefini tion; different linkage ..\..\include\port.h(167) : see declaration of 'pgrename' C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : redefini tion; different linkage ..\..\include\port.h(168) : see declaration of 'pgunlink' common.c(536) : warning C4018: '<' : signed/unsigned mismatch help.c input.c stringutils.c mainloop.c mainloop.c(253) : warning C4018: '==' : signed/unsigned mismatch copy.c C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : redefini tion; different linkage ..\..\include\port.h(167) : see declaration of 'pgrename' C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : redefini tion; different linkage ..\..\include\port.h(168) : see declaration of 'pgunlink' startup.c C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : redefini tion; different linkage ..\..\include\port.h(167) : see declaration of 'pgrename' C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : redefini tion; different linkage ..\..\include\port.h(168) : see declaration of 'pgunlink' prompt.c C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : redefini tion; different linkage ..\..\include\port.h(167) : see declaration of 'pgrename' C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : redefini tion; different linkage ..\..\include\port.h(168) : see declaration of 'pgunlink' variables.c large_obj.c print.c print.c(1238) : warning C4090: 'function' : different 'const' qualifiers print.c(1238) : warning C4022: 'free' : pointer mismatch for actual parameter 1 print.c(1239) : warning C4090: 'function' : different 'const' qualifiers print.c(1239) : warning C4022: 'free' : pointer mismatch for actual parameter 1 describe.c psqlscan.c tab-complete.c mbprint.c NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' Stop. NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\NMAKE.EXE' : return co de '0x2' Stop.
Attachment
How does your Win32 system rename prototype differ from what is in port.h? extern int pgrename(const char *from, const char *to); extern int pgunlink(const char *path); Good question on wether we need to keep this working but it would be nice to keep it I guess for client-only installs that want to build from source using non-Mingw. --------------------------------------------------------------------------- Dave Page wrote: > > > > -----Original Message----- > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] > > Sent: 10 September 2004 17:41 > > To: pgman@candle.pha.pa.us > > Cc: Dave Page; PgSQL Win32 developers > > Subject: Re: [pgsql-hackers-win32] VC++ psql build broken > > > > > > Now that I think of it, flex will not work because there is > > no *.mak rule to run it. You would have to run it manually, > > or write a *.mak rule for it. If someone does, please do > > bcc.make too. > > Patch attached. It works find under VC++, but the Borland mod is an > untested copy/paste. > > Unfortunately, psql still doesn't build giving the errors below. I > should point out that I have no interest in psql but am happy to keep > testing the build. I do wonder if there is any need to maintain these > makefiles at all now it builds under Mingw - it's not like psql is a > library like libpq that vc++ or bcc needs to link to (which I do need). > > Regards, Dave. > > cd ..\..\bin\psql > nmake /f win32.mak > > Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 > Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > > flex.exe -Cfe -opsqlscan.c psqlscan.l > echo #define PGBINDIR "" >"..\..\port\pg_config_paths.h" > echo #define PGSHAREDIR "" >>"..\..\port\pg_config_paths.h" > echo #define SYSCONFDIR "" >>"..\..\port\pg_config_paths.h" > echo #define INCLUDEDIR "" >>"..\..\port\pg_config_paths.h" > echo #define PKGINCLUDEDIR "" >>"..\..\port\pg_config_paths.h" > echo #define INCLUDEDIRSERVER "" > >>"..\..\port\pg_config_paths.h" > echo #define LIBDIR "" >>"..\..\port\pg_config_paths.h" > echo #define PKGLIBDIR "" >>"..\..\port\pg_config_paths.h" > echo #define LOCALEDIR "" >>"..\..\port\pg_config_paths.h" > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nma03280. > sprompt.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmb03280. > getopt.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmc03280. > getopt_long.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmd03280. > path.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nme03280. > command.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > common.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > common.c(536) : warning C4018: '<' : signed/unsigned mismatch > help.c > input.c > stringutils.c > mainloop.c > mainloop.c(253) : warning C4018: '==' : signed/unsigned mismatch > copy.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > startup.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > prompt.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > variables.c > large_obj.c > print.c > print.c(1238) : warning C4090: 'function' : different 'const' qualifiers > print.c(1238) : warning C4022: 'free' : pointer mismatch for actual > parameter 1 > print.c(1239) : warning C4090: 'function' : different 'const' qualifiers > print.c(1239) : warning C4022: 'free' : pointer mismatch for actual > parameter 1 > describe.c > psqlscan.c > tab-complete.c > mbprint.c > NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' > Stop. > NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\NMAKE.EXE' : > return co > de '0x2' > Stop. Content-Description: psql_win32_makefiles.diff [ Attachment, skipping... ] -- 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
Bruce Momjian wrote: > How does your Win32 system rename prototype differ from what is in > port.h? What is the need of *any* special file handling functions for client tools? Regards, Andreas
Andreas Pflug wrote: > Bruce Momjian wrote: > > How does your Win32 system rename prototype differ from what is in > > port.h? > > What is the need of *any* special file handling functions for client tools? We could avoid it but it does give us Unix semantics so it seemed good to keep it if we could. -- 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
Bruce Momjian wrote: > Andreas Pflug wrote: > >>Bruce Momjian wrote: >> >>>How does your Win32 system rename prototype differ from what is in >>>port.h? >> >>What is the need of *any* special file handling functions for client tools? > > > We could avoid it but it does give us Unix semantics so it seemed good > to keep it if we could. > As you can see it creates much pain, without any use. The functions are for backend concurrent/shared access purposes only. Regards, Andreas
Andreas Pflug wrote: > Bruce Momjian wrote: > > Andreas Pflug wrote: > > > >>Bruce Momjian wrote: > >> > >>>How does your Win32 system rename prototype differ from what is in > >>>port.h? > >> > >>What is the need of *any* special file handling functions for client tools? > > > > > > We could avoid it but it does give us Unix semantics so it seemed good > > to keep it if we could. > > > > As you can see it creates much pain, without any use. The functions are > for backend concurrent/shared access purposes only. Are we sure of that always? And we don't know what other applications might be looking at those files. -- 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
I have applied the attached patch. I changed psqlscan to only require flex when it needs to rebuild the flex output: psqlscan.c: psqlscan.l $(FLEX) -Cfe -opsqlscan.c psqlscan.l Because we normally ship the flex output in the tarball I didn't bother to document that flex is required for CVS builds. We already require flex for CVS builds so this isn't anything special. --------------------------------------------------------------------------- Dave Page wrote: > > > > -----Original Message----- > > From: Bruce Momjian [mailto:pgman@candle.pha.pa.us] > > Sent: 10 September 2004 17:41 > > To: pgman@candle.pha.pa.us > > Cc: Dave Page; PgSQL Win32 developers > > Subject: Re: [pgsql-hackers-win32] VC++ psql build broken > > > > > > Now that I think of it, flex will not work because there is > > no *.mak rule to run it. You would have to run it manually, > > or write a *.mak rule for it. If someone does, please do > > bcc.make too. > > Patch attached. It works find under VC++, but the Borland mod is an > untested copy/paste. > > Unfortunately, psql still doesn't build giving the errors below. I > should point out that I have no interest in psql but am happy to keep > testing the build. I do wonder if there is any need to maintain these > makefiles at all now it builds under Mingw - it's not like psql is a > library like libpq that vc++ or bcc needs to link to (which I do need). > > Regards, Dave. > > cd ..\..\bin\psql > nmake /f win32.mak > > Microsoft (R) Program Maintenance Utility Version 6.00.8168.0 > Copyright (C) Microsoft Corp 1988-1998. All rights reserved. > > flex.exe -Cfe -opsqlscan.c psqlscan.l > echo #define PGBINDIR "" >"..\..\port\pg_config_paths.h" > echo #define PGSHAREDIR "" >>"..\..\port\pg_config_paths.h" > echo #define SYSCONFDIR "" >>"..\..\port\pg_config_paths.h" > echo #define INCLUDEDIR "" >>"..\..\port\pg_config_paths.h" > echo #define PKGINCLUDEDIR "" >>"..\..\port\pg_config_paths.h" > echo #define INCLUDEDIRSERVER "" > >>"..\..\port\pg_config_paths.h" > echo #define LIBDIR "" >>"..\..\port\pg_config_paths.h" > echo #define PKGLIBDIR "" >>"..\..\port\pg_config_paths.h" > echo #define LOCALEDIR "" >>"..\..\port\pg_config_paths.h" > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nma03280. > sprompt.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmb03280. > getopt.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmc03280. > getopt_long.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nmd03280. > path.c > cl.exe @C:\DOCUME~1\dpage\LOCALS~1\Temp\nme03280. > command.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > common.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > common.c(536) : warning C4018: '<' : signed/unsigned mismatch > help.c > input.c > stringutils.c > mainloop.c > mainloop.c(253) : warning C4018: '==' : signed/unsigned mismatch > copy.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > startup.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > prompt.c > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(176) : error C2375: 'pgrename' : > redefini > tion; different linkage > ..\..\include\port.h(167) : see declaration of 'pgrename' > C:\PROGRA~1\MICROS~3\VC98\INCLUDE\io.h(244) : error C2375: 'pgunlink' : > redefini > tion; different linkage > ..\..\include\port.h(168) : see declaration of 'pgunlink' > variables.c > large_obj.c > print.c > print.c(1238) : warning C4090: 'function' : different 'const' qualifiers > print.c(1238) : warning C4022: 'free' : pointer mismatch for actual > parameter 1 > print.c(1239) : warning C4090: 'function' : different 'const' qualifiers > print.c(1239) : warning C4022: 'free' : pointer mismatch for actual > parameter 1 > describe.c > psqlscan.c > tab-complete.c > mbprint.c > NMAKE : fatal error U1077: 'cl.exe' : return code '0x2' > Stop. > NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC98\BIN\NMAKE.EXE' : > return co > de '0x2' > Stop. Content-Description: psql_win32_makefiles.diff [ Attachment, skipping... ] -- 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/bin/psql/bcc32.mak =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/bcc32.mak,v retrieving revision 1.9 diff -c -c -r1.9 bcc32.mak *** src/bin/psql/bcc32.mak 10 Sep 2004 09:45:21 -0000 1.9 --- src/bin/psql/bcc32.mak 27 Sep 2004 19:49:24 -0000 *************** *** 37,42 **** --- 37,43 ---- CPP=bcc32.exe PERL=perl.exe + FLEX=flex.exe !IF "$(CFG)" == "Debug" DEBUG=1 *************** *** 53,59 **** .c.obj: $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $< ! ALL : sql_help.h "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe" CLEAN : -@erase "$(INTDIR)\command.obj" --- 54,60 ---- .c.obj: $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $< ! ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe" CLEAN : -@erase "$(INTDIR)\command.obj" *************** *** 158,160 **** --- 159,164 ---- "sql_help.h": create_help.pl $(PERL) create_help.pl $(REFDOCDIR) $@ + + psqlscan.c : psqlscan.l + $(FLEX) -Cfe -opsqlscan.c psqlscan.l Index: src/bin/psql/win32.mak =================================================================== RCS file: /cvsroot/pgsql-server/src/bin/psql/win32.mak,v retrieving revision 1.21 diff -c -c -r1.21 win32.mak *** src/bin/psql/win32.mak 10 Sep 2004 09:45:21 -0000 1.21 --- src/bin/psql/win32.mak 27 Sep 2004 19:49:24 -0000 *************** *** 8,13 **** --- 8,14 ---- CPP=cl.exe PERL=perl.exe + FLEX=flex.exe OUTDIR=.\Release INTDIR=.\Release *************** *** 16,22 **** OutDir=.\Release # End Custom Macros ! ALL : sql_help.h "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe" CLEAN : -@erase "$(INTDIR)\command.obj" --- 17,23 ---- OutDir=.\Release # End Custom Macros ! ALL : sql_help.h psqlscan.c "..\..\port\pg_config_paths.h" "$(OUTDIR)\psql.exe" CLEAN : -@erase "$(INTDIR)\command.obj" *************** *** 127,131 **** $(CPP_PROJ) $< << ! sql_help.h: create_help.pl $(PERL) create_help.pl $(REFDOCDIR) $@ --- 128,135 ---- $(CPP_PROJ) $< << ! sql_help.h : create_help.pl $(PERL) create_help.pl $(REFDOCDIR) $@ + + psqlscan.c: psqlscan.l + $(FLEX) -Cfe -opsqlscan.c psqlscan.l