Child pages
  • Setting up the recommended build environment
Skip to end of metadata
Go to start of metadata


The recommended OS to build OpenIndiana on will always be the latest development release at the time you are building. The exception to the OS rule is for bootstrapping OpenIndiana from OpenSolaris where you should have the latest development binary release (b134) installed which can be obtained from Genunix. (In case you want to upgrade an older OpenSolaris install to osol-134, follow How to upgrade to osol-134).

Setup Compiler 

The recommended build environment uses a patched Sun Studio 12 to compile along side a patched Sun Studio 12.1 to provide the lint. Both compilers are available to download as tarballs from here:

These links are no longer active. Oracle has removed these packages from public view.


Make sure your regular user account has "pkg install/uninstall" privilege in /etc/user_attr.

myregularaccount::::profiles=Primary Administrator;roles=root

Before beginning, make sure you don't have Sun Studio installed:

pkg info | grep sunstu

If they are installed, remove. Eg:

pfexec pkg uninstall -r pkg:// \
                 pkg:// \
                 pkg:// \

Keep running "pkg info | grep sunstu" and uninstalling until nothing reports back.

Then double check there is nothing under /opt related to compilers, and remove as necessary, eg:

ls -l /opt
pfexec rm -rf /opt/SUNWspro /opt/sunstudio12.1 /opt/onbld
# etc

Then install the tarballs:

pfexec mkdir /opt/SUNWspro
cd /opt/SUNWspro
bzip2 -dc $DOWNLOAD_LOCATION/sunstudio12-patched-ii-2009Sep-sol-{x86,sparc}.tar.bz2 | pfexec tar xvf -
cd /opt
gzip -dc $DOWNLOAD_LOCATION/sunstudio12u1-patched-ii-2010Feb-sol-{x86,sparc}.tar.gz | pfexec tar xvf -
pfexec ln -s ../sunstudio12.1 /opt/SUNWspro

Information of installed Sun Studio Compiler for x86 platform.

root@oi:/opt/SUNWspro# ls -lrt
total 904990
drwxr-xr-x  3 root sys          3 2008-06-03 12:15 inventory
drwxr-xr-x 12 root sys         13 2008-06-03 12:15 man
drwxr-xr-x  2 root sys          3 2008-06-03 12:16 docs
drwxr-xr-x 21 root sys         21 2008-06-03 12:17 prod
drwxr-xr-x  2 root sys          5 2008-06-03 12:17 include
drwxr-xr-x  5 root sys          5 2008-06-03 12:17 contrib
drwxr-xr-x  2 root sys          7 2008-06-03 12:17 examples
drwxr-xr-x  2 root sys         25 2008-06-03 12:17 READMEs
drwxr-xr-x  3 root sys         95 2008-06-03 12:18 bin
drwxr-xr-x  9 root sys         40 2008-06-03 12:18 lib
drwxr-xr-x  5 root sys          5 2008-06-03 12:18 sfw
lrwxrwxrwx  1 root root         9 2011-04-01 11:37 atd1 -> prod/atd1
lrwxrwxrwx  1 root root        15 2011-04-01 11:37 LEGAL-SS12 -> prod/LEGAL-SS12
lrwxrwxrwx  1 root root        16 2011-04-01 11:40 sunstudio12.1 -> ../sunstudio12.1

root@oi:~# cc -V
cc: Sun C 5.9 SunOS_i386 Patch 124868-10 2009/04/30
usage: cc [ options] files.  Use 'cc -flags' for details
root@oi:~# which cc

Note: Sun Studio 12.2 is available but has not been tested so please do not use at this time.

Install some packages:

pfexec pkg install developer/gcc-3 \
 developer/opensolaris/pkg5 \
 developer/swig \
 developer/build/automake-110 \
 developer/build/autoconf \

Setup Common Build Environment

  1. CBE(Common Build Environment) is a RPM based software build tool but it generate SVR4 package format for OpenSolaris, Solaris 10 and prior.
  2. Get CBE 1.7.0 

    svn co svn+ssh:// jds-cbe
    or from
  3. Install CBE
    1. The ./cbe-install script is not meant to be run as root. It has to be run as user with "Software Installation" or "Primary Administrator" rights! (See /etc/user_attr).

      Package SUNWgpch is not installed
      * Would you like the CBE installer to install this package for you? [yes] no
      * Would you like to skip all missing packages? [no]: yes
      * Enter the base directory (prefix) of the cbe [/opt/dtbld]: enter for default
      * Would you like to do this now? [no]: enter for default
      * Would you like to configure more compilers for use with the Desktop CBE? [no]: enter for default
      * Please select the default compiler [3]: enter for default
      Answer 'no' to all remaining questions.
    2. Following log is the last part of install log.

      Installation of <SFpkgbuild> was successful.
      Building CBEenv
      INFO: Copying %use'd or %include'd spec files to SPECS directory
      INFO: Processing spec files
      INFO: Installing package CBEenv
                               package |      status | details
                                CBEenv |   INSTALLED |
      CBE setup complete
      . /opt/dtbld/bin/ [environment]
      source /opt/dtbld/bin/env.csh [environment]
      depending on your shell, to use this build environment.
      You can also run /opt/dtbld/bin/ [environment] to start subshell.
      Installation log saved in /tmp/desktop-cbe-install-2011-04-06-08:58.log
    3. Set the CBE build environment by 

      oi@openindiana:~/oi/src/jds-cbe$ . /opt/dtbld/bin/
      Desktop CBE version 1.7.0 built on 2011-04-06 by oi@openindiana
      Unsetting USER
      Unsetting LANG
      Using CC=/opt/SUNWspro/bin/cc
      Using CXX=/opt/SUNWspro/bin/CC
      Setting PATH=/opt/dtbld/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/bin:/usr/sfw/bin
      Setting CONFIG_SHELL=/bin/bash
      Setting MAKESHELL=/bin/bash
      Setting MAKE=/opt/dtbld/bin/make
      Setting M4=/opt/dtbld/bin/m4

Then remove gnu make, so that (the other) make is the default Different consolidations require different make versions so do not remove any binaries you install while setting up your environment. Please pay close attention to the PATH variables that are set in each consolidations build instructions.

CBE source browser

Install GNU gettext-0.16.1:

Alternative: You may use pkgbuild from CBE (above).

[18:04] <Meths> Otherwise, cd jds-cbe-dir; pkgbuild -bb CBEgettext.spec
[18:04] <Meths> cd ~/packages/PKGS/CBEgettext/reloc
[18:05] <Meths> tar cf - * | ( cd /opt/dtbld; pfexec tar xvpf - )

Once you've setup and installed the recommended build environment, the build process can/shall be entirely done as user.


  • No labels


  1. Anonymous

    The pfexec commands shown here fail on oi_145 apparently due to a caiman change that removed "Primary Administrator" rights from the user account that was created during installation, Illumos Issue 204, comment #4.

  2. Anonymous

    in the section "Then install the tarballs:" above, what this command will produce:
    pfexec ln -s ../sunstudio12.1 /opt/SUNWspro

    It makes no sense.

    Predrag Zecevic

    1. Anonymous

      Seconded. the instructions do not make sense, simplified pseudo ops below
      mkdir /opt/SUNWspro
      cd /opt/SUNWspro
      extract content of sunstudio12-patched into the above

      cd /opt
      extract sunstudio12u1 which includes a "top" level directory so that /opt/sunstudio12.1 is created and files extracted there

      ln -s ../sunstudio12.1 /opt/SUNWspro

        • This is wrong, the cd /opt means we're at /opt, and then we're trying to symlink /sunstudio12.1 which is clearly wrong to the compiler home
        • we created at the start.

      Could someone clarify

      1. Anonymous

        Following up, Illumos has a better note on this

        You will install these by doing the following:pfexec mkdir /opt/SUNWspro
        cd /opt/SUNWspro
        pfexec tar xvf $DOWNLOAD_LOCATION/sunstudio12-patched-ii-2009Sep-sol-x86.tar.bz2
        pfexec tar xvf $DOWNLOAD_LOCATION/sunstudio12u1-patched-ii-2010Feb-sol-x86.tar.gz
        This results in Sun Studio 12 being installed in /opt/SUNWspro, and Sun Studio 12 Update 1 in the subdirectory /opt/SUNWspro/sunstudio12.1. The reason for this is that Sun Studio 12 Update 1 is only used for Lint.

  3. Anonymous

    Stock OpenIndiana installs don't include svn do before cbe-test stage, you need to install it via

    pfexec pkg install versioning/subversion

    1. This is added.

  4. Anonymous

    Thanks to Triskelios' pointer. "pkg install library/math/header-math" is needed other gettext build will fail.

    1. this is added.

  5. Anonymous

    is all this still working fo oi_151? I want to try to build open vm tools...

    1. Anonymous

      no, due to CBE's requirement of perl 584, 510 just won't do...

      1. Anonymous

        SUNWperl584core is not installed, perl 5.10 is, but since CBE is looking for SUNWperl584core (and the formerly installed is not using old style package name convention) it fails to install!!! help! I swear is the only thing keeping me from deploying it on few lappies I got and that won't do with OS X, so I'm going with freebsd, because openindiana won't letme setup a build environment correctly, I'm so sad...

  6. Anonymous

    As of August 1st, 2011 Sun Studio 12 (Sep 2009 version) is no longer available to download. Does anyone have a mirror? Or Does anyone have instructions to get Oracle Solaris Studio 12.2 working?

    Another hope would be to get OpenIndiana to compile with GCC

    1. Anonymous

      Just to let everyone know, the Illumos-gate build instructions now has information on building with GCC, as well as information on the missing 2009 patch.