Skip to end of metadata
Go to start of metadata

When it's appropriate

You can build just a component when you don't need the entire consolidation, when you are building a self-contained utility, when you are getting started with Illumos, or when you want to do a quick build.

This approach is only for independent programs like m4, date, cron, hostid, man... etc.

This example

I'm building the m4 command from the ONNV consolidation on a system running oi_148.

Requirements

Setup of the compilation environment is detailed in How To Build illumos.

Mercurial (hg)

This should be installed in /usr from the IPS package pkg:/developer/versioning/mercurial.

The compiler

The C compiler is the properly patched version of GCC 4.4.4

Build tools

These reside in /opt/onbld and are installed from the IPS package pkg:/developer/build/onbld.

The PATH

Mine is:

Just make sure all of the executables you need are available through the PATH.

I needed this symlink for the PATH to work correctly:

Preparation

NOTE: Setup of the compilation environment, including preparation of the recommended directories in a ZFS layout, and checkout of the code, is detailed in How To Build illumos.

The steps below outline an alternative (and somewhat incompatible) approach to this procedure. Still, if you only intend to build small pieces of the project, especially if you only have an unprivileged user account on the build host, these instructions should suffice and may be less complicated to follow.

Set up the location

Obtain the source

Set up the environment file

As you can see, I modified some lines in the file to suit my build system, and added a few so that the lint command from Sun Studio 12u1 could be found.

Preparing the workspace for component build

A few tools have to be prepared before we can build a component. To build them, you should run commands in a new shell which sets some environment variables:

Procedure

Location

Change directory to where the m4 Makefile (the build target of our example) resides:

Build

  1. Clean out the object files by 'make clean'. It only deletes object files, and not the generated executables. But the executables will be regenerated once all the object files are rebuilt (and become newer than the executable target).

  2. Do a dry-run by 'make -n'

  3. Now actually build m4 binary by 'make'

Note that the argument list must be quoted if it contains more than one word.

Check

Object file and i386/m4 executable file got generated.

Use "ldd" and "file" commands to profile the built m4 binary.

Run lint

Alternatives

  • Garrett D'Amore suggests:

doing "make setup" in the top level, plus a "make install" in the
directory of interest, usually works if the utility is self contained.

  • Jens Elkner recommends:

I made the src tree once nightly to "initilize" required stuff. After
that I just source the script mentioned below when I start working,
change to the dir of interest and call 'make ...'. This usually works
even if nightly doesn't run through completely ...

http://iws.cs.uni-magdeburg.de/~elkner/osol/onbld.env2

Local copy backup in illumos Wiki: onbld.env2

  • Dan McDonald cites:

http://kebesays.blogspot.com/2011/03/for-illumos-newbies-on-developing-small.html

I haven't looked very closely at the Illumos build instructions, but
I'm going to do some things now that will help kernel module writers
(e.g. device drivers) get started without resorting to a full build
right off the bat.

Some component build examples.

  1. libc build on oi_148 dual CPU with 2G RAM VMware session (also note this example uses the recommended build directory layout):

Labels:
  1. Apr 13, 2012

    TODO: Revise the information on SunStudio setup. Namely, here's what concerns me:

    AFAIK there are two versions in play simultaneously: SS12 2009Sep hosted in /opt/SUNWspro is used to compile, and SS12u1 2010Feb hosted in /opt/SUNWspro/sunstudio12.1 is used only to lint. If true, the instructions and paths above should be updated (compiler setup, The Symlink, lint locations in env-file)