Thread: --enable-odbc issue for Darwin/Mac OS X

--enable-odbc issue for Darwin/Mac OS X

From
Ronald Guest
Date:
I grabbed the current source using anon CVS and compiled it using a recent
Mac OS X build. I used --enable-odbc and ran into compile problems with four
files in interfaces/odbc (bind, columninfo, environ, tuplelist) because they
have an unconditional include of <malloc.h>. I manually changed the files
using the following conditional compile and they work fine. (I borrowed this
from a couple of other open source tools).

/* Ignore malloc.h if we have STDC_HEADERS */
#if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
#       include <malloc.h>
#endif

Unfortunately, I'm not adept with configure* files and don't feel equipped
to propose a change to those that would likely work on all platforms (i.e.
to check for stdlib.h/malloc.h. Can anyone assist or provide some guidance?

Thanks,
Ron

_______________________
Ronald Guest
Pepsan & Associates, Inc.             Creating Pathways to Excellence
ronald@pepsan.com
http://www.pepsan.com
_______________________

Nothing great was ever achieved without enthusiasm - Ralph Waldo Emerson



Re: --enable-odbc issue for Darwin/Mac OS X

From
Tom Lane
Date:
Ronald Guest <ronald@pepsan.com> writes:
> /* Ignore malloc.h if we have STDC_HEADERS */
> #if defined(HAVE_MALLOC_H) && !defined(STDC_HEADERS)
> #       include <malloc.h>
> #endif

I'd vote for ripping those includes out altogether.  No other part of
our sources needs <malloc.h>, and I don't believe ODBC does or should
either.

In a larger sense, the ODBC driver is probably not nearly as portable
as the rest of Postgres, because it hasn't gotten wrung out on as many
platforms.  Maybe we ought to start compiling it by default (not for
7.1 though ;-)).

            regards, tom lane

Re: --enable-odbc issue for Darwin/Mac OS X

From
Peter Eisentraut
Date:
Tom Lane writes:

> I'd vote for ripping those includes out altogether.  No other part of
> our sources needs <malloc.h>, and I don't believe ODBC does or should
> either.

Gone.

> In a larger sense, the ODBC driver is probably not nearly as portable
> as the rest of Postgres, because it hasn't gotten wrung out on as many
> platforms.  Maybe we ought to start compiling it by default (not for
> 7.1 though ;-)).

The greatest problem is the unportable use of the _init and _fini symbols
to hook into startup and shutdown.  If you're using GCC then you will get
GCC's portable wrapper for that, but it looks gloomy on other compilers.

More generally, the usefulness of the present ODBC driver would seem to
depend somewhat on the driver manager used with it.  The current Unix
build is geared toward iODBC, and we already had to mess with rather low
level shared library linking options to get that to work correctly.

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