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 ./opensolaris.sh

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., opensolaris.sh), while you need explicitly set the debug option in the command line:

$ bldenv -d ./opensolaris.org.

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

C++ template class inheritance and name looking up

1 #include <stdio.h>
2
3 template <int N>
4 struct Base {
5     int base[N];
6     Base() {
7         for (int i=0; i<N; ++i)
8             base[i] = i;
9     }
10 };
11
12 int base[1024];
13
14 template <int N>
15 struct Foo : public Base<N> {
16     void dump () {
17         for (int i=0; i<N; ++i)
18             printf ("%d ", base[i]);
19         printf ("\n");
20     }
21 };
22
23 int main (int argc, char **argv) {
24     Foo<10> foo;
25     foo.dump ();
26 }

The test CPP program gives different with SunStudio CC and g++.

g++:          0 0 0 0 0 0 0 0 0 0
sunstudio CC: 0 1 2 3 4 5 6 7 8 9

And, if we comment out line #12, i.e., the definition of ::base[], g++ would complain:

test.cpp: In member function `void Foo<N>::dump()':
test.cpp:18: error: `base' undeclared (first use this function)

It's a bug of g++? Actually, no, it's the correct behavior. Refer to the release note of gcc 3.4.

> In a template definition, unqualified names will no longer find
> members of a dependent base (as specified by [temp.dep]/3 in
> the C++ standard).

Input Method repository (as well as SunPinyin) is online now!

Thanks the great work of simford, the G11N repositories went live today. Refer to the project page, http://www.opensolaris.org/os/project/nv-g11n

And now you could check out the input method repository from the centralized location, here are the build instructions:

1. Build IIIMF
2. Build SCIM
3. Build UIM
4. Build SunPinyin

and happy hacking. :)