Error while compiling apr-util for apache with LDAP support

64-bitapache-2.4centos7lampopenldap

I am currently trying to create a custom 64bit LAMPP stack on CentOS 7, in which each component should reside in its own folder, with every dependency included and in its own folder.

Currently, I have the following structure with correctly compiled programs:

- /opt/lampp64
  - apr
  - bzip2
  - cyrus-sasl
  - gdbm
  - libtool
  - ncurses
  - openldap
  - openssl
  - pcre
  - perl
  - readline
  - zlib

each software is fully contained in its folder, which has:

  • a single directory for each version
  • a simlink to the "current" version

I have downloaded apr-util sources at latest version and I am trying to compile them, however the command:

./configure --prefix=/opt/lampp64/apr-util/X.Y.Z --with-openssl=/opt/lampp64/openssl/current --with-openldap=/opt/lampp64/openldap/current

Fail saying that it cannot find openldap, if I disable it all goes fine.

I know this is not a standard directory layout, it is just an experiment, however other programs with dependencies have already been correctly compiled.

Do I need to add any additional option to configure to make it "see" the LDAP libraries?

This is the whole command and output:

./configure --prefix=/opt/lampp64/apr-util/1.5.4 --with-apr=/opt/lampp64/apr/current --with-gdbm=/opt/lampp64/gdbm/current --with-openssl=/opt/lampp64/openssl/current --with-crypto --with-ldap=openldap --with-ldap-lib=/opt/lampp64/openldap/current/lib --with-ldap-include=/opt/lampp64/openldap/current/include
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking for working mkdir -p... yes
APR-util Version: 1.5.4
checking for chosen layout... apr-util
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
Applying apr-util hints file rules for x86_64-unknown-linux-gnu
checking for APR... yes
  setting CPP to "gcc -E"
  adding "-pthread" to CFLAGS
  adding "-DLINUX" to CPPFLAGS
  adding "-D_REENTRANT" to CPPFLAGS
  adding "-D_GNU_SOURCE" to CPPFLAGS
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
configure: checking for openssl in /opt/lampp64/openssl/current
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/opt/lampp64/openssl/current/lib"
  setting APRUTIL_INCLUDES to "-I/opt/lampp64/openssl/current/include"
checking whether EVP_PKEY_CTX_new is declared... yes
  setting LDADD_crypto_openssl to "-L/opt/lampp64/openssl/current/lib  -lssl -lcrypto"
checking for const input buffers in OpenSSL... yes
checking for ldap support...
  adding "-I/opt/lampp64/openldap/current/include" to APRUTIL_INCLUDES
  adding "-L/opt/lampp64/openldap/current/lib" to APRUTIL_LDFLAGS
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
checking for ldap_init in -lopenldap... no
configure: error: could not find an LDAP library

Best Answer

In the line:

checking for ldap_init in -lopenldap... no

it is trying to link against a library called openldap, but when I look in my openldap lib dir I don't see a libopenldap.so:

liblber.so
libldap.so
libldap_r.so

It looks like value in -lopenldap is coming from the --with-ldap=openldap option, so if I change that to --with-ldap=ldap it seems to work.

I didn't try with all your options though, so I don't know if everything else works :)