2 posts categorized "compiling apache"

01/01/2013

Build Notes for Apache HTTP Server 2.4.3 on OS X 10.8 Mountain Lion

Prerequisites: XCode and the XCode Command Line Tools (downloadable from developer.apple.com or from within the Downloads preference panel within XCode)

Configuration

Once the apache httpd source has been downloaded, run the following command to remove the "quarantined" extended attribute from executables in your source directory, (needed in order to execute the configure script):

xattr -rd com.apple.quarantine /path/to/source

The following options to pass to configure will enable and load ALL apache modules, (fun for playing with Apache but not necessarily good for production use and don't be surprised if some modules need to be unloaded):

./configure --prefix=/usr/local/apache-httpd-2.4.3 --enable-load-all-modules --enable-mods-shared=reallyall

If you get a configure error like: error: C compiler cannot create executables, run the following to create a symlink to help configure find cc:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.8.xctoolchain

For me, configure also complained that PCRE was missing. Running

brew install pcre (from the Homebrew package manager for OS X) took care of that.

Attribution: This post on StackOverflow was invaluable in clearing the configure error "C compiler cannot create executables"

02/19/2009

Compiling Apache 2.2.x with LDAP Support

My one gripe with the Apache documentation is that one often needs to interpret it because the meaning behind something isn't always generally obvious. Although it may be crystal-clear to the developer documenting the module or setting in question, it is not always clear to the user—especially if you are new to compiling apache.

Take compiling LDAP support into recent builds of apache 2.2 as an example. If you read the configure --help output, it would only be natural for one to assume that all you need to do is run: ./configure --enable-ldap --enable-authnz-ldap and you will end up with an apache web server that supports ldap and that can use ldap databases for user authentication. If you've never compiled apache before though, running configure with these options will not give you that support.

Looking at the documentation for mod_ldap, I find this:

To enable this module, LDAP support must be compiled into apr-util. This is achieved by adding the --with-ldap flag to the configure script when building Apache.

Adding the --with-ldap flag to your configure options will still not give you a working apache server with ldap support if this is your first compile. I suspect that --with-ldap doesn't actually do anything any more although I have not tried it yet compiling against the apache httpd 2.0 source. With the latest Apache 2.2.11 source, though, results are not what you would expect.

What isn't immediately clear here and what isn't all that well documented at least on the apache httpd site, is that when you run the configure script, not only are you compiling apache httpd but you are also compiling the apache apr and apr-util libraries. In order to get LDAP support into apache, you need to compile that LDAP support into apr first and then apache httpd will be compiled against your newly created apr/apr-util. So, although the --enable-ldap and/or --enable-ldap-authnz configure options are valid for adding ldap support into apache, you also need to pass the --with-included-apr option in order to actually get it to work. At least, that's what I needed to do. Please let me know if any of you finding this page via Google were able to meet success by adding the --with-included-apr flag to your configure script.