How to build sfwnv consolidation within OpenSolaris 2008.05
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 already running on latest update , you can safely ignore this command.
- Now, let us install the missing but necessary development tools like GCC, Java , bison, flex etc
- pfexec pkg install gcc-dev amp-dev java-dev
- pfexec pkg install SUNWscp SUNWgnu-idn SUNWlibevent SUNWugenu
- pfexec pkg install SUNWbison SUNWflexruntime SUNWflexlex SUNWtoo
- pfexec pkg install SUNWgmake SUNWaconf SUNWlibtool
- pfexec pkg install SUNWgm4 SUNWgnu-automake-110
- pfexec pkg install SUNWsqlite3 SUNWpysqlite
- pfexec pkg install SUNWlibopenusb
- pfexec pkg install SUNWgnome-base-libs-java SUNWgnome-common-devel
- pfexec pkg install SUNWxorg-headers SUNWGlib SUNWxwinc
- 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
/optdirectory as shown with the below commands: cd /optbzcat /tmp/sunstudio11-ii-DATE-PLATFORM.tar.bz2 | pfexec /bin/tar -xf -- Now, we will need to download SUNWonbld package. Let us unpack this download ON specific build tool to /tmp and install as shown below
- cd /tmp
- bunzip2 -c SUNWonbld.i386.tar.bz2 | tar xf -
- pfexec /usr/sbin/pkgadd -d onbld
- Finally, let us download SFW source from here and unpack into your home directory as shown below
- mkdir -p ~/sfwnv
- cd ~/sfwnv ; bunzip2 -c /tmp/<downloaded-sfw-source-tar-ball> | tar xf -
- 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.
- export PATH=/usr/bin:/usr/ccs/bin:/usr/sfw/bin:/opt/SUNWspro/bin:/opt/onbld/bin
- export JDK_ROOT=/usr/jdk/latest
- export JAVA_ROOT=/usr/jdk/latest
-
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 &
- /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.
- For more information on this build process, check out the official build instructions from OpenSolaris SFW project page.
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-update the 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


Very useful info. Should be collected into "The Observatory". Thanks.
Posted by W. Wayne Liauh on July 01, 2008 at 09:02 PM PDT #
Looks like, I missed mentioning that couple of packages that you will also need to install before proceeding to setup and build your environment.
a) pfexec pkg install SUNWsfwhea
b) Download SXCE DVD iso (1 segment) from OpenSolaris downloads from - http://www.opensolaris.org/os/downloads/ and mount the ISO image . You will need to install SUNWmfr package by doing something like
pfexec /usr/sbin/lofiadm -a /export/home/sriramn/solarisdvd.iso
pfexec /usr/sbin/mount -F hsfs -o ro /dev/lofi/1 /mnt
cd /mnt/Solaris_11/Product && pfexec /usr/sbin/pkgadd -d SUNWmfrun
Posted by Sriram Natarajan on July 02, 2008 at 03:25 PM PDT #
it should be pkgadd -d . SUNWmfrun
you have forgotten "." remember you are the "." in .com :)
Posted by Harshal on July 04, 2008 at 02:58 AM PDT #
There's a sticking-point getting hold of that SXCE DVD. Is there no other way to obtain SUNWmfrun?
BTW, before reading that comment, I made it through to trying to run "nightly" as recommended, and it complained of no dmake. So I made a local copy of the "nightly" script and amended the PATH to include it. But I really don't think that should be necessary!
Posted by niq on July 07, 2008 at 04:02 PM PDT #
Aborted due to missing compiler: it's looking for /opt/SUNWspro/bin/cc.
I have SunStudio cc and GNU cc, and I'm thinking this "nightly" script is not compatible with this system.
Posted by niq on July 08, 2008 at 06:09 AM PDT #
OK, setting SPRO_VROOT and AMD64_VROOT in sfw-opensolaris.sh starts the job successfully. Perhaps a missing step in the instructions.
Other suggested errata:
* Setting the environment variables is I think a red herring: they are overridden in the build scripts.
* You should mention the log and "mail message" in sfwnv/log. The "mail" isn't being mailed, but is left in the log directory, with the logfile. Knowing where to find the log is crucial!
As I write, it's crashed out again: the underlying error is
"../common/libusbugen.c", line 52: cannot find include file: <sys/usb/clients/ugen/usb_ugen.h>
I really wonder why I need to build USB stuff in order to get a working webstack repository ... but I guess that's not your problem!
Posted by niq on July 08, 2008 at 06:29 AM PDT #
> I really wonder why I need to build USB stuff in
> order to get a working webstack repository
Yes good question isn't it...
Problem is that the apps don't have normal build environments, instead every app is in one huge source tree so you'll need to build (and satisfy dependencies for) all kinds of unrelated things.
Some more info here:
http://blogs.sun.com/jyrivirkki/entry/adventures_in_building_a_web
Posted by Jyri on July 10, 2008 at 09:03 AM PDT #