You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Arthur Watts <ar...@gbst.com> on 2001/03/02 02:55:24 UTC

Tip : building Apache modules under Compaq Tru-64 Unix (formerly Digital Unix / OSF1)

Guys,

	Those of us with Tru-64 often run into some interesting problems
when buiilding Open Source software, particularly software which does not
come with a configure script. The recent upgrade to v5.0 of Tru-64 caught
out a lot of the configure scripts, but this tip is for those who have to
'wing it' completely.

	Current Apache releases contain the facility to build your httpd
executable with support for dynamically linked modules (DSO). This means
that your httpd executable no longer gets bigger with each successive module
added to it. This is accomplished via the 'apxs' tool. 

	PyApache is a module designed to speed up the execution of Python
CGI scripts running under the Apache webserver. It comes with a single
README containing a line which shows you how the suggested APXS command.
Because of the nature of the Tru-64 compilation/linking environment, the
supplied script will *not* work properly.

	To build PyApache under Tru-64, save this in a script called
'apxs.sh' or similar :

#!/bin/ksh
PYTHON="/usr/local/python-1.5.2"
PYVER="python1.5"
PYTHONLIB=$PYTHON/lib/$PYVER
PYINC=${PYTHON}/include
APACHEBIN=/usr/local/pyapache/bin

echo "Building ${MODULE}"
$APACHEBIN/apxs \
           -c \
           -Wl,"-shared -expect_unresolved '*'" \                    #
essential for Tru-64
           -I${PYINC} \
           -L${PYTHONLIB} \
           -L${PYTHONLIB}/config \
           -lpython1.5 \
           -lm \
           -lpthread \
           ${MODULE}.c

if [ $? -eq 0 ]; then
   echo "Installing ${MODULE}"
   $APACHEBIN/apxs \
             -i \
             -a \
             ${MODULE}.so
fi

	The net payoff for this effort was an increase from 15
requests/second to over 58 requests/sec on our Alpha. Definitely worth it !
Note that the script above should work for most Apache modules which support
DSO - you'll just need to change the include and library paths. Other
options such as threading may or may not suit your environment. Your version
of Python may differ, and so may the location of your Apache executables.
Some installs have apxs in apache/sbin instead of apache/bin, but thats
purely personal choice. If the build works, you should see apxs output
indicating that httpd.conf is being updated. Please consult the apxs manpage
(under apache/man) for further details re the options you need to pass apxs.
The above script uses Korn shell syntax - it may need to be modified if you
prefer another shell. Don't forget to read the INSTALL and README files to
ensure that all necessary configuration is done before restarting Apache.
Finally, my apologies for the size of this post !

Regards,

Arthur

Arthur Watts
Software Engineer GBST Automation
Global Banking & Securities Transactions

Telephone + 61 7 3331 5555
mailto: arthur.watts@gbst.com
www.gbst.com