From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: ml+postgresql@03s.net
Subject: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x
Date: Tue, 06 Jul 2021 11:42:34 +0000
Message-ID: <17083-a19190d9591946a7@postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 17083
Logged by: Adrian Ho
Email address: ml+postgresql@03s.net
PostgreSQL version: 13.3
Operating system: Ubuntu 20.04.2 LTS
Description:
OpenLDAP 2.5 merged the `ldap_r` and `ldap` libraries, so all per-handle
routines are now thread-safe by default. However, the removal of `ldap_r`
results in the following `configure` error:
```
checking for ldap_bind in -lldap... yes
checking for ldap_simple_bind in -lldap_r... no
configure: error: library 'ldap_r' is required for LDAP
```
This patch therefore fixes and clarifies the LDAP library detection
logic, by first selecting on thread-safety requirements, then looking
for the appropriate libraries. The underlying assumption is that for a
pre-2.5 setup, both `ldap` and `ldap_r` libraries are installed, so it
should only fall back to (thread-safe) `ldap` in a 2.5.x installation.
diff --git a/configure.in b/configure.inindex 14a6be6..02ad260 100644--- a/configure.in+++ b/configure.in@@ -1241,17 +1241,19 @@ fi
if test "$with_ldap" = yes ; then
_LIBS="$LIBS"
if test "$PORTNAME" != "win32"; then
- AC_CHECK_LIB(ldap, ldap_bind, [],- [AC_MSG_ERROR([library 'ldap' is required for LDAP])],- [$EXTRA_LDAP_LIBS])- LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
if test "$enable_thread_safety" = yes; then
# on some platforms ldap_r fails to link without PTHREAD_LIBS
- AC_CHECK_LIB(ldap_r, ldap_simple_bind, [],- [AC_MSG_ERROR([library 'ldap_r' is required for LDAP])],+ # OpenLDAP 2.5 merged ldap_r with ldap+ AC_SEARCH_LIBS(ldap_simple_bind, [ldap_r ldap], [],+ [AC_MSG_ERROR([not found in any LDAP library])],
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"+ LDAP_LIBS_FE="${ac_lib:+-l}$ac_lib $EXTRA_LDAP_LIBS"
else
+ AC_CHECK_LIB(ldap, ldap_bind, [],+ [AC_MSG_ERROR([library 'ldap' is required for LDAP])],+ [$EXTRA_LDAP_LIBS])+ LDAP_LIBS_BE="-lldap $EXTRA_LDAP_LIBS"
LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
fi
AC_CHECK_FUNCS([ldap_initialize])
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, ml+postgresql@03s.net
Subject: Re: BUG #17083: [PATCH] PostgreSQL fails to build with OpenLDAP 2.5.x
In-Reply-To: <17083-a19190d9591946a7@postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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