Bug 58197 - apr-util-1.5.4 build against openldap - "could not find an LDAP library"
Summary: apr-util-1.5.4 build against openldap - "could not find an LDAP library"
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Build (show other bugs)
Version: 2.5-HEAD
Hardware: Other AIX
: P2 normal (vote)
Target Milestone: ---
Assignee: Apache HTTPD Bugs Mailing List
Depends on:
Reported: 2015-07-31 08:31 UTC by flynn8765
Modified: 2019-10-03 15:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description flynn8765 2015-07-31 08:31:00 UTC
AIX Version: 6100-08-01-1245
XLC Version: 

openldap-2.4.41 compiled from source.

/tmp/apachetest/dev/lib # ls -ltr | grep ldap
-rw-r--r--    1 root     system          888 Jul 31 09:44 libldap_r.la
-rw-r--r--    1 root     system       944537 Jul 31 09:44 libldap_r.a
-rw-r--r--    1 root     system          882 Jul 31 09:44 libldap.la
-rw-r--r--    1 root     system       861977 Jul 31 09:44 libldap.a
-rwxr-xr-x    1 root     system      1031094 Jul 31 10:07 libldap_r.so
-rwxr-xr-x    1 root     system       938970 Jul 31 10:07 libldap.so

/tmp/apachetest/dev/include # ls -ltr | grep ldap
-rw-r--r--    1 root     system         3468 Jul 31 09:44 ldap_utf8.h
-rw-r--r--    1 root     system         9450 Jul 31 09:44 ldap_schema.h
-rw-r--r--    1 root     system         1814 Jul 31 09:44 ldap_features.h
-rw-r--r--    1 root     system         9466 Jul 31 09:44 ldap_cdefs.h
-rw-r--r--    1 root     system        64783 Jul 31 09:44 ldap.h

my build script for apr-util:


#export LIBPATH="/tmp/apachetest/dev/lib:/usr/lib:/lib"
export PATH="/tmp/apachetest/dev/bin:$PATH"
export  OBJECT_MODE=64
export CC="cc_r"
export CFLAGS="-q64 -qsmp -qmaxmem=16384 -qenum=small -DNDEBUG -DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_AIX52 -D_AIX53 -D_AIX61 -D_AIX71 -D_ALL_SOURCE -DFUNCPROTO=15 -O2 -I/tmp/apachetest/dev/include -I/opt/freeware/include"
export CXX="xlC_r"
export LDFLAGS="-L/tmp/apachetest/dev/lib -L/opt/freeware/lib64 -L/opt/freeware/lib \
-Wl,-bmaxdata:0x80000000 -Wl,-bh:4 -Wl,-b64 -Wl,-bexpall -Wl,-bnolibpath"

./configure \
     --prefix=/tmp/apachetest/apr \
     --exec-prefix=/tmp/apachetest/apr \
     --with-apr=/tmp/apachetest/apr \
     --with-crypto \
     --with-openssl=/tmp/apachetest/dev \
     --with-ldap=/tmp/apachetest/dev \
     --with-ldap-lib=/tmp/apachetest/dev/lib \



 adding "-I/tmp/apachetest/dev/include" to CPPFLAGS
configure: checking for openssl in /tmp/apachetest/dev
checking openssl/x509.h usability... yes
checking openssl/x509.h presence... yes
checking for openssl/x509.h... yes
checking for BN_init in -lcrypto... yes
checking for SSL_accept in -lssl... yes
  setting APRUTIL_LDFLAGS to "-L/tmp/apachetest/dev/lib"
  setting APRUTIL_INCLUDES to "-I/tmp/apachetest/dev/include"
checking whether EVP_PKEY_CTX_new is declared... yes
  setting LDADD_crypto_openssl to "-L/tmp/apachetest/dev/lib  -lssl -lcrypto"
checking for const input buffers in OpenSSL... yes
checking for ldap support...
checking for ldap_init in -l/tmp/apachetest/dev... no
checking for ldap_init in -l/tmp/apachetest/dev... no
checking for ldap_init in -l/tmp/apachetest/dev... no
checking for ldap_init in -l/tmp/apachetest/dev... no
configure: error: could not find an LDAP library

i am fighting with this since 2 days. what is the correct syntax for the ldap stuff on the configure command?
Comment 1 Michael Felt 2019-10-03 15:06:50 UTC
This has been around - for a long time - yet I believe I have a solution.

Just have not figured out where to include it (in m4 or a .in file).

The key issue for AIX is that the SSL and CRYPTO libraries are also needed.

To get configure to succeed I made the following manual adjustment to ./configure

This is against version 1.6.1

 +8591    if test ${apu_has_ldap} != "1"; then
 +8592      ldaplib="ldap"
 +8593      extralib="-llber"
 +8594      # Clear the cache entry for subsequent APU_FIND_LDAPLIB invocations.
 +8596      ldaplib_cache_id="`echo $ldaplib | sed -e 's/[^a-zA-Z0-9_]/_/g'`"
 +8598      unset ac_cv_lib_${ldaplib_cache_id}_ldap_init
 +8599      unset ac_cv_lib_${ldaplib_cache_id}___ldap_init
 +8600      as_ac_Lib=`$as_echo "ac_cv_lib_${ldaplib}''_ldap_init" | $as_tr_sh`
 +8601  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ldap_init in -l${ldaplib}" >&5
 +8602  $as_echo_n "checking for ldap_init in -l${ldaplib}... " >&6; }
 +8603  if eval \${$as_ac_Lib+:} false; then :
 +8604    $as_echo_n "(cached) " >&6
 +8605  else
 +8606    ac_check_lib_save_LIBS=$LIBS
 +8607  LIBS="-l${ldaplib} ${extralib} $LIBS $LDADD_crypto_openssl"

On Line 8607 I add $LDD_crypto_openssl - and LDAP is found!

root@x066:[/data/prj/apache/apr/apr-util-1.6.1]/opt/bin/apu-1-config --ldap-libs
 -lldap -llber

Hope this helps!