Monday, October 09, 2006

Get Apache compiled with SunStudio 11 for Linux

First, if you don't have your copy of SunStudio go grab the freshest Express build @ Sun's website and be sure to check the bundled documentation. Keep in mind that this is technology preview release, the SunCC 11 release is just the IDE, the Express Build is the one that has the C/C++ & Fortran compilers, that's the one you want. BTW, if you need GCC++ ABI compatibility it's no go.

Second, bunzip & utar SunStudio to a directory in /opt and then set your PATH environment accordingly. For me it's a little script in my /etc/profile.d:

#!/bin/sh
PATH=/opt/sun/sunstudiomars/bin${PATH:+:}${PATH}
MANPATH=/opt/sun/sunstudiomars/man:${MANPATH:=/usr/share/man}

Now, go and grab Apache 1.3.X source code and run:

./configure --enable-module=most --enable-shared=max / --manualdir=/var/www/htdocs/manual --enable-rule=eapi CC=cc

If that gave you no error do a "dmake" distributed make:

dmake && dmake install

If all went well you should be able to run:

/usr/local/sbin/apachectl start

Now point your browser to http://localhost and read the handy Apache documentation. Congratulations! You just built Apache with one of the best commercial compilers available yet :). Experiment with compiler options, rebuild with:

CFLAGS="-fast -xipo=2 -xarch=sse"

Here you may read Roman Shaposhnic's (SunStudio Architect & the guy behind ffmpeg) tips for compiling stuff in Linux with SunStudio. He was very kind to answer my questions and also very interested in making Linux a better Linux by getting the full LAMP stack compiled with SunStudio. We salute you Roman! (don't forget to check the slides in his blog!!!)

0 comments: