CDC Build System: Host Environment

Once you have downloaded the source code for phoneME Advanced MR1, you can use the build system included with it to build different executable versions of a CDC Java runtime environment. These different versions can include different peformance features, API options or run on different target platforms.

The following sections show how to setup the CDC build system on a Linux/x86 host platform, and then build different versions of the CDC Java runtime environment that will also run on a Linux/x86 platform. A later section describes how to build different versions of the CDC Java runtime environment that will also run on alternate devices like advanced phones.

This guide only covers the basic build procedures and build options. See the CDC Build System Guide for more information about build options, build system organization and tool setup issues.

See CDC Build System: Target Devices for information on how to build executable versions of the CDC Java runtime environment for various embedded target devices.


Build System Setup

Install the Linux Build Tool Packages

The CDC build system included with the source code for the phoneME Advanced MR1 can run on many different Linux distributions. To run the CDC build system, you will need certain Linux developer tools like a C/C++ compiler as well as the Java developer tools included in the Java SE SDK.

A reasonable guideline is that a recent, common Linux distribution should include the tools needed by the CDC build system. However some user-oriented Linux distributions like Ubuntu and openSUSE may not include the necessary tools by default. So the tables below provides guidelines for acquiring the necessary tools.

Note: Linux distributions have a mechanism for deploying pre-built software called a package management system. There are two main Linux package management systems:

Note that the source code and build system for this release have been tested with earlier versions of gcc as well, in particular 3.3.x and 3.4.x.

Install the Java Build Tools

Download and install the Java SE SDK, version 1.4.2. The examples below are based on installing the Java developer tools in /usr/java/j2sdk.

Note that many Linux distributions include alternate implementations of these Java developer tools. We have only tested and run the CDC build system with the Java developer tools provided by Sun.


A Simple Example Build: CDC

Once you've set up the CDC build system by installing the necessary build tools and specifying their location in the GNUmakefile, then you can perform a simple build process to validate the build system.

The simplest build target is CDC without any profile. This is a "headless" implementation that we'll use to run a basic HelloWorld application.

Build the Executable

The CDC build system is launched with a single make command.

% make

The build system will display a log of the build process. If the build is successful, it will display something like:

...
make[1]: Entering directory `/home/user/phoneme-advanced-mr1/build/linux-x86-generic'
make[1]: Nothing to be done for `tools'.
make[1]: Leaving directory `/home/user/phoneme-advanced-mr1/build/linux-x86-generic'

If the build fails at some point, your build tools are probably misconfigured or not compatible. The first step is to look at the definitions of variables:

Variable Description
CVM_HOST_TOOLS_PREFIX Location of the host build tools.
CVM_JAVA_TOOLS_PREFIX Location of the Java build tools.

Test the Executable

When the build process completes successfully it generates an executable CDC Java runtime environment. The component files of the CDC Java runtime environment are located in the target build directory. The most basic runtime files are in the bin and lib directories and a set of demo programs are in testclasses.zip.

Here is the command-line for running a simple test application.

% bin/cvm -cp testclasses.zip HelloWorld

Building Foundation Profile

Foundation Profile (FP) is a more complete API specification for headless devices. The steps described above can be easily modified to build an executable for FP. All you have to do is add J2ME_CLASSLIB=foundation build option to the build options in the GNUmakefile.


More Build Options

The CDC build system includes many build options and targets:

  • API choices. The Java ME platform has a configurable API architecture which allows designers to select standardized APIs that are appropriate for a given target device. The CDC white paper describes these API choices in more detail. For now, it's important to understand that these choices are made available through the build system as build options. For example, the choice between which Java ME profile to use is controlled by the J2ME_CLASSLIB build option.

  • Testing features. Some build options are intended only for development and testing purposes. These include CVM_TRACE for tracing VM events and CVM_JVMDI for enabling Java debugging.

  • Performance features. And finally, some build options are intended for performance. For example, CVM_PRELOAD_LIB uses JavaCodeCompact to preload the Java class library so that it can execute out of ROM. And CVM_JIT builds an executable with a JIT.

The CDC Build System Guide provides tables that describe each build option.


Building Personal Basis Profile

The CDC build system has many build options for building versions of the CDC Java runtime environment with additional API capabilities. For example, Personal Basis Profile (PBP) is an API specification for providing GUI capabilities. While PBP is not itself a GUI framework, it provides an infrastructure for implementing lightweight GUI widget toolkits like Swing and support for the xlet application model.

This build example will show how to build the CDC Java runtime environment with a PBP implementation based on the Qt GUI framework.

Setup the Build System

The build system requirements for PBP are the same as the base requirements described earlier with the addition of the Qt3 development libraries.

Debian
Package
Version
libqt3-compat-headers 3.3.6
libqt3-mt-dev 3.3.6
    
RPM
Package
Version
qt3 3.3.5
qt3-dev 3.3.5

Build the Executable

Building PBP requires a few additional build options. You can put these make variables on the make command-line or add them to the GNUmakefile.

J2ME_CLASSLIB=basis
QT_TARGET_DIR=/usr/share/qt3/lib
X11_LIB_DIR=/usr/X11R6/lib

QT_TARGET_DIR refers to the location of the Qt3 development libraries. X11_LIB_DIR refers to the location of the X11 libraries.

Test the Executable

Here is the command-line for running a PBP test application.

% bin/cvm -cp democlasses.jar basis.DemoFrame

Building Personal Profile

Personal Profile (PP) is also an API specification for providing GUI capabilities. In fact, it's a superset of PBP which adds support for AWT and applets.

Setup the Build System

The build system requirements for PP are the same as the build system requirements for PBP described earlier.

Build the Executable

Building PP requires a few additional build options. You can put these on the make command-line or add them to the GNUmakefile.

J2ME_CLASSLIB=personal

Test the Executable

Here is the command-line for running a PP test application.

% bin/cvm -cp democlasses.jar personal.DemoFrame