Meet Mr. DTrace - Part 2

OpenSolaris Express Developer Edition asks for more than 768M memory, 8G disk, what a demanding monster! I could not fit it into VMWare on my laptop 700m. Therefore, before I order a new powerful desktop, I might stick to the NexentaOS right now.

SunStudio 11 is the native compiler in Solaris so it is supposed to work with DTrace static provider. Unfortunately there is no success story to install SunStudio 11 on NexentaOS so far according to the IRC discussion, I need to find my own way to work around this problem.

SunStudio is packaged in pkgcmd format, to make things even worse, NexentaOS drops the native pkgcmd, and replace it with a wrapper for Debian package. To automation the tedious unzip, copy, chown, chmod, ln and last but not the least, dependency resolving, I develop this python script

To use this script, you need to change your work directory to the packages, then you can list the available packages:

cd /cdrom/sol\_x11\_x86/DeveloperTools/SunStudio/X86/kits/ide/packages
emerge.py -l .

We only care about the SunStudio C compiler, before we emerge it, we might take a look at the dependencies:

emerge.py -p SPROcc

calculating the dependency recursively ....
SUNWkvm  Core Architecture, (Kvm)
SUNWhea  Header files
SUNWcsu  Core Solaris, (Usr)
SUNWcsr  Core Solaris, (Root)
SUNWtoo  Programming Tools
SPROlang  Components for Sun compilers and tools
SUNWesu  Extended System Utilities
SPROdwrfb  Dwarf Support Library binaries
SPROcc
SUNWcar  Core Architecture, (Root)

There are some packages missing, for example SUNWesu, since we are using APT package system, just ignore them, and install the package, emerge.py will recursively install all packages available in the current path:

emerge.py SPROcc

This procedure includes the following steps:

After that, you need to add /opt/SUNWspro/bin to your ${PATH}, and compile the very first application, hello world. Oops, cc could not find stdio.h. It compiles simple C source code without library. It seems that the C Compiler is not well configured, I would figure it out later.