Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Add instruction to update packages before installing build dependencies

...

You need an illumos-based operating system to build illumos (cross-compilation is not supported). If you don't have one installed, the quickest way to get started is to download and install either OpenIndiana from openindiana.org/download or OmniOS from https://omniosce.org/download . You may use a virtual machine – compilation performance may suffer, but it is functional. Some other distributions support self-hosting, including compilation of illumos-gate, as well. If you have an existing system with OpenSolaris installed, see Updating OpenSolaris to OpenIndiana.

Note: All commands in this guide assume you run them as an unprivileged user. sudo will be prepended to commands which need additional privileges; on some systems pfexec can be used instead, if your user has the correct RBAC profiles. The generic commands below use a $USER variable to define the current (unprivileged) user account's name which will ultimately be used to compile the project. If you are not using a stock shell or have manipulated the $USER variable in your environment at a site, system, or user level, you are responsible for diagnosing and addressing any consequences.

...

You need to install several packages in order to build illumos.

  • Before downloading the required packages you will need to update the packages on the system. Build dependencies will occasionally be updated between media releases of OpenIndiana and OmniOS.

Code Block
titlePackage update
languagebash
 sudo pkg update
  • On OpenIndiana, the build-essential package contains most of what's required.  In addition, a Python 3 runtime and GCC version 7 are required for a complete build with shadow checks.

...

The source code was traditionally built using Sun's closed-source compiler suite, which was named Sun Studio at the time of the illumos fork.  We now build illumos with GCC, but you will still need some tools from Sun Studio and those are available as packages in the legacy OpenSolaris repository.

GCC

The primary version of GCC necessary for development and integration 4.4.4 (4.4.4-il-4) should have been installed on your system when you installed the prerequisites above.  If for some reason that didn't happen (old build system, or the like), tarballs are available as described in the initial heads-up notice  2012-06-15 Illumos will now build with GCC 4.4.4 + patches.  We are presently also using GCC 7 as a shadow compiler as part of our effort to switch to GCC 7 for all builds (see bug 9996).


Info
titleOpenIndiana Hipster 20161030

OpenIndiana Hipster 20161030 ships with gcc-4.4.4-il-3, so make sure to update that package to -il-4 before building.

Building with 4.4.4-il-3 leads to build failures with warnings as below in the mail_msg and nightly.log:

../../i86pc/os/trap.c:2188: error: unknown conversion type character '-' in format [-Wformat]
../../i86pc/os/trap.c:2188: error: too many arguments for format [-Wformat-extra-args]

...

Unfortunately, Sun Studio lint is currently required even for GCC-only builds.  We currently deliver Lint libraries built using the closed Sun Studio version of lint (see bug 10011).  OmniOS includes this in its sunstudio12.1 package.  On OpenIndiana it's delivered as part of developerof the developer/sunstudio12u1/cc package, which you shouldn't install explicitly if you've already installed is installed automatically as part of installing the build-essential metapackage (see above).

Sun Studio compilers

If you wish to attempt to build using the legacy Sun Studio compiler, you need specifically patched versions of both Studio 12 (used to compile) and 12.1 (used for lint) to get consistent results. These are no longer distributed by Oracle and can not be legally found in the open Internet.

...

The settings we are going to focus on for now are the following:

  • NIGHTLY_OPTIONS - You may remove the "l" (lowercase L) option from the string, this will disable lint checking of the code to save some time during the build, but patches should be linted.
  • CODEMGR_WS - This should be the root of the directory with the code. If you followed the previous example, it will be /code/illumos-gate.
  • STAFFER - Change this to the name of the non-privileged user you use on the system
  • VERSION - Set this to illumos-gate or whatever version string you want for the build

...

On OpenIndiana you'll likely see something like 'Branch: 20172018.0.0.16790'. You have to use PKGVERS_BRANCH to overwrite this value, you can't use ONNV_BUILDNUM for this purpose. You should set PKGVERS_BRANCH in a form of YEAR.MAJOR.0.0 , where YEAR is the current year and MAJOR is more greater that the one used by OpenIndiana. For example:  

Code Block
export PKGVERS_BRANCH=20172018.3999.0.0


Building with only GCC-4.4.4-il (i.e. without using Sun Studio at all)

NOTE: This configuration is recommended for new most users.

If you are building with solely GCC 4.4.4 (i.e. you do NOT wish to use Sun Studio at all), you must append these lines to the end of illumos.sh:

...

In order to build illumos-gate on OmniOS, use version r151028 or higher. OmniOS has sample build files in /opt/onbld/env/omnios-* for use with illumos-gate or illumos-omnios.  If you roll your own env files, read on. You can also find sample environment files for building on different OmniOS releases at https://downloads.omniosce.org/env/.

Code Block
titleOmniOS modifications
languagebash
# Set to the current perl version (this is correct for OmniOS r151028)
export PERL_VERSION=5.28
export PERL_ARCH=i86pc-solaris-thread-multi-64int
export PERL_PKGVERS=
 
# Set to current python3 version (this is correct for OmniOS r151028)
export PYTHON3=/usr/bin/python3.5
export TOOLS_PYTHON=$PYTHON3

export SPRO_ROOT=/opt/sunstudio12.1
export SPRO_VROOT="$SPRO_ROOT"
export ONLY_LINT_DEFS="-I${SPRO_ROOT}/sunstudio12.1/prod/include/lint"
export ON_CLOSED_BINS=/opt/onbld/closed

export __GNUC=
export GNUC_ROOT=/opt/gcc-4.4.4/
export PRIMARY_CC=gcc4,/opt/gcc-4.4.4/bin/gcc,gnu
export PRIMARY_CCC=gcc4,/opt/gcc-4.4.4/bin/g++,gnu
export SHADOW_CCS=gcc7,/opt/gcc-7/bin/gcc,gnu
export SHADOW_CCCS=gcc7,/opt/gcc-7/bin/g++,gnu

# This will set ONNV_BUILDNUM to match the release on which you are building, allowing ONU.
export ONNV_BUILDNUM=`grep '^VERSION=r' /etc/os-release | cut -c10-`
export PKGVERS_BRANCH=$ONNV_BUILDNUM.0

...

Before submitting a patch, we request that you perform a full, non-incremental build including the lint stage.

Building specific components, and other info

...