The Apache 2 httpd source code offers these two appealing options, “
--with-ldap” and “
--enable-authnz-ldap“. You may have used them, as I, because you’d like to be able to use htauth to authenticate against your LDAP directory. When you compile the source, however, you probably run into this:
mod_authnz_ldap.c:40:2: #error mod_authnz_ldap requires APR-util to have LDAP support built in. To fix add --with-ldap to ./configure. mod_authnz_ldap.c:62: error: parse error before "deref_options" mod_authnz_ldap.c:62: warning: no semicolon at end of struct or union mod_authnz_ldap.c:76: error: parse error before '}' token mod_authnz_ldap.c:76: warning: data definition has no type or storage class mod_authnz_ldap.c:92: error: parse error before '*' token mod_authnz_ldap.c:92: warning: data definition has no type or storage class mod_authnz_ldap.c:93: error: parse error before '*' token ...
I’ve run into this on both Apache 2.0 and 2.2, on Linux, Solaris and FreeBSD. When this first happened, back when Apache2 first came out, I thought, fine, the code is young, and its a bug to be worked out. But here we are at version 2.2.3, and the problem is still around. The advice printed in the error: “To fix add –with-ldap to ./configure” makes it even more frustrating, because of course, you did have that switch in configure.
The work-around is to build APR & APR-util, which is part of the Apache2 httpd source code, before the rest of it, then re-make httpd. It’s fairly straightforward. Configure httpd as you’d like it and run make. When the build bombs out, as above, do this:
cd srclib/apr make clean ./configure --prefix=/usr/local/apache2 --enable-threads \ --enable-other-child make (... compile ... compile ... compile ...) cd ../apr-util make clean ./configure --prefix=/usr/local/apache2 --with-apr=../apr \ --with-ldap-lib=/usr/lib --with-ldap-include=/usr/include \ --with-ldap=ldap make (... compile ... compile ... compile ...) cd ../.. make
Adjusting, of course, for your directory and option preferences. I had one instance compiling apache 2.0.58 on solaris 2.9, where the build failed a second time, after the above. Changing back into the apr directory and re-configuring and re-making, then back to the root httpd source dir and re-making, fixed it.
It would be nice if the Apache team could create a Makefile that compiled apr and apr-util in the correct order so that this wouldn’t be necessary!