Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: removing references to lint being required

...

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 httphttps://omniosomniosce.omniti.comorg/wikidownload . php/Installation . 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.

...

Update (2013-06-28): Some users have reported reasonable build times with recent (>= 4.2) versions of VirtualBox on recent Apple hardware. It is as yet unknown what specifically changed to resolve the issue, but presently it appears that recent VirtualBox may be more feasible. Until we know the specifics, consider VirtualBox unsuitable or experimental at best. More testing welcome! This only applies to building illumos, and not running debug kernels.

OmniOS users: Starting with r151016 or later, this guide should be consulted.

Table of Contents

Installing required packages

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

  • On OpenIndiana it's enough to install , the build-essential meta-package

...

  • 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.
Code Block
titleOpenIndiana packages
languagebash
sudo pkg install build-essential runtime/python-35 developer/gcc-7
  • On OmniOS,

    it is encapsulated in a single

    the illumos-tools (meta)package is required:

Code Block
titleOmniOS packages
languagebash
# Use OmniOS r151014 or later, and install
# On OmniOS r151016 or later, this package also includes closed binaries and more.

sudo pkg install pkg:/developer/illumos-tools

Installing compilers

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]

...

Note that the compiler for building illumos-gate installs into /opt/gcc/4.4.4 on OpenIndiana, and /opt/gcc-4.4.4 on OmniOS and is not available in ; neither directory is in the default PATH for building application programs. You can add (OI example) PATH="/opt/gcc/4.4.4/bin:$PATH"; export PATH to your profile to reference this compiler, or install one of the other GCC builds, destined as the current default compiler for application programs (versions ranging from 3.4.3 to 4.6.x, see pkg info -r '*gcc*' for details du-jour).

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 with 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. If you do not have access to these versions, skip this section and use GCC. NOTE that OmniOS will not support builds with Sun Studio.

NOTE: The illumos project no longer supports building with the Sun Studio compiler; this section is chiefly of historical, if any, interest.  The GCC compilers described in other sections are what most people are using today.

illumos-gate does not build correctly with Sun Studio versions released after 12.0. Reportedly using a newer version of the compiler will produce a system containing grave, data-corrupting bugs.  Patched compilers were previously available from Sun Microsystems, however not licensed for redistribution. After a recent Oracle site reorganization, the necessary compilers are no longer available.

...

The repository is available from GitHub using the Git source code control system.

The Git repository URI is: git://github.com/illumos/illumos-gate.git

Or, if the Git protocol is firewalled at your siteFor best results, use the HTTPS URL to clone from Github: https://github.com/illumos/illumos-gate.git

The illumos-gate source can then be cloned using:

Code Block
cd /code
git clone githttps://github.com/illumos/illumos-gate.git

...

There are still closed components in illumos that have not yet been replaced. You must get the latest closed binaries from Sun/Oracle, since illumos currently needs those in order to build:.

Info

 OmniOS and OpenIndiana users have these tarballs installed in /opt/onbld/closed, and ON_CLOSED_BINS can be set to point to this directory directly. The following step is not required on these systems.

Code Block
cd /code/illumos-gate
wget -c \
  https://download.joyent.com/pub/build/illumos/on-closed-bins.i386.tar.bz2 \
  https://download.joyent.com/pub/build/illumos/on-closed-bins-nd.i386.tar.bz2
tar xjvpf on-closed-bins.i386.tar.bz2
tar xjvpf on-closed-bins-nd.i386.tar.bz2

NOTE: OmniOS r151016 or later and OpenIndiana users have these tarballs installed in /opt/onbld/closed, and ON_CLOSED_BINS can be set to point to this directory directly.

Note that if you had a crypto tarball from an earlier build, do not use it here, as it is no longer required to build illumos. You should remove it from your tree if already present.

According to the gcc-4.4.4-il heads-up note, the kernel modules among the closed binaries might need some fixup for proper compilation. According to several developers, however, they've never needed to do this in practice. Just in case you are trying to build some older branch of illumos which might require this modification and inexplicably breaks without it, the steps are outlined below in the troubleshooting section.

...

Code Block
cp usr/src/tools/env/illumos.sh .
vi illumos.sh       # or your favourite editor instead of @vi@"vi"

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 ear year and MAJOR is more greater that the one used by OpenIndiana. For example:  

Code Block
export ONNVPKGVERS_BUILDNUMBRANCH=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 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:

...

This should suffice for compilation of modern illumos-gate sources executed on a modern distribution. Older branches (circa 2012) might need some more setup which, along with explanation of the options, can be found below in the troubleshooting section.

We understand that the required version of Sun Studio is no longer publicly available and will accept contributions that were tested only with GCC.

OmniOS Modifications

OmniOS r151014 or later 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.

OmniOS requires that GCC-only be used.  OmniOS ALSO requires that a few other variables are set:

Code Block
titleOmniOS modsmodifications
languagebash
# HelpSet OmniOSto findthe lintcurrent export SPRO_ROOT='/opt'
 
# OmniOS places GCC 4.4.4 differently.
export GCC_ROOT=/opt/gcc-4.4.4/

# These are required for building on OmniOS.
perl version (this is correct for OmniOS r151028)
export PERL_VERSION=5.16.128
export PERL_PKGVERS=
export PERL_ARCH=i86pc-solaris-thread-multi-64int
export PERL_PKGVERS=
 
# Pre-r151022 (i.e. older) versions of OmniOS building -gate
# need to set Python versions explicitly.
# Utter "/usr/bin/python --version" to confirm.
export PYTHON_VERSION="2.6"
export PYTHON_PKGVERS="-26"

# SET ONNV_BUILDNUM appropriately - to ONU r151014, set this to 151014Set 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=151014`grep '^VERSION=r' /etc/os-release | cut -c10-`
export PKGVERS_BRANCH=$ONNV_BUILDNUM.0

You must also make sure you disable IPP and SMB printing support on the default OmniOS installation by commenting out the following lines.

Code Block
languagebash
# export ENABLE_IPP_PRINTING=
# export ENABLE_SMB_PRINTING=

...

Code Block
titleOpenIndiana Hipster mods
languagebash
# Set version which is greater than current OpenIndiana Hipster build numbers, ONNV_BUILDNUM is ignored if PKGVERS_BRANCH is set:
export PKGVERS_BRANCH=2017.3.0.0 

# Set to current perl version
export PERL_VERSION="5.22"
export PERL_PKGVERS="-522"

# If you are building on the latest OpenIndiana (2017-03-07 and later)
export BLD_JAVA_8=

...

Code Block
cd /code/illumos-gate
cptime ksh93 usr/src/tools/scripts/nightly.sh .
chmod +x nightly.sh
time ./nightly.sh illumos.sh

Note that the command does not give any progress output. You can instead follow the log file at log/nightly.log, which is updated (slowly) during the build process. In another terminal, run:

...

Code Block
cd /code/illumos-gate
./ksh93 usr/src/tools/scripts/nightly.sh -i illumos.sh

To make this the default, edit illumos.sh and add the character i to NIGHTLY_OPTIONS.
 

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

Building specific components, and other info

...

Code Block
$ sudo ./usr/src/tools/scripts/onu \
    -t nightly-`date +%Y-%m-%d` -d $PWD/packages/i386/nightly

NOTE: For OmniOS and OpenIndiana, it is critical that the ONNV_BUILDNUM PKGVERS_BRANCH is properly set in the nightly environment file be set to the OmniOS release you wish to ONU.  Otherwiseenv file (see above); otherwise, ONU will fail.

The non-typical installs are detailed in the following pages:

...

Ensuring a build with only GCC-4.4.4-il for older branches of illumos

Current illumos-gate ( as of March 2014 ) should compile cleanly with GCC with the simplified instructions above. However, some earlier versions of the gate needed more configuration steps to compile properly, and the settings below shouldn't break anything for the newer source code as well (wink)

...