wiki:BuildNomDarwin

Building NOM on Darwin aka OS X

Note: you need an Intel machine to build and run NOM.

It's unlikely this will change in the future.

This is a first draft.

If you have problems visit the #netlabs channel on the eCS IRC network and try to catch Cinc.

Prerequisites

Macports

Macports (http://www.macports.org) has to be installed to get the necessary libraries. Download the dmg for your OS release and run the included installer. You have to supply an administrator password during installation.

The installer is supposed to add the necessary directories to your path environment variable. At least on my system this failed, maybe because I don't have any .profile file but use .bash_profile. Try man port in a new terminal window (make sure the terminal app was not yet running). If this fails you have to add the necessary info by hand. See the Macports page for further info.

  • Update your Macports installation by typing sudo port selfupdate in the terminal.
  • Install GLib2 by typing sudo port install glib2.

kBuild

The build system is kBuild. Until kBuild 0.1.3 is released and a mac ports file has been created, we will be using the binary release that's on the kBuild trunk in the kBuild sub-directory. You can check this out standing in the NOM trunk (just make sure it goes into a subdirectory), or you can give it its own place outside the NOM tree. Whichever you choose, run the following to get the stuff:

   svn co http://svn.netlabs.org/repos/kbuild/trunk/kBuild kBuild

After checking out kBuild, you will have to make sure that you have some easy way of getting to kBuild/bin/darwin.x86/kmk from the command line. There a number of options:

  • Add it the kBuild/bin/darwin.x86/ directory to the PATH via .bash_profile or .profile.
  • Create an alias kmk=/wherever/kBuild/bin/darwin.x86/kmk.
  • Or run kBuild/env.sh to create a new shell instance with the changed PATH.

The last option is currently the most common one. Note that kBuild/env.sh has a number of options that can be useful for scripting and such (like --full).

Compiling It

Cd into the root of NOM, the trunk directory.

Run

   kmk

Compilation should succeed without errors. You will find the result in ./out/darwin.x86/release/installed/.

If you get the error "-bash: kmk: command not found", go back a step and make sure you've setup kBuild correctly.

Build Types - debug and release

By default kBuild will create a release build for you. For development and debugging it is recommended to use a debug build. You select this by the KBUILD_TYPE variable. You can either specify it on the kmk command line like this:

    kmk KBUILD_TYPE=debug

Or you can set it in the shell environment like this:

    export KBUILD_TYPE=debug
    kmk

The output from a debug build can be found in ./out/darwin.x86/debug/installed/.

KBUILD_TYPE can also be set to release.

Misc information

Garbage Collector

NOM uses garbage collected memory only. Go to http://www.hpl.hp.com/personal/Hans_Boehm/gc/index.html if you want to learn more about the GC. The GC will be statically linked to the NOM runtime.

IDL Compiler

The IDL compiler used for the object system is named nom-idl-compiler.

NOM Kernel and Runtime

No further info.

Test program

The executable nom-test performs some basic tests of the object system. To run (from a release build):

    ./out/darwin.x86/release/installed/bin/nom-test

Running it shouldn't show any errors.

Last modified 9 years ago Last modified on Apr 22, 2008, 12:24:13 AM