Compiling 64bit Apache on Solaris11

Configure, Make & Make Install. The basic roadmap for compiling a package from source, and installing on a *nix box. it’s clean, efficient and works. It’s also kinda cool to see all the lines of text scrolling through your chosen Unix shell. Take that Microsoft InstallShield Wizard!!

Except this time.

I was recently tasked with compiling Apache 2-4.18 and OpenSSL 1.0.2f on a series of Solaris11 boxes. For security and compliance needs, the packages had to be built and compiled from source, in 64bit and separate from whatever the built-in Solaris Package manager could offer.

Unix is user-friendly — it’s just choosy about who its friends are.
Anonymous, in The Art of UNIX Programming (2003) by Eric S. Raymond

After grabbing and extracking the source tarballs, I began building out the configuration scripts etc. OpenSSL went pretty smooth, Apache, not so much.

I tried multiple versions of both make and gmake, to no avail. I tried multiple compilers, built in and separate. I configured the configurator. I tried everything I could find or think of. I looked at the prior config.nice files which led to the same erorrs. I passed all the flags and switches I could think of, nothing worked. It kept failing when trying to build out MOD_SED and MOD_SSL.

Angrily grabbing my UNIX bat, I went full viking and forced Apache to compile with the ‘make -k’ command. Apache would follow my configure script, build and install, ignoring the MOD_SED and MOD_SSL issues it was encountering. At this point, I didn’t really care. Apache would start… but without SSL. DAMNIT!!

“There are two major products that came out of Berkeley: LSD and UNIX. We don’t believe this to be a coincidence.” Jeremy S. Anderson quotes

I Google-fu’d and Bing-Chopped every site I could find on the topic. Slammed $PATH and $LD_RUN variables into the shell trying, hoping, praying something would work. It never did. Adding to the frustration were the forums and blogs saying “Hey dummy, just use the built in Solaris package utility to install it.” (Due to PCI needs, that wasn’t an option.)

I even found some blogs that recommended I just slam in a mod_ssl.so from an older, already compiled and installed version of Apache. That felt dirty.

For reasons I can’t remember, I began looking at the files the Configure command was making, particularly the config_vars.mk file located in the ./build sub-directory of my Apache install location.

In that file, upon lines of configure variables I noticed the MOD_SED_LDADD and MOD_SSL_LDADD variables had the same”-export-symbols-regex mod_xxxx” being set for both. What the hell was that command?

On a whim I manually edited the config_vars.mk file, removed those values and started my build process over. It completed just as it should, no errors, no issues, no problems. The install went just as smooth and I could see that mod_sed.so and mod_ssl.so were being created. Apache would now install, configure and start with SSL support etc.

Right? Wrong? Not sure, but my installation works, Apache starts with SSL support and no issues to report as of yet. Enclosed below is the Apache script I’m using to install. (Note there are some variables that are defined in another file, that don’t appear in this code-listing.)

#INSTALL_APACHE.sh

#/bin/bash

echo -= APACHE INSTALL =-

# INITLIALIZE SATWEB VARIABLES
. _satweb_vars.sh

unset LD_LIBRARY_PATH
unset LD_RUN_PATH
export LD_RUN_PATH=”/local/pcre/lib:/local/openssl/lib:/local/zlib/lib”

tar -xvf $SATWEB_REPO/$PROGRAM-$VERSION.tar.bz2
tar -xvf $SATWEB_REPO/$PROGRAM-$VERSION-deps.tar.bz2 # — creates APR / APR-UTIL

cd ./$PROGRAM-$VERSION

make clean

./configure –prefix=/local/$PROGRAM2-$VERSION$APACHE_EXTRA –with-included-apr –enable-so –enable-info –enable-ssl –enable-proxy –enable-proxy-balancer –enable-rewrite –enable-headers –disable-dav –with-ssl=/local/openssl –with-pcre=/local/pcre CC=’gcc -m64′ CPP=’/local/gcc/lib/gcc’ CPPFLAGS=’-m64′

#edit config_vars.mk
cd ./build
sed s/”-export-symbols-regex sed_module”//g config_vars.mk > config_vars.mk.new && mv config_vars.mk.new config_vars.mk
sed s/”-export-symbols-regex ssl_module”//g config_vars.mk > config_vars.mk.new && mv config_vars.mk.new config_vars.mk
cd ../

make
make install

#XXXX Apache configuration
cd /local/$PROGRAM2-$VERSION$APACHE_EXTRA
cp -r conf conf.original # — make backup of conf directory
cd conf
cp -r /repo/satweb/apache_conf/* /local/$PROGRAM2-$VERSION$APACHE_EXTRA/conf # — Trasnplants httpd.conf from source