Building Loadable Modules for Apache on Solaris

We recently installed a version of Sun’s CoolStack software bundle on a SunFire T2000 server running Solaris 10 so that we could use its CoolThreads-optimised version of Apache instead of the regular Apache that came pre-installed on the box (highly recommended by Sun).

However, when we ran the new version of Apache against our configuration, we discovered that it does not include a number of key modules that we require (namely Proxy Balancer). Sun does not provide these in binary format so we had to build them by hand. Fortunately, Apache does provide a convenient tool (apxs) for building modules but unfortunately this requires you to install a Sun compiler, Sun Studio (now free though) which added some extra time to the process.

Anyway, I appreciate that this may not be rocket science to many of you but, despite the many articles already published on this topic, there were still some issues that we hit which were not documented. So, here is how we did it.

  1. Ensure that you have installed the latest version of the CoolStack software (installs to /opt/coolstack)
  2. Download, unpack and install Sun Studio 11 (installs to /opt/SUNWspro)
  3. Be patient, very patient … 600MB download, followed by a long unzip to 1.1GB followed by a long install …
  4. Download, unpack and install the CoolStack Source (installs to /opt/coolstack/src)
  5. Now, as a root user, follow the commands below

# export PATH=/opt/SUNWspro/bin:$PATH
# cd /opt/coolstack/src/httpd-2.2.3/modules/proxy
# /opt/coolstack/apache2/bin/apxs -i -a -c mod_proxy.c proxy_util.c

This will compile the module, copy it to the appropriate directory and update the Apache configuration file for you. If you leave out the proxy_util.c you will get "proxy_lb_worker: symbol not found" errors when you start Apache

# /opt/coolstack/apache2/bin/apxs -i -a -c mod_proxy_balancer.c

Once again, this will compile, copy and deploy the module for you

# /opt/coolstack/apache2/bin/apxs -i -a -c mod_proxy_http.c

If you forget to install this module, Apache will start, but the site will be inaccessible (saying you do not have permissions to view this page). You will also see errors like "proxy: No protocol handler was valid for the URL /" in the Apache error log file for your product.

Best of luck!


8 thoughts on “Building Loadable Modules for Apache on Solaris”

  1. Wow, after years of fighting dependencies trying to get apache 1.3.x to build reliably, this seems almost too good to be true, but it works!

    The only change I had to make to your instructions was to also add /usr/ccs/bin to my path, otherwise I got an error about not being able to find “ar”. Awesome.

  2. Yes, things have improved a lot in Apache 2.2 (and Solaris 10). It’s also an enormous benefit that SunStudio is now free as it means you don’t have to spend lots of time trying to convince Solaris that GCC is OK to use (which is inherently didn’t like in many cases until now).

    Thanks for the feedback. It is much appreciated.

  3. This post was really useful. To get mod_proxy_ajp you need to compile the following files to avoid runtime errors (thought I’d post it here for the benefit of anyone else trying to compile it).

    /opt/coolstack/apache2/bin/apxs -i -a -c mod_proxy.c ajp*.c proxy_util.c

  4. Thanks Nick,

    I would have been so easy for you not to bother pasting back your comments here but I am grateful that you took the time to do so. Hopefully others will now benefit from your experience(s) too.

  5. This is cool. Just what I was looking for. Instead of recompiling from scratch, I was able to use this to get other modules in place. It’s been almost a year since the last post. Thanks!

  6. Hey! I know this is somewhat off topic but I was wondering if you knew where I could locate a captcha plugin for my comment
    form? I’m using the same blog platform as yours and I’m having trouble finding
    one? Thanks a lot!

Leave a Reply