On Tue, Feb 26, 2019 at 9:11 PM Thomas Munro <[email protected]> wrote:
> On Tue, Feb 26, 2019 at 8:17 PM Mike Yeap <[email protected]> wrote:
> > Hi Thomas, does that mean the bug is still there?
> I haven't tried to repro this myself, but it certainly sounds like it.
> It also sounds like it would probably go away if you switched to a
> Debian-derived distro, instead of a Red Hat-derived distro, but I
> doubt that's the kind of advice you were looking for. We need to
> figure out a proper solution here, though I'm not sure what. Question
> for the list: other stuff in the server needs libpthread (SSL, LLVM,
> ...), so why are we insisting on using non-MT LDAP?
Concretely, why don't we just kill the LDAP_LIBS_FE/LDAP_LIBS_BE
distinction and use a single LDAP_LIBS? Then it'll always match. It
can still be the non-MT variant if you build with
--disable-thread-safety (who does that?), but then it'll be the same
in the server too so that postgres_fdw + ldap works that way too.
Sketch patch attached.
--
Thomas Munro
https://enterprisedb.com
diff --git a/configure b/configure
index 481bd3b66d..e2fc438297 100755
--- a/configure
+++ b/configure
@@ -652,8 +652,7 @@ CFLAGS_SSE42
have_win32_dbghelp
LIBOBJS
UUID_LIBS
-LDAP_LIBS_BE
-LDAP_LIBS_FE
+LDAP_LIBS
PTHREAD_CFLAGS
PTHREAD_LIBS
PTHREAD_CC
@@ -12375,7 +12374,6 @@ else
as_fn_error $? "library 'ldap' is required for LDAP" "$LINENO" 5
fi
- 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
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_simple_bind in -lldap_r" >&5
@@ -12425,9 +12423,9 @@ else
as_fn_error $? "library 'ldap_r' is required for LDAP" "$LINENO" 5
fi
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
+ LDAP_LIBS="-lldap_r $EXTRA_LDAP_LIBS"
else
- LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
+ LDAP_LIBS="-lldap $EXTRA_LDAP_LIBS"
fi
for ac_func in ldap_initialize
do :
@@ -12488,14 +12486,12 @@ else
as_fn_error $? "library 'wldap32' is required for LDAP" "$LINENO" 5
fi
- LDAP_LIBS_FE="-lwldap32"
- LDAP_LIBS_BE="-lwldap32"
+ LDAP_LIBS="-lwldap32"
fi
LIBS="$_LIBS"
fi
-
# for contrib/sepgsql
if test "$with_selinux" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for security_compute_create_name in -lselinux" >&5
diff --git a/configure.in b/configure.in
index 9c7a9738bc..bf21728268 100644
--- a/configure.in
+++ b/configure.in
@@ -1238,26 +1238,23 @@ if test "$with_ldap" = yes ; 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])],
[$PTHREAD_CFLAGS $PTHREAD_LIBS $EXTRA_LDAP_LIBS])
- LDAP_LIBS_FE="-lldap_r $EXTRA_LDAP_LIBS"
+ LDAP_LIBS="-lldap_r $EXTRA_LDAP_LIBS"
else
- LDAP_LIBS_FE="-lldap $EXTRA_LDAP_LIBS"
+ LDAP_LIBS="-lldap $EXTRA_LDAP_LIBS"
fi
AC_CHECK_FUNCS([ldap_initialize])
else
AC_CHECK_LIB(wldap32, ldap_bind, [], [AC_MSG_ERROR([library 'wldap32' is required for LDAP])])
- LDAP_LIBS_FE="-lwldap32"
- LDAP_LIBS_BE="-lwldap32"
+ LDAP_LIBS="-lwldap32"
fi
LIBS="$_LIBS"
fi
-AC_SUBST(LDAP_LIBS_FE)
-AC_SUBST(LDAP_LIBS_BE)
+AC_SUBST(LDAP_LIBS)
# for contrib/sepgsql
if test "$with_selinux" = yes; then
diff --git a/src/Makefile.global.in b/src/Makefile.global.in
index c118f64040..6fe5afa890 100644
--- a/src/Makefile.global.in
+++ b/src/Makefile.global.in
@@ -284,8 +284,7 @@ AR = @AR@
DLLTOOL = @DLLTOOL@
DLLWRAP = @DLLWRAP@
LIBS = @LIBS@
-LDAP_LIBS_FE = @LDAP_LIBS_FE@
-LDAP_LIBS_BE = @LDAP_LIBS_BE@
+LDAP_LIBS = @LDAP_LIBS@
UUID_LIBS = @UUID_LIBS@
UUID_EXTRA_OBJS = @UUID_EXTRA_OBJS@
LLVM_LIBS=@LLVM_LIBS@
@@ -570,7 +569,7 @@ endif
# Cygwin seems to need ldap libraries to be mentioned here, too
ifeq ($(PORTNAME),cygwin)
-libpq_pgport += $(LDAP_LIBS_FE)
+libpq_pgport += $(LDAP_LIBS)
endif
diff --git a/src/Makefile.shlib b/src/Makefile.shlib
index 373d73caef..8765818920 100644
--- a/src/Makefile.shlib
+++ b/src/Makefile.shlib
@@ -359,7 +359,7 @@ ifeq ($(PORTNAME), cygwin)
# Cygwin case
$(shlib): $(OBJS) | $(SHLIB_PREREQS)
- $(CC) $(CFLAGS) -shared -o $@ -Wl,--out-implib=$(stlib) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS_BE)
+ $(CC) $(CFLAGS) -shared -o $@ -Wl,--out-implib=$(stlib) $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) $(LDAP_LIBS)
# see notes in src/backend/parser/Makefile about use of this type of rule
$(stlib): $(shlib)
diff --git a/src/backend/Makefile b/src/backend/Makefile
index 478a96db9b..41d644b588 100644
--- a/src/backend/Makefile
+++ b/src/backend/Makefile
@@ -42,7 +42,7 @@ OBJS = $(SUBDIROBJS) $(LOCALOBJS) $(top_builddir)/src/port/libpgport_srv.a \
# We put libpgport and libpgcommon into OBJS, so remove it from LIBS; also add
# libldap and ICU
-LIBS := $(filter-out -lpgport -lpgcommon, $(LIBS)) $(LDAP_LIBS_BE) $(ICU_LIBS)
+LIBS := $(filter-out -lpgport -lpgcommon, $(LIBS)) $(LDAP_LIBS) $(ICU_LIBS)
# The backend doesn't need everything that's in LIBS, however
LIBS := $(filter-out -lz -lreadline -ledit -ltermcap -lncurses -lcurses, $(LIBS))
diff --git a/src/interfaces/libpq/Makefile b/src/interfaces/libpq/Makefile
index 025542dfe9..ef997d7f34 100644
--- a/src/interfaces/libpq/Makefile
+++ b/src/interfaces/libpq/Makefile
@@ -61,9 +61,9 @@ endif
# that are built correctly for use in a shlib.
SHLIB_LINK_INTERNAL = -lpgcommon_shlib -lpgport_shlib
ifneq ($(PORTNAME), win32)
-SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS)) $(LDAP_LIBS_FE) $(PTHREAD_LIBS)
+SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi_krb5 -lgss -lgssapi -lssl -lsocket -lnsl -lresolv -lintl -lm, $(LIBS)) $(LDAP_LIBS) $(PTHREAD_LIBS)
else
-SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS_FE)
+SHLIB_LINK += $(filter -lcrypt -ldes -lcom_err -lcrypto -lk5crypto -lkrb5 -lgssapi32 -lssl -lsocket -lnsl -lresolv -lintl -lm $(PTHREAD_LIBS), $(LIBS)) $(LDAP_LIBS)
endif
ifeq ($(PORTNAME), win32)
SHLIB_LINK += -lshell32 -lws2_32 -lsecur32 $(filter -leay32 -lssleay32 -lcomerr32 -lkrb5_32, $(LIBS))