Обсуждение: build WIN32 ODBC using VC++, not Cygwin/gcc

Поиск
Список
Период
Сортировка

build WIN32 ODBC using VC++, not Cygwin/gcc

От
Fred Yankowski
Дата:
To build the PostgreSQL ODBC driver from CVS (or a recent
snapshot/beta, I presume): the following steps worked for me:

+ Make sure that the psqlodbc.def file in interfaces/odbc is exactly
  as distributed or obtained from CVS, not the result of some prior build.

+ Run 'configure' _without_ '--with-odbc' to build PostgreSQL.

+ Follow the steps in interfaces/odbc/readme.txt to build the ODBC DLL
  using MS Visual C++.

Building with '--with-odbc' will appear to work, but the resulting DLL
(created by Cygwin gcc/tools) completely fails to work for me once
installed.  (It would have been nice if the documentation gave a hint
about this.  Or did I miss it?  The presense of the readme.txt file
does not suffice to make it clear that VC++ is the _only_ correct way
to build the module for WIN32.)

I also got confused when first building the DLL from VC++, because my
prior efforts using '--with-odbc' left behind a psqlodbc.def file that
is incorrect.  My thanks to Hiroshi Inoue for helping me get past this.

--
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

Re: build WIN32 ODBC using VC++, not Cygwin/gcc

От
Peter Eisentraut
Дата:
Fred Yankowski writes:

> To build the PostgreSQL ODBC driver from CVS (or a recent
> snapshot/beta, I presume): the following steps worked for me:
[snip]
> + Run 'configure' _without_ '--with-odbc' to build PostgreSQL.

I doubt you need that, since you don't use the makefiles.

[snip]

> Building with '--with-odbc' will appear to work, but the resulting DLL
> (created by Cygwin gcc/tools) completely fails to work for me once
> installed.  (It would have been nice if the documentation gave a hint
> about this.  Or did I miss it?

Something more detailed thatn "completely fails to work" might shed some
light onto it.

> The presense of the readme.txt file does not suffice to make it clear
> that VC++ is the _only_ correct way to build the module for WIN32.)

True, it is not a very prominent place to hide such a thing.  Maybe it
would be appropriate to mention it in the "Installation on Windows"
chapter in the Administrator's Guide or alternatively in the ODBC chapter
in the Programmer's Guide.


Can somebody explain to me what this means, from said readme.txt:

"In order to use row versioning, you must overload the int4eq function for
use with the xid type."


--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/


Re: build WIN32 ODBC using VC++, not Cygwin/gcc

От
Fred Yankowski
Дата:
On Mon, Feb 05, 2001 at 08:06:28PM +0100, Peter Eisentraut wrote:
> > + Run 'configure' _without_ '--with-odbc' to build PostgreSQL.
>
> I doubt you need that, since you don't use the makefiles.

I stated that point for the benefit of those, like me, who are
building all of PG from source, not just building ODBC.  Using
'--with-odbc' in such a case has two problems:  1) it builds a useless
psqlodbc.dll; 2) it updates (AFAICT) psqlodbc.def to new data that
will cause a later, independent, build of psqlodbc.dll via VC++ to
fail.

> > Building with '--with-odbc' will appear to work, but the resulting DLL
> > (created by Cygwin gcc/tools) completely fails to work for me once
> > installed.  (It would have been nice if the documentation gave a hint
> > about this.  Or did I miss it?
>
> Something more detailed thatn "completely fails to work" might shed some
> light onto it.

I had posted earlier messages with more details (which got no response
other than from Mr. Hiroshi Inoue, who got me past the problem) so I
didn't repeat them in that message.  Anyway, here's what happens when
I build psqlodbc.dll as part of a complete pgsql build, having
configured with '--with-odbc':

+ The psqlodbc.dll file appears to build OK, with no warnings (that I
  recall).

+ When I overwrite my systemroot/system32/psqlodbc.dll with the one I
  just built, I then can no longer access any ODBC functions for
  PostgreSQL.  In particular:

   + The 'PostgreSQL' driver does appear in the list of drivers in the
     ODBC control panel.  However, its version & company information
     is not available.

   + When I select an existing System DSN using the PostgreSQL driver
     and click Configure, I get the message "The setup routines for
     the PostgreSQL ODBC driver could not be accessed.  Please
     reinstall the driver."

   + When I try to Add a new DSN using the PostgreSQL DSN, the same
     message results.

   + When I try to bring up my Zope website, which employs several
     ODBC connections (and is my only application using PG ODBC),
     accessing that site results in an application error from
     Zope/python saying "The instruction at '0x64eca3e5' referenced
     memory at '0x014f3e54'. The memory could not be 'read'.".
     Bringing up the VC++ debugger at that point gives me the message
     "Unhandled exception in python.exe (PSQLODBC.DLL): 0xC0000005:
     Access Violation".


--
Fred Yankowski           fred@OntoSys.com      tel: +1.630.879.1312
Principal Consultant     www.OntoSys.com       fax: +1.630.879.1370
OntoSys, Inc             38W242 Deerpath Rd, Batavia, IL 60510, USA

Re: build WIN32 ODBC using VC++, not Cygwin/gcc

От
Tom Lane
Дата:
Peter Eisentraut <peter_e@gmx.net> writes:
> Can somebody explain to me what this means, from said readme.txt:

> "In order to use row versioning, you must overload the int4eq function for
> use with the xid type."

Apparently, there is something in either the ODBC driver itself or MS
Access that expects to be able to do "WHERE xmin = integer".  Since we
supply no such operator in the standard distribution, one has to kluge
up the operator as illustrated.  Of course, this code will break if we
go to 8-byte XIDs ...

            regards, tom lane