Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VqJ9h-00089D-BH for pgsql-odbc@arkaria.postgresql.org; Tue, 10 Dec 2013 08:59:01 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VqJ9g-0006BT-RP for pgsql-odbc@arkaria.postgresql.org; Tue, 10 Dec 2013 08:59:00 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VqJ9f-0006BK-U1 for pgsql-odbc@postgresql.org; Tue, 10 Dec 2013 08:58:59 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VqJ9Z-00064W-9m for pgsql-odbc@postgresql.org; Tue, 10 Dec 2013 08:58:58 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id rBA8wmVA016472 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 10 Dec 2013 03:58:48 -0500 Received: from nb.usersys.redhat.com (unused-4-200.brq.redhat.com [10.34.4.200]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id rBA8wlRf024152; Tue, 10 Dec 2013 03:58:47 -0500 From: Pavel Raiskup To: Heikki Linnakangas Cc: Boszormenyi Zoltan , pgsql-odbc@postgresql.org Subject: Re: Problems with linking against PostgreSQL 8.4 Date: Tue, 10 Dec 2013 09:58:46 +0100 Message-ID: <2385162.nZqbQvSuGZ@nb.usersys.redhat.com> Organization: Red Hat User-Agent: KMail/4.11.3 (Linux/3.11.10-300.fc20.x86_64; KDE/4.11.3; x86_64; ; ) In-Reply-To: <52A4D2B7.4010601@vmware.com> References: <1875942.Ze3nnLVyR1@nb.usersys.redhat.com> <2503058.xKqvre6q2C@nb.usersys.redhat.com> <52A4D2B7.4010601@vmware.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart3451992.WO4DC1Sx33" Content-Transfer-Encoding: 7Bit X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 X-Pg-Spam-Score: -7.1 (-------) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-odbc Precedence: bulk Sender: pgsql-odbc-owner@postgresql.org This is a multi-part message in MIME format. --nextPart3451992.WO4DC1Sx33 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" > > 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 --nextPart3451992.WO4DC1Sx33 Content-Disposition: attachment; filename="fix.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="fix.patch" commit 80afc3dfe2f73cc6f496d5ab41a0a073b4706026 Author: Pavel Raiskup AuthorDate: Tue Dec 10 09:35:18 2013 +0100 Commit: Pavel Raiskup 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; } --nextPart3451992.WO4DC1Sx33 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-odbc mailing list (pgsql-odbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-odbc --nextPart3451992.WO4DC1Sx33--