Re: Borland c++ compile problems...

Lists: pgsql-hackers-win32pgsql-patches
From: Steve Holdoway <steve(at)treshna(dot)com>
To: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Borland c++ compile problems...
Date: 2004-07-21 02:20:33
Message-ID: 40FDD2F1.3040509@treshna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Hi folks,

It seems that Borland C++ ( I'm using the command line version 5.5 )
takes exception to #defines like the following...

#define open(a, b...) win32_open ( a, b, ##__VA_ARGS__ )
[ to be found in port.h on the current development snapshot ]

This causes compilation to fail. I'm after a version of blibpq.dll that
supports ssl connections, and the one I compiled previously ( 7.4.2 I
think ) doesn't seem to.

Can anyone suggest a solution. I speak C fluently... it's this pesky
windows stuff that causes me grief!

Cheers,

Steve


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-21 03:08:09
Message-ID: 200407210308.i6L389J13710@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches


OK, patch attached that fixes it. Should that define just check for GCC
instead of checking if the compiler isn't MS or Borland?

---------------------------------------------------------------------------

Steve Holdoway wrote:
> Hi folks,
>
> It seems that Borland C++ ( I'm using the command line version 5.5 )
> takes exception to #defines like the following...
>
> #define open(a, b...) win32_open ( a, b, ##__VA_ARGS__ )
> [ to be found in port.h on the current development snapshot ]
>
> This causes compilation to fail. I'm after a version of blibpq.dll that
> supports ssl connections, and the one I compiled previously ( 7.4.2 I
> think ) doesn't seem to.
>
> Can anyone suggest a solution. I speak C fluently... it's this pesky
> windows stuff that causes me grief!
>
> Cheers,
>
> Steve
>
> ---------------------------(end of broadcast)---------------------------
> TIP 8: explain analyze is your friend
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 792 bytes

From: Steve Holdoway <steve(at)treshna(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-21 04:09:54
Message-ID: 40FDEC92.5020403@treshna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Bruce Momjian wrote:

>OK, patch attached that fixes it. Should that define just check for GCC
>instead of checking if the compiler isn't MS or Borland?
>
>---------------------------------------------------------------------------
>
>Steve Holdoway wrote:
>
>
>>Hi folks,
>>
>>It seems that Borland C++ ( I'm using the command line version 5.5 )
>>takes exception to #defines like the following...
>>
>>#define open(a, b...) win32_open ( a, b, ##__VA_ARGS__ )
>> [ to be found in port.h on the current development snapshot ]
>>
>>This causes compilation to fail. I'm after a version of blibpq.dll that
>>supports ssl connections, and the one I compiled previously ( 7.4.2 I
>>think ) doesn't seem to.
>>
>>Can anyone suggest a solution. I speak C fluently... it's this pesky
>>windows stuff that causes me grief!
>>
>>Cheers,
>>
>>Steve
>>
>>---------------------------(end of broadcast)---------------------------
>>TIP 8: explain analyze is your friend
>>
>>
>>
>
>
>
>------------------------------------------------------------------------
>
>Index: src/include/port.h
>===================================================================
>RCS file: /cvsroot/pgsql-server/src/include/port.h,v
>retrieving revision 1.43
>diff -c -c -r1.43 port.h
>*** src/include/port.h 11 Jun 2004 16:10:09 -0000 1.43
>--- src/include/port.h 21 Jul 2004 03:01:33 -0000
>***************
>*** 151,157 ****
> #ifdef WIN32
>
> /* open() replacement to allow delete of held files */
>! #ifndef _MSC_VER
> extern int win32_open(const char*,int,...);
> #define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
> #endif
>--- 151,157 ----
> #ifdef WIN32
>
> /* open() replacement to allow delete of held files */
>! #if !defined(_MSC_VER) && !defined(__BORLANDC__)
> extern int win32_open(const char*,int,...);
> #define open(a,b,...) win32_open(a,b,##__VA_ARGS__)
> #endif
>
>
>------------------------------------------------------------------------
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>
>
Sorry to be a pest, and all that. However, it looks like make needs to
be run in src\port, to create pg_config_paths.h, and compile stuff to
resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
(? bit worried about that one!)

I had a go at rewriting an existing bcc32.mak, but just seemed to
generate more errors!

Cheers,

Steve


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-21 14:05:37
Message-ID: 200407211405.i6LE5b221461@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Steve Holdoway wrote:
> Sorry to be a pest, and all that. However, it looks like make needs to
> be run in src\port, to create pg_config_paths.h, and compile stuff to
> resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
> (? bit worried about that one!)
>
> I had a go at rewriting an existing bcc32.mak, but just seemed to
> generate more errors!

Uh, I don't see how those would fail. What errors are you seeing?

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Steve Holdoway <steve(at)treshna(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-21 22:35:38
Message-ID: 40FEEFBA.5010605@treshna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Bruce Momjian wrote:

>Steve Holdoway wrote:
>
>
>>Sorry to be a pest, and all that. However, it looks like make needs to
>>be run in src\port, to create pg_config_paths.h, and compile stuff to
>>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
>>(? bit worried about that one!)
>>
>>I had a go at rewriting an existing bcc32.mak, but just seemed to
>>generate more errors!
>>
>>
>
>Uh, I don't see how those would fail. What errors are you seeing?
>
>
>
Well, in the port subdirectory, one of the things that is generated by
the makefile is pg_config_paths.h. Without this, libpq will not compile.
As I stated above, cobbling this together manually then gets me to the
place where the aforementioned external references are not resolved. All
are in source files in the port directory.

The errors I'm seeing are all caused by includes not being found, etc. I
don't know what to do when they are ones like strings.h, which I do not
have either in the snapshot source tree, or in the Borland bcc 5.5 tree.

I also don't know how you want the above files building... into a
library, static or dynamic/straight object code, etc. There is also no
listing in the current bcc32.mak files to include them into the libpq
dll generation.


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-21 22:57:08
Message-ID: 200407212257.i6LMv8Y21995@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Steve Holdoway wrote:
> Bruce Momjian wrote:
>
> >Steve Holdoway wrote:
> >
> >
> >>Sorry to be a pest, and all that. However, it looks like make needs to
> >>be run in src\port, to create pg_config_paths.h, and compile stuff to
> >>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
> >>(? bit worried about that one!)
> >>
> >>I had a go at rewriting an existing bcc32.mak, but just seemed to
> >>generate more errors!
> >>
> >>
> >
> >Uh, I don't see how those would fail. What errors are you seeing?
> >
> >
> >
> Well, in the port subdirectory, one of the things that is generated by
> the makefile is pg_config_paths.h. Without this, libpq will not compile.
> As I stated above, cobbling this together manually then gets me to the
> place where the aforementioned external references are not resolved. All
> are in source files in the port directory.
>
> The errors I'm seeing are all caused by includes not being found, etc. I
> don't know what to do when they are ones like strings.h, which I do not
> have either in the snapshot source tree, or in the Borland bcc 5.5 tree.
>
> I also don't know how you want the above files building... into a
> library, static or dynamic/straight object code, etc. There is also no
> listing in the current bcc32.mak files to include them into the libpq
> dll generation.

OK, if you look at the last few commits to interfaces/libpq/win32.mak,
you will see changes for pg_config_paths.h and for thread safety. Can
you look at those changes, merge them into bcc.mak. There might be
other changes in there you want to add to bcc.mak too.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Steve Holdoway <steve(at)treshna(dot)com>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-22 00:29:11
Message-ID: 40FF0A57.8080002@treshna.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches

Bruce Momjian wrote:

>Steve Holdoway wrote:
>
>
>>Bruce Momjian wrote:
>>
>>
>>
>>>Steve Holdoway wrote:
>>>
>>>
>>>
>>>
>>>>Sorry to be a pest, and all that. However, it looks like make needs to
>>>>be run in src\port, to create pg_config_paths.h, and compile stuff to
>>>>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
>>>>(? bit worried about that one!)
>>>>
>>>>I had a go at rewriting an existing bcc32.mak, but just seemed to
>>>>generate more errors!
>>>>
>>>>
>>>>
>>>>
>>>Uh, I don't see how those would fail. What errors are you seeing?
>>>
>>>
>>>
>>>
>>>
>>Well, in the port subdirectory, one of the things that is generated by
>>the makefile is pg_config_paths.h. Without this, libpq will not compile.
>>As I stated above, cobbling this together manually then gets me to the
>>place where the aforementioned external references are not resolved. All
>>are in source files in the port directory.
>>
>>The errors I'm seeing are all caused by includes not being found, etc. I
>>don't know what to do when they are ones like strings.h, which I do not
>>have either in the snapshot source tree, or in the Borland bcc 5.5 tree.
>>
>>I also don't know how you want the above files building... into a
>>library, static or dynamic/straight object code, etc. There is also no
>>listing in the current bcc32.mak files to include them into the libpq
>>dll generation.
>>
>>
>
>OK, if you look at the last few commits to interfaces/libpq/win32.mak,
>you will see changes for pg_config_paths.h and for thread safety. Can
>you look at those changes, merge them into bcc.mak. There might be
>other changes in there you want to add to bcc.mak too.
>
>
>
OK, having no M$ diff, I attach files src\interfaces\libpq\bcc32.mak and
src\interfaces\libpq\win32.h

bcc32.mak incorporates the changes in win32.mak, and adds a couple of
extra source files from the ..\..\port directory, and win32.h was used
to #define popen -> _popen.

All seems to work after a *very* cursory test!

Can I get back to the land of proper slashes now???

Cheers,

Steve

Attachment Content-Type Size
bcc32.mak text/plain 4.5 KB
win32.h text/x-c-header 756 bytes

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org, PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Borland c++ compile problems...
Date: 2004-07-22 03:55:11
Message-ID: 200407220355.i6M3tBX21429@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Steve Holdoway wrote:
> Bruce Momjian wrote:
>
> >Steve Holdoway wrote:
> >
> >
> >>Bruce Momjian wrote:
> >>
> >>
> >>
> >>>Steve Holdoway wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Sorry to be a pest, and all that. However, it looks like make needs to
> >>>>be run in src\port, to create pg_config_paths.h, and compile stuff to
> >>>>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
> >>>>(? bit worried about that one!)
> >>>>
> >>>>I had a go at rewriting an existing bcc32.mak, but just seemed to
> >>>>generate more errors!
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Uh, I don't see how those would fail. What errors are you seeing?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>Well, in the port subdirectory, one of the things that is generated by
> >>the makefile is pg_config_paths.h. Without this, libpq will not compile.
> >>As I stated above, cobbling this together manually then gets me to the
> >>place where the aforementioned external references are not resolved. All
> >>are in source files in the port directory.
> >>
> >>The errors I'm seeing are all caused by includes not being found, etc. I
> >>don't know what to do when they are ones like strings.h, which I do not
> >>have either in the snapshot source tree, or in the Borland bcc 5.5 tree.
> >>
> >>I also don't know how you want the above files building... into a
> >>library, static or dynamic/straight object code, etc. There is also no
> >>listing in the current bcc32.mak files to include them into the libpq
> >>dll generation.
> >>
> >>
> >
> >OK, if you look at the last few commits to interfaces/libpq/win32.mak,
> >you will see changes for pg_config_paths.h and for thread safety. Can
> >you look at those changes, merge them into bcc.mak. There might be
> >other changes in there you want to add to bcc.mak too.
> >
> >
> >
> OK, having no M$ diff, I attach files src\interfaces\libpq\bcc32.mak and
> src\interfaces\libpq\win32.h
>
> bcc32.mak incorporates the changes in win32.mak, and adds a couple of
> extra source files from the ..\..\port directory, and win32.h was used
> to #define popen -> _popen.
>
> All seems to work after a *very* cursory test!
>
> Can I get back to the land of proper slashes now???
>
> Cheers,
>
> Steve

> # Makefile for Borland C++ 5.5
>
> # Will build a Win32 static library libpq.lib
> # and a Win32 dynamic library libpq.dll with import library libpqdll.lib
>
> # Borland C++ base install directory goes here
> BCB=c:\Borland\Bcc55
>
> !MESSAGE Building the Win32 DLL and Static Library...
> !MESSAGE
> !IF "$(CFG)" == ""
> CFG=Release
> !MESSAGE No configuration specified. Defaulting to Release.
> !MESSAGE
> !ELSE
> !MESSAGE Configuration "$(CFG)"
> !MESSAGE
> !ENDIF
>
> !IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
> !MESSAGE Invalid configuration "$(CFG)" specified.
> !MESSAGE You can specify a configuration when running MAKE
> !MESSAGE by defining the macro CFG on the command line. For example:
> !MESSAGE
> !MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
> !MESSAGE
> !MESSAGE Possible choices for configuration are:
> !MESSAGE
> !MESSAGE "Release" (Win32 Release DLL and Static Library)
> !MESSAGE "Debug" (Win32 Debug DLL and Static Library)
> !MESSAGE
> !ERROR An invalid configuration was specified.
> !ENDIF
>
> !IF "$(OS)" == "Windows_NT"
> NULL=
> !ELSE
> NULL=nul
> !ENDIF
>
> !IF "$(CFG)" == "Debug"
> DEBUG=1
> OUTDIR=.\Debug
> INTDIR=.\Debug
> !else
> OUTDIR=.\Release
> INTDIR=.\Release
> !endif
>
> USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;
>
> CPP=bcc32.exe
> CPP_PROJ = -I$(BCB)\include;..\..\include -WD -c -D$(USERDEFINES) -tWM \
> -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc
>
> !IFDEF DEBUG
> CPP_PROJ = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
> !else
> CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBU
> !endif
>
> LIB32=tlib.exe
> LIB32_FLAGS=
> LIB32_OBJS= \
> "$(OUTDIR)\win32.obj" \
> "$(INTDIR)\getaddrinfo.obj" \
> "$(INTDIR)\thread.obj" \
> "$(INTDIR)\inet_aton.obj" \
> "$(INTDIR)\crypt.obj" \
> "$(INTDIR)\path.obj" \
> "$(INTDIR)\noblock.obj" \
> "$(INTDIR)\pgstrcasecmp.obj" \
> "$(INTDIR)\dllist.obj" \
> "$(INTDIR)\md5.obj" \
> "$(INTDIR)\ip.obj" \
> "$(INTDIR)\fe-auth.obj" \
> "$(INTDIR)\fe-protocol2.obj" \
> "$(INTDIR)\fe-protocol3.obj" \
> "$(INTDIR)\fe-connect.obj" \
> "$(INTDIR)\fe-exec.obj" \
> "$(INTDIR)\fe-lobj.obj" \
> "$(INTDIR)\fe-misc.obj" \
> "$(INTDIR)\fe-print.obj" \
> "$(INTDIR)\fe-secure.obj" \
> "$(INTDIR)\pqexpbuffer.obj" \
> "$(INTDIR)\wchar.obj" \
> "$(INTDIR)\encnames.obj"
>
>
> RSC=brcc32.exe
> RSC_PROJ=-l 0x409 -i$(BCB)\include -fo"$(INTDIR)\libpq.res"
>
> 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"
>
> CLEAN :
> -(at)erase "$(INTDIR)\getaddrinfo.obj"
> -(at)erase "$(INTDIR)\thread.obj"
> -(at)erase "$(INTDIR)\inet_aton.obj"
> -(at)erase "$(INTDIR)\crypt.obj"
> -(at)erase "$(INTDIR)\path.obj"
> -(at)erase "$(INTDIR)\dllist.obj"
> -(at)erase "$(INTDIR)\md5.obj"
> -(at)erase "$(INTDIR)\ip.obj"
> -(at)erase "$(INTDIR)\fe-auth.obj"
> -(at)erase "$(INTDIR)\fe-protocol2.obj"
> -(at)erase "$(INTDIR)\fe-protocol3.obj"
> -(at)erase "$(INTDIR)\fe-connect.obj"
> -(at)erase "$(INTDIR)\fe-exec.obj"
> -(at)erase "$(INTDIR)\fe-lobj.obj"
> -(at)erase "$(INTDIR)\fe-misc.obj"
> -(at)erase "$(INTDIR)\fe-print.obj"
> -(at)erase "$(INTDIR)\fe-secure.obj"
> -(at)erase "$(INTDIR)\pqexpbuffer.obj"
> -(at)erase "$(OUTDIR)\libpqdll.obj"
> -(at)erase "$(OUTDIR)\win32.obj"
> -(at)erase "$(INTDIR)\wchar.obj"
> -(at)erase "$(INTDIR)\encnames.obj"
> -(at)erase "$(INTDIR)\noblock.obj"
> -(at)erase "$(INTDIR)\pgstrcasecmp.obj"
> -(at)erase "$(OUTDIR)\libpq.res"
> -(at)erase "$(OUTDIR)\blibpq.lib"
> -(at)erase "$(OUTDIR)\blibpqdll.lib"
> -(at)erase "$(OUTDIR)\blibpq.dll"
> -(at)erase "$(OUTDIR)\blibpq.tds"
>
> config: ..\..\include\pg_config.h pthread.h pg_config_paths.h
>
> ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32
> copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h
>
> pthread.h: pthread.h.win32
> copy pthread.h.win32 pthread.h
>
> pg_config_paths.h: win32.mak
> echo #define SYSCONFDIR "" >pg_config_paths.h
>
> "$(OUTDIR)" :
> @if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
>
> "$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
> $(LINK32) @&&!
> $(LINK32_FLAGS) +
> c0d32.obj $(LINK32_OBJS), +
> $@,, +
> "$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
> blibpqdll.def,"$(INTDIR)\libpq.res"
> !
> implib -w "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@
>
> "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
> $(RSC) $(RSC_PROJ) libpq.rc
>
> "$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
> $(LIB32) $@ @&&!
> +-"$(**: =" &^
> +-")"
> !
>
>
> .c.obj:
> $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073


From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: [pgsql-hackers-win32] Borland c++ compile problems...
Date: 2004-07-26 02:01:15
Message-ID: 200407260201.i6Q21FG19130@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches


Here is the patch you submitted. Did you mean to uncomment out the BCB
line:

! BCB=c:\Borland\Bcc55

Also, did you mean to remove the trailing G on this line:

! CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBU

---------------------------------------------------------------------------

Steve Holdoway wrote:
> Bruce Momjian wrote:
>
> >Steve Holdoway wrote:
> >
> >
> >>Bruce Momjian wrote:
> >>
> >>
> >>
> >>>Steve Holdoway wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Sorry to be a pest, and all that. However, it looks like make needs to
> >>>>be run in src\port, to create pg_config_paths.h, and compile stuff to
> >>>>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
> >>>>(? bit worried about that one!)
> >>>>
> >>>>I had a go at rewriting an existing bcc32.mak, but just seemed to
> >>>>generate more errors!
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Uh, I don't see how those would fail. What errors are you seeing?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>Well, in the port subdirectory, one of the things that is generated by
> >>the makefile is pg_config_paths.h. Without this, libpq will not compile.
> >>As I stated above, cobbling this together manually then gets me to the
> >>place where the aforementioned external references are not resolved. All
> >>are in source files in the port directory.
> >>
> >>The errors I'm seeing are all caused by includes not being found, etc. I
> >>don't know what to do when they are ones like strings.h, which I do not
> >>have either in the snapshot source tree, or in the Borland bcc 5.5 tree.
> >>
> >>I also don't know how you want the above files building... into a
> >>library, static or dynamic/straight object code, etc. There is also no
> >>listing in the current bcc32.mak files to include them into the libpq
> >>dll generation.
> >>
> >>
> >
> >OK, if you look at the last few commits to interfaces/libpq/win32.mak,
> >you will see changes for pg_config_paths.h and for thread safety. Can
> >you look at those changes, merge them into bcc.mak. There might be
> >other changes in there you want to add to bcc.mak too.
> >
> >
> >
> OK, having no M$ diff, I attach files src\interfaces\libpq\bcc32.mak and
> src\interfaces\libpq\win32.h
>
> bcc32.mak incorporates the changes in win32.mak, and adds a couple of
> extra source files from the ..\..\port directory, and win32.h was used
> to #define popen -> _popen.
>
> All seems to work after a *very* cursory test!
>
> Can I get back to the land of proper slashes now???
>
> Cheers,
>
> Steve

> # Makefile for Borland C++ 5.5
>
> # Will build a Win32 static library libpq.lib
> # and a Win32 dynamic library libpq.dll with import library libpqdll.lib
>
> # Borland C++ base install directory goes here
> BCB=c:\Borland\Bcc55
>
> !MESSAGE Building the Win32 DLL and Static Library...
> !MESSAGE
> !IF "$(CFG)" == ""
> CFG=Release
> !MESSAGE No configuration specified. Defaulting to Release.
> !MESSAGE
> !ELSE
> !MESSAGE Configuration "$(CFG)"
> !MESSAGE
> !ENDIF
>
> !IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
> !MESSAGE Invalid configuration "$(CFG)" specified.
> !MESSAGE You can specify a configuration when running MAKE
> !MESSAGE by defining the macro CFG on the command line. For example:
> !MESSAGE
> !MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
> !MESSAGE
> !MESSAGE Possible choices for configuration are:
> !MESSAGE
> !MESSAGE "Release" (Win32 Release DLL and Static Library)
> !MESSAGE "Debug" (Win32 Debug DLL and Static Library)
> !MESSAGE
> !ERROR An invalid configuration was specified.
> !ENDIF
>
> !IF "$(OS)" == "Windows_NT"
> NULL=
> !ELSE
> NULL=nul
> !ENDIF
>
> !IF "$(CFG)" == "Debug"
> DEBUG=1
> OUTDIR=.\Debug
> INTDIR=.\Debug
> !else
> OUTDIR=.\Release
> INTDIR=.\Release
> !endif
>
> USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;
>
> CPP=bcc32.exe
> CPP_PROJ = -I$(BCB)\include;..\..\include -WD -c -D$(USERDEFINES) -tWM \
> -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc
>
> !IFDEF DEBUG
> CPP_PROJ = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
> !else
> CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBU
> !endif
>
> LIB32=tlib.exe
> LIB32_FLAGS=
> LIB32_OBJS= \
> "$(OUTDIR)\win32.obj" \
> "$(INTDIR)\getaddrinfo.obj" \
> "$(INTDIR)\thread.obj" \
> "$(INTDIR)\inet_aton.obj" \
> "$(INTDIR)\crypt.obj" \
> "$(INTDIR)\path.obj" \
> "$(INTDIR)\noblock.obj" \
> "$(INTDIR)\pgstrcasecmp.obj" \
> "$(INTDIR)\dllist.obj" \
> "$(INTDIR)\md5.obj" \
> "$(INTDIR)\ip.obj" \
> "$(INTDIR)\fe-auth.obj" \
> "$(INTDIR)\fe-protocol2.obj" \
> "$(INTDIR)\fe-protocol3.obj" \
> "$(INTDIR)\fe-connect.obj" \
> "$(INTDIR)\fe-exec.obj" \
> "$(INTDIR)\fe-lobj.obj" \
> "$(INTDIR)\fe-misc.obj" \
> "$(INTDIR)\fe-print.obj" \
> "$(INTDIR)\fe-secure.obj" \
> "$(INTDIR)\pqexpbuffer.obj" \
> "$(INTDIR)\wchar.obj" \
> "$(INTDIR)\encnames.obj"
>
>
> RSC=brcc32.exe
> RSC_PROJ=-l 0x409 -i$(BCB)\include -fo"$(INTDIR)\libpq.res"
>
> 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"
>
> CLEAN :
> -(at)erase "$(INTDIR)\getaddrinfo.obj"
> -(at)erase "$(INTDIR)\thread.obj"
> -(at)erase "$(INTDIR)\inet_aton.obj"
> -(at)erase "$(INTDIR)\crypt.obj"
> -(at)erase "$(INTDIR)\path.obj"
> -(at)erase "$(INTDIR)\dllist.obj"
> -(at)erase "$(INTDIR)\md5.obj"
> -(at)erase "$(INTDIR)\ip.obj"
> -(at)erase "$(INTDIR)\fe-auth.obj"
> -(at)erase "$(INTDIR)\fe-protocol2.obj"
> -(at)erase "$(INTDIR)\fe-protocol3.obj"
> -(at)erase "$(INTDIR)\fe-connect.obj"
> -(at)erase "$(INTDIR)\fe-exec.obj"
> -(at)erase "$(INTDIR)\fe-lobj.obj"
> -(at)erase "$(INTDIR)\fe-misc.obj"
> -(at)erase "$(INTDIR)\fe-print.obj"
> -(at)erase "$(INTDIR)\fe-secure.obj"
> -(at)erase "$(INTDIR)\pqexpbuffer.obj"
> -(at)erase "$(OUTDIR)\libpqdll.obj"
> -(at)erase "$(OUTDIR)\win32.obj"
> -(at)erase "$(INTDIR)\wchar.obj"
> -(at)erase "$(INTDIR)\encnames.obj"
> -(at)erase "$(INTDIR)\noblock.obj"
> -(at)erase "$(INTDIR)\pgstrcasecmp.obj"
> -(at)erase "$(OUTDIR)\libpq.res"
> -(at)erase "$(OUTDIR)\blibpq.lib"
> -(at)erase "$(OUTDIR)\blibpqdll.lib"
> -(at)erase "$(OUTDIR)\blibpq.dll"
> -(at)erase "$(OUTDIR)\blibpq.tds"
>
> config: ..\..\include\pg_config.h pthread.h pg_config_paths.h
>
> ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32
> copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h
>
> pthread.h: pthread.h.win32
> copy pthread.h.win32 pthread.h
>
> pg_config_paths.h: win32.mak
> echo #define SYSCONFDIR "" >pg_config_paths.h
>
> "$(OUTDIR)" :
> @if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
>
> "$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
> $(LINK32) @&&!
> $(LINK32_FLAGS) +
> c0d32.obj $(LINK32_OBJS), +
> $@,, +
> "$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
> blibpqdll.def,"$(INTDIR)\libpq.res"
> !
> implib -w "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@
>
> "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
> $(RSC) $(RSC_PROJ) libpq.rc
>
> "$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
> $(LIB32) $@ @&&!
> +-"$(**: =" &^
> +-")"
> !
>
>
> .c.obj:
> $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
>

[ text/x-c-header is unsupported, treating like TEXT/PLAIN ]

> #ifndef __win32_h_included
> #define __win32_h_included
>
> /*
> * Some compatibility functions
> */
> #ifdef __BORLANDC__
> #define _timeb timeb
> #define _ftime(a) ftime(a)
> #define _errno errno
> #define popen(a,b) _popen(a,b)
> #else
> /* open provided elsewhere */
> #define close(a) _close(a)
> #define read(a,b,c) _read(a,b,c)
> #define write(a,b,c) _write(a,b,c)
> #endif
>
> #define vsnprintf(a,b,c,d) _vsnprintf(a,b,c,d)
> #define snprintf _snprintf
>
> #undef EAGAIN /* doesn't apply on sockets */
> #undef EINTR
> #define EINTR WSAEINTR
> #define EWOULDBLOCK WSAEWOULDBLOCK
> #define ECONNRESET WSAECONNRESET
> #define EINPROGRESS WSAEINPROGRESS
>
> /*
> * support for handling Windows Socket errors
> */
> extern const char *winsock_strerror(int err, char *strerrbuf, size_t buflen);
>
> #endif

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 4.1 KB

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Steve Holdoway <steve(at)treshna(dot)com>
Cc: pgsql-hackers-win32(at)postgresql(dot)org
Subject: Re: Borland c++ compile problems...
Date: 2004-07-31 06:21:14
Message-ID: 200407310621.i6V6LEw03260@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers-win32 pgsql-patches


I have not heard back from you so I removed the parts of your patch which
looked wrong and have applied the attached version of the patch.

---------------------------------------------------------------------------

Steve Holdoway wrote:
> Bruce Momjian wrote:
>
> >Steve Holdoway wrote:
> >
> >
> >>Bruce Momjian wrote:
> >>
> >>
> >>
> >>>Steve Holdoway wrote:
> >>>
> >>>
> >>>
> >>>
> >>>>Sorry to be a pest, and all that. However, it looks like make needs to
> >>>>be run in src\port, to create pg_config_paths.h, and compile stuff to
> >>>>resolve externals _set_noblock, _pg_strcasecmp, _pg_tolower, and _popen
> >>>>(? bit worried about that one!)
> >>>>
> >>>>I had a go at rewriting an existing bcc32.mak, but just seemed to
> >>>>generate more errors!
> >>>>
> >>>>
> >>>>
> >>>>
> >>>Uh, I don't see how those would fail. What errors are you seeing?
> >>>
> >>>
> >>>
> >>>
> >>>
> >>Well, in the port subdirectory, one of the things that is generated by
> >>the makefile is pg_config_paths.h. Without this, libpq will not compile.
> >>As I stated above, cobbling this together manually then gets me to the
> >>place where the aforementioned external references are not resolved. All
> >>are in source files in the port directory.
> >>
> >>The errors I'm seeing are all caused by includes not being found, etc. I
> >>don't know what to do when they are ones like strings.h, which I do not
> >>have either in the snapshot source tree, or in the Borland bcc 5.5 tree.
> >>
> >>I also don't know how you want the above files building... into a
> >>library, static or dynamic/straight object code, etc. There is also no
> >>listing in the current bcc32.mak files to include them into the libpq
> >>dll generation.
> >>
> >>
> >
> >OK, if you look at the last few commits to interfaces/libpq/win32.mak,
> >you will see changes for pg_config_paths.h and for thread safety. Can
> >you look at those changes, merge them into bcc.mak. There might be
> >other changes in there you want to add to bcc.mak too.
> >
> >
> >
> OK, having no M$ diff, I attach files src\interfaces\libpq\bcc32.mak and
> src\interfaces\libpq\win32.h
>
> bcc32.mak incorporates the changes in win32.mak, and adds a couple of
> extra source files from the ..\..\port directory, and win32.h was used
> to #define popen -> _popen.
>
> All seems to work after a *very* cursory test!
>
> Can I get back to the land of proper slashes now???
>
> Cheers,
>
> Steve

> # Makefile for Borland C++ 5.5
>
> # Will build a Win32 static library libpq.lib
> # and a Win32 dynamic library libpq.dll with import library libpqdll.lib
>
> # Borland C++ base install directory goes here
> BCB=c:\Borland\Bcc55
>
> !MESSAGE Building the Win32 DLL and Static Library...
> !MESSAGE
> !IF "$(CFG)" == ""
> CFG=Release
> !MESSAGE No configuration specified. Defaulting to Release.
> !MESSAGE
> !ELSE
> !MESSAGE Configuration "$(CFG)"
> !MESSAGE
> !ENDIF
>
> !IF "$(CFG)" != "Release" && "$(CFG)" != "Debug"
> !MESSAGE Invalid configuration "$(CFG)" specified.
> !MESSAGE You can specify a configuration when running MAKE
> !MESSAGE by defining the macro CFG on the command line. For example:
> !MESSAGE
> !MESSAGE make -DCFG=[Release | Debug] /f bcc32.mak
> !MESSAGE
> !MESSAGE Possible choices for configuration are:
> !MESSAGE
> !MESSAGE "Release" (Win32 Release DLL and Static Library)
> !MESSAGE "Debug" (Win32 Debug DLL and Static Library)
> !MESSAGE
> !ERROR An invalid configuration was specified.
> !ENDIF
>
> !IF "$(OS)" == "Windows_NT"
> NULL=
> !ELSE
> NULL=nul
> !ENDIF
>
> !IF "$(CFG)" == "Debug"
> DEBUG=1
> OUTDIR=.\Debug
> INTDIR=.\Debug
> !else
> OUTDIR=.\Release
> INTDIR=.\Release
> !endif
>
> USERDEFINES=FRONTEND;NDEBUG;WIN32;_WINDOWS;HAVE_VSNPRINTF;HAVE_STRDUP;
>
> CPP=bcc32.exe
> CPP_PROJ = -I$(BCB)\include;..\..\include -WD -c -D$(USERDEFINES) -tWM \
> -a8 -X -w-use -w-par -w-pia -w-csu -w-aus -w-ccc
>
> !IFDEF DEBUG
> CPP_PROJ = $(CPP_PROJ) -Od -r- -k -v -y -vi- -D_DEBUG
> !else
> CPP_PROJ = $(CPP_PROJ) -O -Oi -OS -DNDEBU
> !endif
>
> LIB32=tlib.exe
> LIB32_FLAGS=
> LIB32_OBJS= \
> "$(OUTDIR)\win32.obj" \
> "$(INTDIR)\getaddrinfo.obj" \
> "$(INTDIR)\thread.obj" \
> "$(INTDIR)\inet_aton.obj" \
> "$(INTDIR)\crypt.obj" \
> "$(INTDIR)\path.obj" \
> "$(INTDIR)\noblock.obj" \
> "$(INTDIR)\pgstrcasecmp.obj" \
> "$(INTDIR)\dllist.obj" \
> "$(INTDIR)\md5.obj" \
> "$(INTDIR)\ip.obj" \
> "$(INTDIR)\fe-auth.obj" \
> "$(INTDIR)\fe-protocol2.obj" \
> "$(INTDIR)\fe-protocol3.obj" \
> "$(INTDIR)\fe-connect.obj" \
> "$(INTDIR)\fe-exec.obj" \
> "$(INTDIR)\fe-lobj.obj" \
> "$(INTDIR)\fe-misc.obj" \
> "$(INTDIR)\fe-print.obj" \
> "$(INTDIR)\fe-secure.obj" \
> "$(INTDIR)\pqexpbuffer.obj" \
> "$(INTDIR)\wchar.obj" \
> "$(INTDIR)\encnames.obj"
>
>
> RSC=brcc32.exe
> RSC_PROJ=-l 0x409 -i$(BCB)\include -fo"$(INTDIR)\libpq.res"
>
> 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"
>
> CLEAN :
> -(at)erase "$(INTDIR)\getaddrinfo.obj"
> -(at)erase "$(INTDIR)\thread.obj"
> -(at)erase "$(INTDIR)\inet_aton.obj"
> -(at)erase "$(INTDIR)\crypt.obj"
> -(at)erase "$(INTDIR)\path.obj"
> -(at)erase "$(INTDIR)\dllist.obj"
> -(at)erase "$(INTDIR)\md5.obj"
> -(at)erase "$(INTDIR)\ip.obj"
> -(at)erase "$(INTDIR)\fe-auth.obj"
> -(at)erase "$(INTDIR)\fe-protocol2.obj"
> -(at)erase "$(INTDIR)\fe-protocol3.obj"
> -(at)erase "$(INTDIR)\fe-connect.obj"
> -(at)erase "$(INTDIR)\fe-exec.obj"
> -(at)erase "$(INTDIR)\fe-lobj.obj"
> -(at)erase "$(INTDIR)\fe-misc.obj"
> -(at)erase "$(INTDIR)\fe-print.obj"
> -(at)erase "$(INTDIR)\fe-secure.obj"
> -(at)erase "$(INTDIR)\pqexpbuffer.obj"
> -(at)erase "$(OUTDIR)\libpqdll.obj"
> -(at)erase "$(OUTDIR)\win32.obj"
> -(at)erase "$(INTDIR)\wchar.obj"
> -(at)erase "$(INTDIR)\encnames.obj"
> -(at)erase "$(INTDIR)\noblock.obj"
> -(at)erase "$(INTDIR)\pgstrcasecmp.obj"
> -(at)erase "$(OUTDIR)\libpq.res"
> -(at)erase "$(OUTDIR)\blibpq.lib"
> -(at)erase "$(OUTDIR)\blibpqdll.lib"
> -(at)erase "$(OUTDIR)\blibpq.dll"
> -(at)erase "$(OUTDIR)\blibpq.tds"
>
> config: ..\..\include\pg_config.h pthread.h pg_config_paths.h
>
> ..\..\include\pg_config.h: ..\..\include\pg_config.h.win32
> copy ..\..\include\pg_config.h.win32 ..\..\include\pg_config.h
>
> pthread.h: pthread.h.win32
> copy pthread.h.win32 pthread.h
>
> pg_config_paths.h: win32.mak
> echo #define SYSCONFDIR "" >pg_config_paths.h
>
> "$(OUTDIR)" :
> @if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
>
> "$(OUTDIR)\blibpq.dll": "$(OUTDIR)\blibpq.lib" $(LINK32_OBJS) "$(INTDIR)\libpq.res" blibpqdll.def
> $(LINK32) @&&!
> $(LINK32_FLAGS) +
> c0d32.obj $(LINK32_OBJS), +
> $@,, +
> "$(OUTDIR)\blibpq.lib" import32.lib cw32mti.lib, +
> blibpqdll.def,"$(INTDIR)\libpq.res"
> !
> implib -w "$(OUTDIR)\blibpqdll.lib" blibpqdll.def $@
>
> "$(INTDIR)\libpq.res" : "$(INTDIR)" libpq.rc
> $(RSC) $(RSC_PROJ) libpq.rc
>
> "$(OUTDIR)\blibpq.lib": $(LIB32_OBJS)
> $(LIB32) $@ @&&!
> +-"$(**: =" &^
> +-")"
> !
>
>
> .c.obj:
> $(CPP) -o"$(INTDIR)\$&" $(CPP_PROJ) $<
>

>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
> subscribe-nomail command to majordomo(at)postgresql(dot)org so that your
> message can get through to the mailing list cleanly

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 3.2 KB