Setup Indiana as Developer Desktop for Gnu/Gnome

After you install Indiana May Release (OpenSolaris 2008.05) in your box, you may need install the following packages to setup your box as a Gnu/Gnome developer desktop:

$ pkg install ss-dev SUNWxwinc SUNWxorg-headers SUNWgnome-common-devel \
SUNWperl-xml-parser SUNWiconv-unicode SUNWiconv-extra SUNWgit

It's a little strange, that the gtk/gnome header files are shipped in the liveCD and got installed by default, but not the X11 headers (in SUNWxwinc).

Besides that, you may still need the CBE. If you already have the installation on other machine, directly copy them to your box could just work. Or, pkgadd(1) is still available to install the SVR4 packages.

Several tips of porting GNU softwares to Solaris

1. Resolve the dependency of gnu-gettext

In most cases, the gettext(3C) on solaris could fulfill the requirements of your application. You could make following change in (or


The source package may ship with a completed gnu-gettext in its source tree (normally named 'intl'), remove it from the 'SUBDIRS' in the top-level Sometimes, there is a 'm4' directory in the source tree, contains some macro files for checking gnu libraries or GCC compiler options, remove the option '-I m4' from 'ACLOCAL_AMFLAGS' in the top-level

Then execute the following steps to update m4 macros and configure script:

glib-gettextize --force
libtoolize -c --automake
automake --add-missing

Another note is, the gnu-gettext could not retrieve the localized message compiled by solaris' msgfmt (/usr/bin/msgfmt), but solaris' gettext works fine with the message compiled by gnu's msgfmt.

2. Build socket programs

You may find that the commonly used macro 'SUN_LEN' is not defined in Solaris, add the follow definition in your header file:

+#if defined(sun) && !defined(SUN_LEN)
+#define SUN_LEN(su) (sizeof(*(su)) - sizeof((su)->sun_path) + strlen((su)->sun_path))

And before you run configure script, set the LDFLAGS as following:

export LDFLAGS=-lsocket

3. 0-sized array member in C struct

struct Foo {int bar; char data[0];};

-char data[0];
+char data[];    //change the 0-sized array to flexible array

Note, according to C99 standard, the flexible array member could only be placed in the end of a structure. And this change will not impact the layout and size of the original data structure. (Thanks tchaikov for providing the perfect solution!) While, if the 0-sized array member is not on the tail, you may have to use 'union', which requires to change the accessing code.

4. struct initialization

struct point {int x, y, z;};
- struct point x = {x:2, z:3};
+ struct point x = {.x=2, .z=3}; // c99 extension,
not supported
                                 // by sunstudio C++ compiler

5. alloca(3C) on Solaris

You need include alloca.h in your source file where you call alloca(3C).

6. wchar_t

Do NOT assume a wide char is always a UCS4 character. It's true only in UTF-8 locales on Solaris.

7. Using gcc if the source uses too much gcc extensions.

The last choice, /usr/sfw/bin/gcc. The SunStudio C compiler and gcc are compatible in ABI. But C++ compilers are different. If you are building the package on SPARC platform, GCC4SS has better performance than gcc.

First impression about Indiana -- OpenSolaris Developer Preview

Today, I installed indiana preview release (get it here) on an existing solaris partition. And the installation time is a little longer than I expected. The only one issue I met is, after the installation, grub was not installed properly. So, we have to use
installgrub(1) to reinstall it on MBR. The root password on livecd is "opensolaris".

Currently the software package repository is still small (have a look at Anyway, it's the first step (also an important step), and I believe it will lead opensolaris to bigger success.

BTW, you may try to install Glassfish packages via IPS, refer to

Several Tips to build the opensolaris ON repository

In the last weekend, I tried to build the latest onnv-gate on my laptop (which is running snv_66).  I checked out the onnv-gate repository, and installed SUNWonbld.

In recently Solaris Developer Express build, SunStudio 12 is installed out of box. While the ON (Operating platform and Networking) repository still requires SunStudio 11. Move /opt/SUNWspro to /opt/sunstudio_12/SUNWspro, and install SunStudio 11 to /opt/sunstudio_11/SUNWspro, then create a symbol link /opt/SUNWspro referring to SunStudio 11.

I found changing SunStudio path at the $PATH in nightly(1) does not take effect, seems that the "cw -_cc" still gets the compiler from /opt/SUNWspro/bin.

Then launch nightly(1) to build the code. I found that some env variables may impact the building. At the beginning, I could not successfully build the code with my own account,
but I could make it with "gk". Thanks to Yandong, he reminded me to use "env -" to execute nightly(1):

$ env - /opt/onbld/bin/nightly ./

Besides that, seems that I need to remove the usr/platform/i86pc/ilb/fm/fmd and  usr/platform/i86pc/ilb/fm/fmd/plugins in the closed binary directory. Otherwise, nightly(1) would fail to build the usr archive:

Failed to create i86pc usr archive:     2110 blocks
cpiotranslate: usr/platform/i86pc/lib/fm/fmd/plugins: no packaging info
cpiotranslate: usr/platform/i86pc/lib/fm/fmd: no packaging info

And I also noticed bldenv(1) does not recognize the debug option in the env file (i.e.,, while you need explicitly set the debug option in the command line:

$ bldenv -d ./

P.S., from the [osol-discussion] thread, it seems that SunStudio 12 could successfully build the latest onnv-gate repository now.

OpenSolaris plus gnu/gnome

OpenSolaris launched in And from, you could see that you will be able build OpenSolaris with gcc tools in future.

I am not an OS expert :), but personally, I think someone may have
interests to build an OpenSolaris distribution with OpenSolaris kernel
and admin tools plus gnu software stack, including gnu libc (is it
possible?) ,gnu shell utilities, Xorg (does not belong to Gnu; Solaris 10 x64 are using xorg),
Gnome desktop environment (Solaris 10 already bundled Gnome 2.6).
Actually, you could download many opensource softwares from

At last, welcome to Internationalization and Localization community for OpenSolaris!