OK, I see your problem is the compilation of psql, which I am not sure
has been tested yet. I saw a few problems:
libpq bcc linked path.c while it was not needed
psql bcc and vc linked in path.c but didn't create a
pg_config_paths.h with the proper values.
The pg_config_paths.h in libpq is not the same as the one in psql. This
fixes that.
Please test and let me know if it doesn't work. Patch attached and applied.
---------------------------------------------------------------------------
Vidyasagara Guntaka wrote:
> Hi Bruce,
> I'm still getting some compilation errors. I'm listing the steps I followed below:
> 1. Downloaded the postgresql-8.0.0beta2 file
> 2. Unzipped it.
> 3. Change directory to src directory and issued "nmake /f win32.mak" command.
>
> I see many undelcared identifiers in port/path.c file. Looks like they are environment setup related variables. Do
Ineed to do any configuration before starting the compilation using nmake?
>
> Here I'm reproducing the compilation results :
>
> ______________________________
> C:\temp\postgresql-8.0.0beta2\src>nmake /f win32.mak
>
> Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> cd include
> if not exist pg_config.h copy pg_config.h.win32 pg_config.h
> cd ..
> cd interfaces\libpq
> nmake /f win32.mak
>
> Microsoft (R) Program Maintenance Utility Version 6.00.8168.0
> Copyright (C) Microsoft Corp 1988-1998. All rights reserved.
>
> Building the Win32 static library...
>
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nma02964.
> getaddrinfo.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmb02964.
> pgstrcasecmp.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmc02964.
> thread.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmd02964.
> inet_aton.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nme02964.
> crypt.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmf02964.
> noblock.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmg02964.
> dllist.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmh02964.
> md5.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmi02964.
> ip.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmj02964.
> wchar.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmk02964.
> encnames.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nml02964.
> win32.c
> fe-auth.c
> fe-protocol2.c
> fe-protocol3.c
> fe-connect.c
> fe-exec.c
> fe-lobj.c
> fe-misc.c
> fe-print.c
> fe-secure.c
> pqexpbuffer.c
> pthread-win32.c
> link.exe -lib @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmm02964.
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmn02964.
> libpqdll.c
> rc.exe /l 0x409 /fo".\Release\libpq.res" libpq.rc
> link.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmo02964.
> Creating library .\Release\libpqdll.lib and object .\Release\libpqdll.exp
> 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.
>
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nma02896.
> sprompt.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmb02896.
> getopt.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmc02896.
> getopt_long.c
> cl.exe @C:\DOCUME~1\vguntaka\LOCALS~1\Temp\nmd02896.
> path.c
> ..\..\port\path.c(198) : error C2065: 'PGBINDIR' : undeclared identifier
> ..\..\port\path.c(198) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(198) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(198) : error C2065: 'PGSHAREDIR' : undeclared identifier
> ..\..\port\path.c(198) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(198) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(201) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(201) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(215) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(215) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(232) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(232) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(232) : error C2065: 'INCLUDEDIR' : undeclared identifier
> ..\..\port\path.c(232) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(232) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(235) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(235) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(249) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(249) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(249) : error C2065: 'PKGINCLUDEDIR' : undeclared identifier
> ..\..\port\path.c(249) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(249) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(252) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(252) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(266) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(266) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(266) : error C2065: 'INCLUDEDIRSERVER' : undeclared identifier
> ..\..\port\path.c(266) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(266) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(269) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(269) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(283) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(283) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(283) : error C2065: 'LIBDIR' : undeclared identifier
> ..\..\port\path.c(283) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(283) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(286) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(286) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(300) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(300) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(300) : error C2065: 'PKGLIBDIR' : undeclared identifier
> ..\..\port\path.c(300) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(300) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(303) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(303) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> ..\..\port\path.c(319) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(319) : warning C4024: 'relative_path' : different types for formal and actual parameter 1
> ..\..\port\path.c(319) : error C2065: 'LOCALEDIR' : undeclared identifier
> ..\..\port\path.c(319) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(319) : warning C4024: 'relative_path' : different types for formal and actual parameter 2
> ..\..\port\path.c(322) : warning C4047: 'function' : 'const char *' differs in levels of indirection from 'int '
> ..\..\port\path.c(322) : warning C4024: 'strncpy' : different types for formal and actual parameter 2
> NMAKE : fatal error U1077: 'cl.exe' : return code '0x2'
> Stop.
> NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio\VC98\bin\NMAKE.EXE"' : return code '0x2'
> Stop.
>
> C:\temp\postgresql-8.0.0beta2\src>
> _______________________________________________
>
>
> Thanks and regards,
> Sagar.
>
> -----Original Message-----
> From: Bruce Momjian [mailto:pgman@candle.pha.pa.us]
> Sent: Tuesday, August 31, 2004 12:08 PM
> To: Vidyasagara Guntaka
> Cc: pgsql-general@postgresql.org
> Subject: Re: [GENERAL] Not able to build libpq for Windows
>
>
>
> We fixed a number of MS VC issues and these should be in the beta2
> release and in CVS.
>
> ---------------------------------------------------------------------------
>
> Vidyasagara Guntaka wrote:
> > Hi,
> >
> > I am not able to build the libpq for windows using the 8.0 beta1 version source code. I posted this message for
coupleof time by now. I did not get any responses. Is this supposed to be broken at this point ?
> >
> > Can you somebody please respond for this issue?
> >
> > Thank you very much in advance,
> > Sagar.
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 4: Don't 'kill -9' the postmaster
> >
>
> --
> 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
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>
--
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
? src/Makefile.custom
? src/log
Index: src/bin/psql/bcc32.mak
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/bcc32.mak,v
retrieving revision 1.4
retrieving revision 1.6
diff -c -c -r1.4 -r1.6
*** src/bin/psql/bcc32.mak 2 Mar 2004 15:17:16 -0000 1.4
--- src/bin/psql/bcc32.mak 1 Sep 2004 23:45:16 -0000 1.6
***************
*** 53,59 ****
.c.obj:
$(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
! ALL : "sql_help.h" "$(OUTDIR)\psql.exe"
CLEAN :
-@erase "$(INTDIR)\command.obj"
--- 53,59 ----
.c.obj:
$(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
! ALL : sql_help.h pg_config_paths.h "$(OUTDIR)\psql.exe"
CLEAN :
-@erase "$(INTDIR)\command.obj"
***************
*** 82,87 ****
--- 82,98 ----
-@erase "$(INTDIR)\psql.ilf"
-@erase "$(OUTDIR)\psql.exe"
+ pg_config_paths.h: win32.mak
+ echo "#define PGBINDIR "">$@
+ echo "#define PGSHAREDIR "" >>$@
+ echo "#define SYSCONFDIR "" >>$@
+ echo "#define INCLUDEDIR "" >>$@
+ echo "#define PKGINCLUDEDIR "" >>$@
+ echo "#define INCLUDEDIRSERVER "" >>$@
+ echo "#define LIBDIR "" >>$@
+ echo "#define PKGLIBDIR "" >>$@
+ echo "#define LOCALEDIR "" >>$@
+
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
Index: src/bin/psql/win32.mak
===================================================================
RCS file: /cvsroot/pgsql-server/src/bin/psql/win32.mak,v
retrieving revision 1.16
retrieving revision 1.18
diff -c -c -r1.16 -r1.18
*** src/bin/psql/win32.mak 5 Apr 2004 03:16:21 -0000 1.16
--- src/bin/psql/win32.mak 1 Sep 2004 23:45:16 -0000 1.18
***************
*** 16,22 ****
OutDir=.\Release
# End Custom Macros
! ALL : sql_help.h "$(OUTDIR)\psql.exe"
CLEAN :
-@erase "$(INTDIR)\command.obj"
--- 16,22 ----
OutDir=.\Release
# End Custom Macros
! ALL : sql_help.h pg_config_paths.h "$(OUTDIR)\psql.exe"
CLEAN :
-@erase "$(INTDIR)\command.obj"
***************
*** 42,47 ****
--- 42,58 ----
-@erase "$(INTDIR)\*psql.pch"
-@erase "$(OUTDIR)\psql.exe"
+ pg_config_paths.h: win32.mak
+ echo "#define PGBINDIR "">$@
+ echo "#define PGSHAREDIR "" >>$@
+ echo "#define SYSCONFDIR "" >>$@
+ echo "#define INCLUDEDIR "" >>$@
+ echo "#define PKGINCLUDEDIR "" >>$@
+ echo "#define INCLUDEDIRSERVER "" >>$@
+ echo "#define LIBDIR "" >>$@
+ echo "#define PKGLIBDIR "" >>$@
+ echo "#define LOCALEDIR "" >>$@
+
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
Index: src/interfaces/libpq/bcc32.mak
===================================================================
RCS file: /cvsroot/pgsql-server/src/interfaces/libpq/bcc32.mak,v
retrieving revision 1.7
retrieving revision 1.8
diff -c -c -r1.7 -r1.8
*** src/interfaces/libpq/bcc32.mak 31 Jul 2004 06:19:23 -0000 1.7
--- src/interfaces/libpq/bcc32.mak 1 Sep 2004 23:35:16 -0000 1.8
***************
*** 67,73 ****
"$(INTDIR)\thread.obj" \
"$(INTDIR)\inet_aton.obj" \
"$(INTDIR)\crypt.obj" \
- "$(INTDIR)\path.obj" \
"$(INTDIR)\noblock.obj" \
"$(INTDIR)\pgstrcasecmp.obj" \
"$(INTDIR)\dllist.obj" \
--- 67,72 ----
***************
*** 93,105 ****
LINK32=ilink32.exe
LINK32_FLAGS = -Gn -L$(BCB)\lib;$(INTDIR); -x -Tpd -v
LINK32_OBJS= "$(INTDIR)\libpqdll.obj"
-
- # ---------------------------------------------------------------------------
-
- .path.obj = $(INTDIR)
- .path.c = .;..\..\port;..\..\backend\libpq;..\..\backend\lib;..\..\backend\utils\mb
-
- # ---------------------------------------------------------------------------
ALL: config "$(OUTDIR)" "$(OUTDIR)\blibpq.dll" "$(OUTDIR)\blibpq.lib"
--- 92,97 ----
***************
*** 108,114 ****
-@erase "$(INTDIR)\thread.obj"
-@erase "$(INTDIR)\inet_aton.obj"
-@erase "$(INTDIR)\crypt.obj"
- -@erase "$(INTDIR)\path.obj"
-@erase "$(INTDIR)\dllist.obj"
-@erase "$(INTDIR)\md5.obj"
-@erase "$(INTDIR)\ip.obj"
--- 100,105 ----