Building for the Device

In this section:


Starting with the webOS 3.0 Emulator, you can run x86-compiled PDK code in either full-screen or hybrid mode. Code using the SDL APIs is supported, but OpenGL ES is not. To do this, you need a separate x86 toolchain for building PDK code; on Windows, you can download the current CodeSourcery G++ Lite cross-compiler from We have seen problems, however, with these tools when hosted on 64-bit Windows.

Compiling for the Device

The webOS PDK comes with code libraries you can use to either compile for the host PC or the device. To illustrate compiling for the device, we are going to use the simple sample application that comes with the PDK.


This is an example of a command-line build. It is assumed most developers already have their own system in place for building their apps, i.e., jam, make, etc.


In Windows, you can find the simple application in the following directory:

C:\Program Files\HP webOS\PDK\share\samples\simple\

In the Windows ..\simple\windows directory, you can find the buildit.cmd script, which compiles the simple app for the device.

You can run this command from C:\Program Files\HP webOS\PDK\share\samples\simple\src.

arm-none-linux-gnueabi-gcc -o simple simple.cpp "-I..\..\..\..\include" "-I..\..\..\..\include\SDL" "-L..\..\..\..\device\lib" -Wl,--allow-shlib-undefined -lSDL -lGLESv2 -lpdl


On the Mac, you can find the simple app in this directory:


The Mac has the ../simple/mac/ script for compiling.

You can run these commands from /opt/PalmPDK/share/samplecode/simple/src.

export PATH=$PATH:/opt/PalmPDK/arm-gcc/bin 
arm-none-linux-gnueabi-gcc -o simple simple.cpp -I/opt/PalmPDK/include -I/opt/PalmPDK/include/SDL --sysroot=/opt/PalmPDK/arm-gcc/sysroot -L/opt/PalmPDK/device/lib -Wl,--allow-shlib-undefined -lSDL -lGLESv2 -lpdl

Compiling with GCC

In both scripts, the GCC compiler is invoked to compile the simple application consisting of the simple.cpp source file.

  • The "-I" options point to the SDL, GL and PDL header files.
  • The "-L" options (include library) point to the location of device libraries.

Note that if you were compiling for the desktop you would link to the host libraries (...\host\lib), and not the device libraries (...\device\lib).

When GCC is run with the --allow-shlib-undefined option, the linker ignores undefined references found in libSDL and libGLESv2. These references are resolved at runtime on the device. Ignore the warning messages about needed .so files.

These warning messages you should ignore will look like this:

/opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning:, 
needed by /opt/PalmPDK/device/lib/, not found (try using -rpath or -rpath-link) 
/opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning:, needed by /opt/PalmPDK/device/lib/, not found (try using -rpath or -rpath-link) 
/opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning:, needed by /opt/PalmPDK/device/lib/, not found (try using -rpath or -rpath-link) 
/opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning:, needed by /opt/PalmPDK/device/lib/, not found (try using -rpath or -rpath-link) 
/opt/PalmPDK/arm-gcc/lib/gcc/arm-none-linux-gnueabi/4.3.3/../../../../arm-none-linux-gnueabi/bin/ld: warning:, needed by /opt/PalmPDK/device/lib/, not found (try using -rpath or -rpath-link)

Despite these messages, and barring other errors, your compilation still produces an executable.


The compilation commands shown here do not include the SDL_cinema libraries.

To compile for the device, simply substitute your source files for simple.cpp.

Compiling for the HP Pre and Pixi smartphones

Compiling for the Pre or Pixi requires using different GCC compiler options:


arm-none-linux-gnueabi-gcc -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp ...


arm-none-linux-gnueabi-gcc -mcpu=arm1136jf-s -mfpu=vfp -mfloat-abi=softfp ...

To compile for both the Pre and Pixi, use the Pixi compiler options. You only need to compile specifically for the Pre if you need to boost your app's performance on the Pre.

Inline Assembly

The embedding of low-level assembly code in C (aka "inline assembly") is supported. You would most likely want to do this for optimizing the most performance-sensitive parts of your code. For inline assembly on HP webOS devices the compiler is GCC and the instruction set is ARMv7. The ARM NEON (also called VeNUM on Qualcomm processors) instructions for SIMD are supported on all devices except the Pixi.

The ARM GCC Inline Assembler Cookbook is one recommended guide for doing this.

This series of tutorials could also be helpful:

Linking for the Device

See - Linking for the Device.

Running Your Application on the Device

After creating your app executable, you have two choices for running it on the device:

  1. The quick way -- Simply transfer your app's executable directly to the device (i.e., to /media/internal) and run it in a shell from there. See the ...\share\samples\simple\windows\runit.cmd file (Windows) or .../share/samplecode/simple/mac/ file (Mac) for an example of doing this.

  2. The App Package way -- This is the way you will have to do it, at some point, if you want to upload the app to Palm for wider distribution. This involves some configuration and building an app package file (.ipk extension) that installs the app at a designated location on the device and creates a Launcher menu icon. See Creating an Application Package.