#47875 dirsrv not running with old openldap
Closed: wontfix Opened by nhosoi.

DS fails to start if the older version of openleap (e.g., openldap-2.4.23-32) is installed with the following error:

/usr/bin/pwdhash-bin: symbol lookup error: /usr/lib64/dirsrv/libslapd.so.0: undefined symbol: ldif_getline
Could not import LDIF file '/tmp/ldifHKngyV.ldif'.  Error: 32512.  Output: importing data ...
./ns-slapd: symbol lookup error: /usr/lib64/dirsrv/libslapd.so.0: undefined symbol: ldif_getline

git patch file (master) -- automatically generated files
0002-Ticket-47875-dirsrv-not-running-with-old-openldap.patch

Reviewed by Rich (Thank you!!)

Pushed to master:
c4f396d..9fb3c43 master -> master
commit 9fb3c4357aa7748f4b345f532cf4182cbc57b859
commit 0ae55bcd61497c2fa7aaade40fe4ff6c91216325

Pushed to 389-ds-base-1.3.2:
db9c4e7..5995ff0 389-ds-base-1.3.2 -> 389-ds-base-1.3.2
commit 5995ff014d92da027f4ee925aefc6d7249a169bc
commit 1bb438916825d72df023ca5f67fa7d8b7e6e36e3

Pushed to 389-ds-base-1.2.11:
81e5f14..e476c66 389-ds-base-1.2.11 -> 389-ds-base-1.2.11
commit e476c664d6ad2875e454722c6451a5411b1f38d1
commit dce84e1d4a12dbe9a461981d076ca3d0e17ef56c

These commits are being reverted.
Replying to [comment:4 nhosoi]:

Reviewed by Rich (Thank you!!)

Pushed to master:
c4f396d..9fb3c43 master -> master
commit 9fb3c4357aa7748f4b345f532cf4182cbc57b859
commit 0ae55bcd61497c2fa7aaade40fe4ff6c91216325

Pushed to 389-ds-base-1.3.2:
db9c4e7..5995ff0 389-ds-base-1.3.2 -> 389-ds-base-1.3.2
commit 5995ff014d92da027f4ee925aefc6d7249a169bc
commit 1bb438916825d72df023ca5f67fa7d8b7e6e36e3

Pushed to 389-ds-base-1.2.11:
81e5f14..e476c66 389-ds-base-1.2.11 -> 389-ds-base-1.2.11
commit e476c664d6ad2875e454722c6451a5411b1f38d1
commit dce84e1d4a12dbe9a461981d076ca3d0e17ef56c

git patch file (master) -- automatically generated files from revised patch
0002-Ticket-47875-dirsrv-not-running-with-old-openldap.2.patch

Thanks to Rich for his suggestions and reviews.

Pushed to master:
9fb3c43..a595bd8 master -> master
commit a595bd8649ac25ab5657e1176c782090aae9c2a8
commit 38c74d224c250abd907636f7d78e95775ebf63dd

Pushed to 389-ds-base-1.3.2:
5995ff0..9398383 389-ds-base-1.3.2 -> 389-ds-base-1.3.2
commit 939838311c6366b1cf4ba04a9f0a1b2b6adfb34d
commit 4917a5e4856c7fe0fb4f9b023c21eb64f277e319

Pushed to 389-ds-base-1.2.11:
e476c66..62ef849 389-ds-base-1.2.11 -> 389-ds-base-1.2.11
commit 4a16332967096c6872ecf7e3686da3f7360b9b5f
commit 62ef849326a010e9a17c576817b0afc2830a8a6d

git patch file (master) -- fixing the code to check libldif
0001-Ticket-47875-dirsrv-not-running-with-old-openldap.3.patch

git patch file (master) -- automatically generated file by autogen.sh
0002-Ticket-47875-dirsrv-not-running-with-old-openldap.3.patch

{{{
148 LDFLAGS="$LDFLAGS -lldap$ol_libver"
149 ol_libver="-${ol_ver_maj}.${ol_ver_min}"
}}}

Don't you need to set ol_libver before using it in LDFLAGS?

Replying to [comment:11 rmeggins]:

{{{
148 LDFLAGS="$LDFLAGS -lldap$ol_libver"
149 ol_libver="-${ol_ver_maj}.${ol_ver_min}"
}}}

Don't you need to set ol_libver before using it in LDFLAGS?
That's the tricky part... :) ol_libver at line 148 is set/unset at the libldap check. We'd like to refer the setting.
{{{
137 AC_CHECK_LIB([ldap$ol_libver], [ldap_initialize], [have_ldap_lib=1])
138 if test -z "$have_ldap_lib" ; then
139 AC_CHECK_LIB([ldap], [ldap_initialize], [unset ol_libver],
^^^^^^^^^^^^^^^
140 [AC_MSG_ERROR([specified with-openldap but libldap not found])])
141 fi
}}}
Not sure if we use -lldap (instead of -lldap-#.#), we have a chance to link with -lldif-#.# or not, but just in case, I'm checking -lldif-#.#, first.

So the problem is that, in order to run
{{{
AC_CHECK_LIB([ldif$ol_libver], [_init], [ldap_lib_ldif=-lldif$ol_libver], [ldap_lib_ldif=])
}}}
You need to have "-lldif$ol_libver" in LDFLAGS?

Note that if you have libldif-2.4.so, you must have libldap-2.4.so. It is not possible to have libldif-2.4.so without libldap-2.4.so. So this check should be unnecessary:
{{{
if test -z "$ldap_lib_ldif" ; then
AC_CHECK_LIB([ldif], [_init], [ldap_lib_ldif=-lldif],
[ldap_lib_ldif=])
fi
}}}

For example, if libldap-2.4.so was found, ol_libver will be set to "-2.4". If libldif-2.4.so is not found, then we can't use libldif.so even if it is found, because it may not match libldap-2.4.so.

So I guess I'm just not clear what the problem is and what this fix is trying to address.

So I guess I'm just not clear what the problem is and what this fix is trying to address.

The problem was configure tried to compile conftest.c with -lldif, but it was failing like this. And configure reported libldif was not available. If we set -lldap to LDFLAGS, this undefined references are solved.
{{{
configure:22729: checking for _init in -lldif
configure:22764: gcc -o conftest -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -I/usr/include -I/usr/include/nss3 -I/usr/include/nspr4 -I/usr/include/nspr4 conftest.c -lldif >&5
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference to ber_strdup' /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference tober_memrealloc'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference to ber_str2bv' /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference tober_memfree'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference to ber_pvt_log_printf' /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference tober_dupbv'
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference to ldap_pvt_hex_unescape' /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../lib64/libldif.so: undefined reference tober_memalloc'
collect2: ld returned 1 exit status
configure:22771: $? = 1
}}}
I'm re-running the test. Just adding this to LDFLAGS solves the problem.
{{{
diff --git a/m4/openldap.m4 b/m4/openldap.m4
index 1e297c4..70312c7 100644
--- a/m4/openldap.m4
+++ b/m4/openldap.m4
@@ -145,7 +145,7 @@ if test "$with_openldap" = yes ; then
dnl look for separate libldif - newer versions of openldap have moved the
dnl ldif functionality into libldap
ldap_lib_ldif=""
- LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -lldap$ol_libver"
AC_CHECK_LIB([ldif$ol_libver], [_init], [ldap_lib_ldif=-lldif$ol_libver],
[ldap_lib_ldif=])
if test -z "$ldap_lib_ldif" ; then
}}}

Ok, I understand the problem and the fix looks correct.

git patch file (master) -- revised; To check libldif, -lldap$ol_libver needs to be added to LDFLAGS to compile test conftest.c.
0001-Ticket-47875-dirsrv-not-running-with-old-openldap.4.patch

Thank you, Rich!! I added the final patch (that includes generated configure, as well).

Can you also get rid of this:
{{{
if test -z "$ldap_lib_ldif" ; then
AC_CHECK_LIB([ldif], [_init], [ldap_lib_ldif=-lldif],
[ldap_lib_ldif=])
fi
}}}
?

Okay. Let me do that...

Since I already pushed the previous patch, I keep the records here...

Pushed to master:
61dc5e1..8c7ac72 master -> master
commit 8c7ac72659758ef1ea96794552e584fdbe803778

Pushed to 389-ds-base-1.3.3:
9eae60a..84f91dd 389-ds-base-1.3.3 -> 389-ds-base-1.3.3
commit 84f91ddac5020295cbc0a3f84f14ab24f539ed00

Pushed to 389-ds-base-1.3.2:
c4a3563..a690f70 389-ds-base-1.3.2 -> 389-ds-base-1.3.2
commit a690f70780e658c331ffdb3a2e7ff335a801c257

Pushed to 389-ds-base-1.2.11:
819467e..3612ac6 389-ds-base-1.2.11 -> 389-ds-base-1.2.11
commit 3612ac6ab98e08a4fceec3bfcf85fe857d772185

git patch file (master) -- removed unnecessary checking for -lldif from openldap.m4
0001-Ticket-47875-dirsrv-not-running-with-old-openldap.5.patch

Pushed to master:
8c7ac72..0172a73 master -> master
commit 0172a730686eaa054dd5b7b0a8921a6638af63aa

Pushed to 389-ds-base-1.3.3:
84f91dd..48b3153 389-ds-base-1.3.3 -> 389-ds-base-1.3.3
commit 48b3153aee7cb2b1f65554b9da432004d23f10e7

Pushed to 389-ds-base-1.3.2:
a690f70..eb6d5a3 389-ds-base-1.3.2 -> 389-ds-base-1.3.2
commit eb6d5a31c79746cf5ffd47d103a56ece2970f68e

Pushed to 389-ds-base-1.2.11:
3612ac6..dd7c125 389-ds-base-1.2.11 -> 389-ds-base-1.2.11
commit dd7c125b499a3c6b36651f5d2a00c2ed45df6d41

Metadata Update from @nhosoi:
- Issue set to the milestone: 1.2.11.30

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1206

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

Metadata