pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Problems with linking against PostgreSQL 8.4
8+ messages / 3 participants
[nested] [flat]

* Problems with linking against PostgreSQL 8.4
@ 2013-12-06 17:22 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  0 siblings, 1 reply; 8+ messages in thread

From: Pavel Raiskup @ 2013-12-06 17:22 UTC (permalink / raw)
  To: pgsql-odbc

Hi, I tried to build the latest git version of postgresql odbc driver and
(even if the build seems to be complete) there is a linkage problem:

  $ ldd -r ./.libs/psqlodbcw.so > /dev/null
  undefined symbol: PQconnectdbParams     (./.libs/psqlodbcw.so)

I see that the symbol was added to PostgreSQL project in ~2010 and it
seems to be a problem.  Should I expect that newer drivers are able to be
run against older (still supported by PostgreSQL community) PostgreSQL
server, namely 8.4.13?

If that ^^ is a problem, could you please fix that?  I could possibly look
at some configure.ac/#ifdef solution and propose a patch if you are not
against that..

Thanks, Pavel



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
@ 2013-12-06 18:29 ` Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Boszormenyi Zoltan @ 2013-12-06 18:29 UTC (permalink / raw)
  To: Pavel Raiskup <praiskup@redhat.com>; pgsql-odbc

2013-12-06 18:22 keltezéssel, Pavel Raiskup írta:
> Hi, I tried to build the latest git version of postgresql odbc driver and
> (even if the build seems to be complete) there is a linkage problem:
>
>    $ ldd -r ./.libs/psqlodbcw.so > /dev/null
>    undefined symbol: PQconnectdbParams     (./.libs/psqlodbcw.so)
>
> I see that the symbol was added to PostgreSQL project in ~2010 and it
> seems to be a problem.  Should I expect that newer drivers are able to be
> run against older (still supported by PostgreSQL community) PostgreSQL
> server, namely 8.4.13?

You need to compile against a newer libpq but after that,
you can connect to an older server.

>
> If that ^^ is a problem, could you please fix that?  I could possibly look
> at some configure.ac/#ifdef solution and propose a patch if you are not
> against that..
>
> Thanks, Pavel
>
>
>


-- 
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
Gröhrmühlgasse 26
A-2700 Wiener Neustadt, Austria
Web: http://www.postgresql-support.de
      http://www.postgresql.at/



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
@ 2013-12-06 18:42   ` Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 21:11     ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Pavel Raiskup @ 2013-12-06 18:42 UTC (permalink / raw)
  To: Boszormenyi Zoltan <zb@cybertec.at>; +Cc: pgsql-odbc

> > I see that the symbol was added to PostgreSQL project in ~2010 and it
> > seems to be a problem.  Should I expect that newer drivers are able to be
> > run against older (still supported by PostgreSQL community) PostgreSQL
> > server, namely 8.4.13?
> 
> You need to compile against a newer libpq but after that,
> you can connect to an older server.

Ah yes, that would be possible, thanks!  But still, if that is expected -
we should at least check older libpq's via configure.ac and blacklist
them, or?  It is pretty usual to have installed server & libpq of the same
version on the same machine...

Pavel



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
@ 2013-12-06 21:11     ` Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-07 09:40       ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Heikki Linnakangas @ 2013-12-06 21:11 UTC (permalink / raw)
  To: Pavel Raiskup <praiskup@redhat.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; pgsql-odbc

On 12/06/2013 08:42 PM, Pavel Raiskup wrote:
>>> I see that the symbol was added to PostgreSQL project in ~2010 and it
>>> seems to be a problem.  Should I expect that newer drivers are able to be
>>> run against older (still supported by PostgreSQL community) PostgreSQL
>>> server, namely 8.4.13?
>>
>> You need to compile against a newer libpq but after that,
>> you can connect to an older server.
>
> Ah yes, that would be possible, thanks!  But still, if that is expected -
> we should at least check older libpq's via configure.ac and blacklist
> them, or?

Yeah, a configure test would be nice. Patches are welcome ;-)

- Heikki


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 21:11     ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-12-07 09:40       ` Pavel Raiskup <praiskup@redhat.com>
  2013-12-08 20:12         ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
  0 siblings, 1 reply; 8+ messages in thread

From: Pavel Raiskup @ 2013-12-07 09:40 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; pgsql-odbc

On Friday, December 06, 2013 23:11:40 Heikki Linnakangas wrote:
> On 12/06/2013 08:42 PM, Pavel Raiskup wrote:
> >>> I see that the symbol was added to PostgreSQL project in ~2010 and it
> >>> seems to be a problem.  Should I expect that newer drivers are able to be
> >>> run against older (still supported by PostgreSQL community) PostgreSQL
> >>> server, namely 8.4.13?
> >>
> >> You need to compile against a newer libpq but after that,
> >> you can connect to an older server.
> >
> > Ah yes, that would be possible, thanks!  But still, if that is expected -
> > we should at least check older libpq's via configure.ac and blacklist
> > them, or?
> 
> Yeah, a configure test would be nice. Patches are welcome ;-)

I'll be glad, just to make it clear :).  Do you want remove support for
libpq 8.4 completely or make configure check for PQconnectdbParams (to
make the code work without PQconnectdbParams)?  The later makes more sense
to me as 8.4 is still not dead (and will probably exist in REL8_4_STABLE
branch some time).



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 21:11     ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-07 09:40       ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
@ 2013-12-08 20:12         ` Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-09 17:31           ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-10 08:58           ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  0 siblings, 2 replies; 8+ messages in thread

From: Heikki Linnakangas @ 2013-12-08 20:12 UTC (permalink / raw)
  To: Pavel Raiskup <praiskup@redhat.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; pgsql-odbc

On 12/07/2013 11:40 AM, Pavel Raiskup wrote:
> On Friday, December 06, 2013 23:11:40 Heikki Linnakangas wrote:
>> On 12/06/2013 08:42 PM, Pavel Raiskup wrote:
>>>>> I see that the symbol was added to PostgreSQL project in ~2010 and it
>>>>> seems to be a problem.  Should I expect that newer drivers are able to be
>>>>> run against older (still supported by PostgreSQL community) PostgreSQL
>>>>> server, namely 8.4.13?
>>>>
>>>> You need to compile against a newer libpq but after that,
>>>> you can connect to an older server.
>>>
>>> Ah yes, that would be possible, thanks!  But still, if that is expected -
>>> we should at least check older libpq's via configure.ac and blacklist
>>> them, or?
>>
>> Yeah, a configure test would be nice. Patches are welcome ;-)
>
> I'll be glad, just to make it clear :).  Do you want remove support for
> libpq 8.4 completely or make configure check for PQconnectdbParams (to
> make the code work without PQconnectdbParams)?  The later makes more sense
> to me as 8.4 is still not dead (and will probably exist in REL8_4_STABLE
> branch some time)

Actually, now that I look closer into that, the situation is a bit 
messy. There's a runtime check in loadlib.c, which tests if the version 
of libpq being used has the PQconnectdbParams() function. But we still 
link against libpq normally, so the library still won't load if that 
function isn't present, even though we have the code in place to check 
and refrain from actually calling it. So that's a bit broken.

But even more funnily, the only caller of PQconnectdbParams() is 
actually dead code (connection.c):

> 	if (FALSE && connect_with_param_available())
> 	{
> 		const char *opts[PROTOCOL3_OPTS_MAX], *vals[PROTOCOL3_OPTS_MAX];
>
> 		protocol3_opts_array(self, opts, vals, TRUE, sizeof(opts) / sizeof(opts[0]));
> 		pqconn = CALL_PQconnectdbParams(opts, vals, &libpqLoaded);
> 	}
> 	else
> 	{

So we don't actually ever use PQconnectdbParams() for anything.

Want to take a stab at cleaning up that mess?

- Heikki


-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 21:11     ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-07 09:40       ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-08 20:12         ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-12-09 17:31           ` Pavel Raiskup <praiskup@redhat.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Pavel Raiskup @ 2013-12-09 17:31 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; pgsql-odbc

Heikki,

> [...]
> So we don't actually ever use PQconnectdbParams() for anything.

Thanks for this analysis!

> Want to take a stab at cleaning up that mess?

Yes, I can look at it.  Do you plan to public new release in near future?

Pavel



-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



^ permalink  raw  reply  [nested|flat] 8+ messages in thread

* Re: Problems with linking against PostgreSQL 8.4
  2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 18:29 ` Re: Problems with linking against PostgreSQL 8.4 Boszormenyi Zoltan <zb@cybertec.at>
  2013-12-06 18:42   ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-06 21:11     ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
  2013-12-07 09:40       ` Re: Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
  2013-12-08 20:12         ` Re: Problems with linking against PostgreSQL 8.4 Heikki Linnakangas <hlinnakangas@vmware.com>
@ 2013-12-10 08:58           ` Pavel Raiskup <praiskup@redhat.com>
  1 sibling, 0 replies; 8+ messages in thread

From: Pavel Raiskup @ 2013-12-10 08:58 UTC (permalink / raw)
  To: Heikki Linnakangas <hlinnakangas@vmware.com>; +Cc: Boszormenyi Zoltan <zb@cybertec.at>; pgsql-odbc

> > I'll be glad, just to make it clear :).  Do you want remove support for
> > libpq 8.4 completely or make configure check for PQconnectdbParams (to
> > make the code work without PQconnectdbParams)?  The later makes more sense
> > to me as 8.4 is still not dead (and will probably exist in REL8_4_STABLE
> > branch some time)
>
> Actually, now that I look closer into that, the situation is a bit
> messy. There's a runtime check in loadlib.c, which tests if the version
> of libpq being used has the PQconnectdbParams() function. But we still
> link against libpq normally, so the library still won't load if that
> function isn't present, even though we have the code in place to check
> and refrain from actually calling it. So that's a bit broken.

Ok, we could theoretically remove the "static" call to
PQconnectdbParams() and just have some function pointer which would be set by
lt_dlsym().  But I'm not sure this is fundamentally correct approach.  The
libpq.so library is not IMO designed for such usecase.  From my point of view
is better approach to not link against PQconnectdbParams at all if that
function is not present in the library you are linking against.  So
possible heads-up patch is attached.

> But even more funnily, the only caller of PQconnectdbParams() is
> actually dead code (connection.c):
> [...]
> So we don't actually ever use PQconnectdbParams() for anything.
>
> Want to take a stab at cleaning up that mess?

Actually - there is a lot of non-linux stuff which I am afraid I am unable to
test properly (it would take a lot of time).  Looking at the code, I could
remove a LOT of unused code which would be pity imo.  That code seems to call
for fix rather than removal..  I could be able to help you more;  but I don't
know now what is the safe way..

Pavel

-- 
Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc

Attachments:

fix.patch (text/x-patch, 2.5K) download commit 80afc3dfe2f73cc6f496d5ab41a0a073b4706026 Author: Pavel Raiskup <praiskup@redhat.com> AuthorDate: Tue Dec 10 09:35:18 2013 +0100 Commit: Pavel Raiskup <praiskup@redhat.com> CommitDate: Tue Dec 10 09:35:18 2013 +0100 loadlib: better check for PQconnectdbParams Cleanup things a little: Don't statically link the PQconnectdbParams if it is not system available. Drop the libtool requirement as it is not needed now. diff --git a/configure.ac b/configure.ac index 14450de..e844ca1 100644 --- a/configure.ac +++ b/configure.ac @@ -269,7 +269,13 @@ fi if test "$with_libpq" != no; then AC_CHECK_LIB(pq, PQconnectdb, [], - [AC_MSG_ERROR([libpq library not found])]) + [AC_MSG_ERROR([libpq library not found])]) + if test "x$ac_cv_lib_pq_PQconnectdb" = "xyes"; then + AC_CHECK_LIB(pq, PQconnectdbParams, + [AC_DEFINE(HAVE_PQCONNECTDBPARAMS, 1, + [Define to 1 if you have PQconnectdbParams])]) + + fi fi if test "$enable_openssl" = yes; then @@ -363,9 +369,5 @@ AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) fi -# 8. Libltdl -AC_CHECK_LIB(ltdl, lt_dlopen) - - AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/loadlib.c b/loadlib.c index b88eb71..b0d6f9c 100644 --- a/loadlib.c +++ b/loadlib.c @@ -331,13 +331,13 @@ BOOL connect_with_param_available(void) { #if defined(_MSC_DELAY_LOAD_IMPORT) __try { -#if (_MSC_VER < 1300) +# if (_MSC_VER < 1300) __pfnDliFailureHook = DliErrorHook; __pfnDliNotifyHook = DliErrorHook; -#else +# else __pfnDliFailureHook2 = DliErrorHook; __pfnDliNotifyHook2 = DliErrorHook; -#endif /* _MSC_VER */ +# endif /* _MSC_VER */ PQescapeLiteral(NULL, NULL, 0); } __except (filter_env2encoding(GetExceptionCode())) { @@ -348,17 +348,11 @@ inolog("connect_withparam_available is set to false\n"); connect_withparam_available = 0; } #else -#ifdef HAVE_LIBLTDL - lt_dlhandle dlhandle = lt_dlopenext(libpqlib); - + /* non MSC platforms */ + connect_withparam_available = 0; +# ifdef HAVE_PQCONNECTDBPARAMS connect_withparam_available = 1; - if (NULL != dlhandle) - { - if (NULL == lt_dlsym(dlhandle, checkproc1)) - connect_withparam_available = 0; - lt_dlclose(dlhandle); - } -#endif /* HAVE_LIBLTDL */ +# endif /* HAVE_PQCONNECTDBPARAMS */ #endif /* _MSC_DELAY_LOAD_IMPORT */ } @@ -436,7 +430,9 @@ inolog("calling PQconnectdbParams\n"); */ } #else +# ifdef HAVE_PQCONNECTDBPARAMS pqconn = PQconnectdbParams(opts, vals, 0); +# endif #endif /* _MSC_DELAY_LOAD_IMPORT */ return pqconn; }
^ permalink raw reply [nested|flat] 8+ messages in thread


end of thread, other threads:[~2013-12-10 08:58 UTC | newest]

Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2013-12-06 17:22 Problems with linking against PostgreSQL 8.4 Pavel Raiskup <praiskup@redhat.com>
2013-12-06 18:29 ` Boszormenyi Zoltan <zb@cybertec.at>
2013-12-06 18:42   ` Pavel Raiskup <praiskup@redhat.com>
2013-12-06 21:11     ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-12-07 09:40       ` Pavel Raiskup <praiskup@redhat.com>
2013-12-08 20:12         ` Heikki Linnakangas <hlinnakangas@vmware.com>
2013-12-09 17:31           ` Pavel Raiskup <praiskup@redhat.com>
2013-12-10 08:58           ` Pavel Raiskup <praiskup@redhat.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox