Apache – mod_ldap and mod_authnz_ldap not building for Apache httpd 2.4.4 and SVN

apache

Problem: I am trying to compile the Apache web server using the latest sources of httpd, apr and apr-util, and enabling LDAP support. My current steps do not seem to be commpiling mod_ldap.so and mod_authnz_ldap.so.

Environment background: Build and target OS are RHEL5. A non-LDAP enabled instance of httpd is already on the server (2.4.1) and SVN 1.7.3 is already installed and works anonymously with httpd-2.4.1

Steps to reproduce:
Following the compilation instructions here I have downloaded:

  • httpd-2.4.4 in /path/apache/src/httpd-2.4.4
  • apr 1.4.6 in /path/apache/src/apr-1.4.6
  • apr-utils 1.5.2 /path/apache/src/apr-util-1.5.2
  • OpenLDAP and Berkley DB (for the LDAP libraries to build apr-util against) in /path/openldap-2.4.35_src and /path/db-5.3.21_src

With the sources in place, I:
compiled BDB and installed it to /path/db-5.3.21
compiled OpenLDAP using the installed BDB and installed it in /path/openldap-2.4.35
configured apr, compiled and installed it in /path/apache/apr
configured apr-util with:

./configure --with-ldap --prefix=/path/apache/apr-util-1.5.2 --with-apr=/path/apache/apr-1.4.6 --with-ldap-lib=/path/openldap-2.4.35/lib --with-ldap-include=/path/openldap-2.4.35/include

Afterwards, I built and installed with make and make install.

Finally, I configured httpd with the following:

   ./configure --prefix=/path/apache/httpd-2.4.4 --with-apr=/path/apache/apr-1.4.6 --with-apr-util=/path/apache/apr-util-1.5.2 --with-pcre=/path/apache/pcre-8.30 --with-ldap --enable-ldap

This was successful, and I was able to run make and make install

I now have a httpd instance in /path/apache/httpd-2.4.4/. Using /path/httpd-2.4.1/httpd.conf as a model, I matched the existing configuration and loaded modules, adding:

LoadModule mod_ldap modules/mod_ldap.so
LoadModule mod_authnz_ldap modules/mod_authnz_ldap.so

However, if I run apachectl start I get a syntax error:

/path/apache/httpd-2.4.4> ./bin/apachectl start
httpd: Syntax error on line 148 of /path/apache/httpd-2.4.4/conf/httpd.conf: Can't locate API module structure 'mod_ldap' in file /path/apache/httpd-2.4.4/modules/mod_ldap.so: /path/apache/httpd-2.4.4/modules/mod_ldap.so: undefined symbol: mod_ldap

Looking within the httpd-2.4.4/modules directory, the modules mod_ldap.so and mod_authnz.ldap.so are missing. I have tried the above steps without success. I have discovered that within the src/httpd-2.4.4 directory, the files ./modules/aaa/.libs/mod_authnz_ldap.so and ./modules/ldap/.libs/mod_ldap.so exist, but copying those over to httpd-2.4.4/modules does not alleviate the issue.

Can someone assist me in diagnosing the error in my steps? I know I'm missing something, but I have been unable to find it so far. I will also add any other required information if needed.

Best Solution

As configured above, LDAP is supported through a shared module. To enable the modules defined (including LDAP in my case) you need to configure apache with the --enable-so flag. This will generate the shared modules and place them within the modules directory when compiled/installed.

Additional reference can be found in this SO article: Compiling Apache Web Server with Dynamic Module Support

Related Question