Oracle Blog

Do more with Web Server

Tuesday Jul 01, 2008

Today, we will tackle the tricky thing on how to compile or build SFW within OpenSolaris 2008.05 . Now, if you wonder as to what is SFW - SFW stands for Sun Freeware components - mother of all third party open source components like Apache, PHP, MySQL, PostgreSQL currently available in OpenSolaris.

So, you might wonder as to why I need build the whole load rather than just building what I want like the way we used to do in Linux. Well, the way developers build open source components in Linux is

download the specific source rpm of the components that we are interested in

build them using 'rpm -b' .

Unfortunately, OpenSolaris build system has not been updated to do this yet. Hence, we are still struck with building a whole lot even if users just wanted to compile MySQL say - with a debug build. On the positive note, engineers working within OpenSolaris does seem to recognize the importance of this and hopefully a change can be seen very shortly.

Till then, hope, you would like my quick write up - that I had to on my system - to get SFW build going. Building SFW components on OpenSolaris 2008.05 distribution - in my opinion - is a 2 step process

Download and install the necessary dependent components

Setup and configure your system so that SFW build can complete successfully.

Download / Install dependent components:

If you haven't already, you might want to download and install OpenSolaris 2008.05 from LiveCD

Next, download and install the necessary gcc and java packages from OpenSolaris pkg repository by doing something like

pfexec pkg refresh --full

pfexec pkg install pkg:/SUNWipkg-AT-0.5.11-0-DOT-91 -> this command is optional and will download the latest pkg - (something equivalent like apt-get or yum on Linux) updates from OpenSolaris repository. At the time of writing, build 91 is the latest. If you are alreadyrunning on latest update , you can safely ignore this command.

Once, we have successfully downloaded all these binaries, we will need to install this manual hack (hopefully for time being)

pfexec ln -sf /usr/bin/automake-1.10 /usr/bin/automake

pfexec ln -sf /usr/jdk/instances/jdk1.6.0 /usr/jdk/instances/jdk1.5.0

SFW build process still requires Sun Studio 11. To simplify , we will simply download the pre-install image of Sun Studio compiler rather than following another installation. the Note: You will need to provide a Sun developer user account to download this tar ball. Let us assume that you have downloaded to /tmp directory. Unpack the downloaded archive into the /opt directory as shown with the below commands:

Now, you can setup your environment so that a build process can happen successfully.

Setup your system environment

Assuming that you have unpacked SFW source tar ball to your ´<home directory>/sfwnv´ , then you will need to do the following to set up your build environment

Copy sfwnv-opensolaris.sh setup script to your home directory

cp ~/sfwnv/usr/src/tools/env/sfwnv-opensolaris.sh ~/

Edit ~/sfwnv-opensolaris.sh , using your favorite editor,to make the following changes and save the file.

GATE should point to the top of your SFW work space. If you have unpacked the SFW source tar ball to ´sfwnv´ directory, then you can leave this variable as such

CODEMGR_WS should provide an absolute path to your top build workspace (Example: CODEMGR_WS=/export/home/sriramn/sfwnv)

STAFFER change this variable to reflect your current user name

MAILTO (Optional: valid email Id if you would like to receive an email once the build is completed or failed)

Setup your PATH , JAVA_ROOT and JDK_ROOT variable as shown below. For example, on bash (default shell in OpenSolaris 2008.05),
you will do something like . Af course, if you have customized your OpenSolaris 2008.05 distribution to use other shells like csh then you will need to setup to export accordingly.

That is all there is to do. Now, you can trigger a full SFW build with all bundled open source components by running the following command:

/usr/bin/ksh93 /opt/onbld/bin/nightly -n ~/sfw-opensolaris.sh &

This above command takes a long (and very long time) to finish. So, you might better find something else to work on for a few hours. You can
monitor the build's progress using ptree(1). nightly(1) will send
mail (to $MAILTO variable in sfw-opensolaris.sh) when it is finished.

Note: If you are going to be developing or building / modifying SFW components using OpenSolaris 2008.05 distribution, I personally would encourage to first image-updatethe system to latest Nevada build. Check out opensolaris-announce to find out the latest update available and update your system accordingly to use the latest nevada build before building SFW. At the time of writing this blog, Nevada build 91 has been released for OpenSolaris 2008.05 distribution and you can update to this image as shown in this blog