WebOS Internals PDK

Palm's binary sdk the "Plugin Developer Kit" became available to all developers in March 2010.

When the widk was developed, the Palm PDK didn't exist, and until Dec 2010, it was not possible to run the PDK in Linux. If you would like to run the official Palm PDK, see PDK on Linux for directions.

In addition to the PDK, webOS Internals has released a full "WIDK" (webOS Internals Development Kit) for you using Scratchbox2.

Less than 10% of developers in the webOS developer community use Linux variants. Among those 10% there are dozens of different linux distributions that people use. Palm, therefore has chosen to support only Mac and Windows platforms for their PDK. Palm recommends that Linux based developers use the webOS-internals WIDK instead.

We strongly urge the open-source homebrew community to standardize on this WIDK. It uses the same underlying technologies, and is entirely open.

Scratchbox 2 is a cross-compilation engine, it can be used to create a highly flexible SDK.

As installed below, the install process uses a script which extracts the required Palm provided files from a copy of webOS doctor, and downloads from other sources, and builds a complete compilation environment automatically which can compile SDL and openGLES apps for webOS.

SB2 itself is totally distribution neutral but the webOS cross-compile environment is designed and tested on Ubuntu Server 11.04 32 bit. See WebOS_Internals_PDK_on_Mandriva if you want to run it on Mandriva. If you want to run the WIDK on other distributions and are willing to support that yourself and not ask webOS Internals any questions about it then please enjoy and if you succeed come back here and make a new article on how you did it. Otherwise, use the recommended OS.

The webOS Internals team strongly suggest apt-get install into the Ubuntu environment only for this purpose. The same installation of Sun Virtualbox which hosts the Palm SDK emulator can host an Ubuntu 11.04 server with very little effort on any operating system.

Developers wanting to work in a Gentoo environment 'without' SB2 can consider using the PuffTheMagic NDK.

Installing Ubuntu
You can download VirtualBox here : https://www.virtualbox.org/wiki/Downloads  You can download ISO files to burn Ubuntu CD or DVD here : http://www.ubuntu.com/download/ubuntu/download  but if you want to spend a litle time for installing Ubuntu in VirtualBox, then use Ubunbu image available here : http://virtualboxes.org/images/ubuntu/  After installing your ubuntu image, don't forget to use bridge network configuration in Virtualbox. Then in the Ubuntu console, type : sudo apt-get install telnet ssh virtualbox-ose sudo apt-get update sudo apt-get upgrade In the Ubuntu desktop menu, go in System -> Preferences -> Keyboard -> Layouts tab to change the keyboard type. Then next reboot your ubuntu.

SB2 Homepage
http://www.freedesktop.org/wiki/Software/sbox2pdk

License
Scratchbox 2 is distributed under LGPL version 2.1, portions are under GPL version 2. Some minor stuff is under MIT style license.

Installation on Ubuntu for webOS PDK cross compiling
If setting up in a Virtual Box instance, it is recommended that you first complete the openSSH config as described in the VirtualBox tips for Windows users to the right. This is helpful even with a Linux host, as SSH into the PDK Virtual Machine will allow copy and paste of the commands listed below and reduce errors.

Prerequisites
Your Ubuntu installation will need the following installed. If you do not have them, run the command after the package name. You can test if they are found by just typing the command name. If it says command not found, you need to install it.


 * 7-Zip version 4.59 or greater is needed
 * it has been reported that sun-java6-jdk isn't necessary
 * On Ubuntu 11.04 xar might not install using  See Note 2 Below

If you're uncertain at all, and you're using Ubuntu 11.04, just cut and paste the following. If they are already installed, they'll be skipped. xar is not included in the code below.

sudo apt-get install git-core build-essential curl unzip p7zip-full autoconf subversion libtool wget pkg-config gettext fakeroot ant xsltproc intltool uboot-mkimage patchutils flex bison libssl-dev zlib1g-dev libbz2-dev help2man texinfo automake1.10 autopoint xutils-dev cmake

Note: If you are a beginner with Ubuntu Linux Distribution, you should update all the packages on your system to avoid problems when you will compile.

Note 2: If  cannot be installed with , then you have to download two  -files manually and install them (in the order they are listed):
 * If you're using Ubuntu 11.04:
 * 1) libxar1
 * 2) xar
 * If you're using Ubuntu 12.04:
 * 1) libxar1 and xar
 * If you're using Debian 6.0.2 (Squeeze):
 * 1) libxar1
 * 2) xar

If you have not xar packages in your repo, then find the files in the previous links and next install manually xar files : sudo dpkg -i libxar1_1.5.1-1_i386.deb xar_1.5.1-1_i386.deb

After that execute the above command again.

Use these 2 command line : Update repositories  : sudo aptitude update (if it doesn't work use : sudo apt-get update ) And next, update the packages : sudo aptitude safe-upgrade (if it doesn't work use : sudo apt-get upgrade )

If you're on a 64-bit system, you will also need to install the ia32-libs package.

Note: The make toolchain command and later steps will download approximately a half-gig of tools and sources from various locations. Do not start this if you do not have time for a large download. Additionally, if you already have downloaded a copy of the correct version of the WebOS doctor, you can reduce the download time by copying the doctor file into cross-compile/doctors/ with the correct name. This will cause the appropriate command to skip that download. Note that codesourcery rate limts downloads and at a minimum this process will take 10 to 15 minutes irrespective of your connection speed.

Start setup
Create a preware folder, copy the cross-compile tools into it (if you have not installed git, apt-get install git-core), and use a make script to begin the set up of the compilation toolchain.

sudo mkdir -p /srv/preware cd /srv/preware sudo chmod 777. git clone git://git.webos-internals.org/preware/cross-compile.git cd cross-compile make toolchain

If errors occur, browse the repository online and checkout earlier commits until you get something that gets through "make toolchain" and the later "make stage" commands like so:

git checkout  or $ cd /srv/preware/cross-compile/ $ ls -la drwxr-xr-x 8 ubuntu ubuntu 4096 2011-12-31 17:33 .git -rwxr-xr-x 1 ubuntu ubuntu   79 2011-12-31 17:33 .gitignore $ git branch * master $ git checkout master Already on 'master' $ git checkout $ ls -la drwxr-xr-x 8 ubuntu ubuntu 4096 2012-01-09 12:09 .git -rwxr-xr-x 1 ubuntu ubuntu   79 2011-12-31 17:33 .gitignore

Verify sh shell
On Ubuntu /bin/sh is a symbolic link to dash. This will cause errors with the make stage command below, as some of the scripts assume bash. Run the following command to see what shell sh is linked to.

ls -l /bin/sh

If the result is a link to dash:

lrwxrwxrwx 1 root root 4 2010-07-06 23:55 /bin/sh -> dash

You will want to correct it with the following:

sudo dpkg-reconfigure dash

You will be asked if you want to "Install dash as /bin/sh?". Select "" and bash will be used. Rerun the command to verify:

ls -l /bin/sh

You should now see:

lrwxrwxrwx 1 root root 4 2010-07-09 21:12 /bin/sh -> bash

Setup Scratchbox
Now, use apt-get to setup scratchbox...

sudo apt-get install scratchbox2 qemu-kvm-extras (in Debian install qemu-user and qemu-system instead of qemu-kvm-extras)

...and set it up for compiling for webOS.

cd /srv/preware/cross-compile/toolchain/arm-2007q3/arm-none-linux-gnueabi/libc PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:${PATH} sb2-init -c /usr/bin/qemu-arm armv7 arm-none-linux-gnueabi-gcc PATH=/srv/preware/cross-compile/toolchain/arm-2007q3/bin:${PATH} sb2-init -c /usr/bin/qemu-arm armv6 arm-none-linux-gnueabi-gcc cd /srv/preware/cross-compile

On some distributions such as recent Debian and Ubuntu, you'll have compiler problems with these values - use sb2-qemu-arm instead of qemu-arm in the sb2-init command lines above.

Then:

make setup

Once this setup is complete, compiling sdl apps for webOS is very simple. Note that the set up for i686 is not yet determined.

Verified installed clean list
If you have successfully built the WIDK from scratch, with NO problems, feel free to add your information to this list. This will help us assess what distributions and versions it is fully compatible with.

automake1.10
If you see the error below, you need the latest automake (1.10)

/usr/share/automake-1.9/am/depend2.am: am__fastdepOBJC does not appear in AM_CONDITIONAL configure.in:88: installing `./config.guess' configure.in:88: installing `./config.sub' Makefile.am: installing `./INSTALL' autoreconf2.50: automake failed with exit status: 1

Install automake1.10 and it should work (according to this page)

Fix mmap errors
The following commands appear redundant. They are not. The install this fixes your mmap config to fix an mmap: permission denied error, but we don't need the package itself. (Do each command separately with cut and paste).

sudo apt-get install qemu-arm-static sudo apt-get remove qemu-arm-static

It appears that this package has been renamed qemu-kvm-extras-static in Ubuntu 11.04.


 * OR As a workaround, if this package is not available,
 * the following commands can be executed in a root shell (sudo -s) to fix the mmap configuration to enable qemu-arm to work.

echo "vm.mmap_min_addr = 4096" > /etc/sysctl.d/mmap_min_addr.conf /etc/init.d/procps restart

(note that the value should not be "0". 4096 is chosen to avoid null pointer attacks.)

Libtool
make[5]: Entering directory `/srv/preware/cross-compile/packages/common/libdotconf/build/armv6/src' /bin/sh ../libtool --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -Wall -g -O2 -MT libdotconf_la-dotconf.lo -MD -MP -MF .deps/libdotconf_la-dotconf.Tpo -c -o libdotconf_la-dotconf.lo `test -f 'dotconf.c' || echo './'`dotconf.c libtool: Version mismatch error. This is libtool 2.2.6b, but the libtool: definition of this LT_INIT comes from libtool 2.2.6. libtool: You should recreate aclocal.m4 with macros from libtool 2.2.6b libtool: and run autoconf again. make[5]: *** [libdotconf_la-dotconf.lo] Error 63 make[5]: Leaving directory `/srv/preware/cross-compile/packages/common/libdotconf/build/armv6/src' make[4]: *** [install-recursive] Error 1 make[4]: Leaving directory `/srv/preware/cross-compile/packages/common/libdotconf/build/armv6' make[3]: *** [build/armv6.built] Error 2 make[3]: Leaving directory `/srv/preware/cross-compile/packages/common/libdotconf' make[2]: *** [build_common/libdotconf] Error 2 make[2]: Leaving directory `/srv/preware/cross-compile' make[1]: *** [staging-armv6] Error 2 make[1]: Leaving directory `/srv/preware/cross-compile' make: *** [stage] Error 2

Confirmed by 3 people. Fix this by either (your choice)
 * upgrading to Ubuntu 10.04 or newer (the WIDK now relies on a slightly newer version of libtool that's not in 9.10 or earlier)
 * updating libtool to 2.2.6b-2 (backported to 9.10, see available downloads on http://linuxappfinder.com/package/libtool#ubuntu_karmicpartner)

If you're getting an error where sb2-init gives you the following output:

checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. Running /usr/bin/sb2-build-libtool failed You can run this manually later, otherwise your sb2 environment is correctly setup and ready to use

You need to upgrade qemu. Alternatively, if your sb2-init output fails with a different output, like this:

checking for gcc... gcc checking for C compiler default output file name... a.out checking whether the C compiler works... configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details. sb2-init completed successfully, have fun!

Then you need to upgrade scratchbox, too (install 2.0 instead of 1.99).

ecore
Manually add the definition:
 * TRUE and FALSE are not defined:


 * 1) ifndef TRUE
 * 2) define TRUE 1
 * 3) endif


 * 1) ifndef FALSE
 * 2) define FALSE 0
 * 3) endif


 * could not be found:
 * Open the file  and search for the line with:   (in my case line 1437) and replace it with

/bin/sh errors
If you are getting a "bad fd number" or other /bin/sh error, make sure your /bin/sh points to bash, not another shell (such as dash.)

Go back through the Verify sh shell section above to correct.

further download errors
rwhitby's suggestion:

If you don't need that package which is failing for you, just move it to the nonworking directory and try again.

14 July 2011=Using Rod's approach: So far I had to move fuse, unionfs-fuse, dev-gl, voip and x (pango and pixman failed). Using Ubuntu 11.04.

X--tag=CC: command not found
While running make stage on Ubuntu 10.10, I got the following error during compilation of sdl-gfx:

/bin/sh ./libtool --tag=CC  --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DPACKAGE=\"SDL_gfx\" -DVERSION=\"2.0.20\" -DSTDC_HEADERS=1  -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1  -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DX_DISPLAY_MISSING=1 -DBUILD_DLL -I. -g -O2 -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -MT SDL_gfxPrimitives.lo -MD -MP -MF .deps/SDL_gfxPrimitives.Tpo -c -o SDL_gfxPrimitives.lo SDL_gfxPrimitives.c ./libtool: line 847: X--tag=CC: command not found ./libtool: line 880: libtool: ignoring unknown tag : command not found ./libtool: line 847: X--mode=compile: command not found ./libtool: line 1014: *** Warning: inferring the mode of operation is deprecated.: command not found ./libtool: line 1015: *** Future versions of Libtool will require --mode=MODE be specified.: command not found ./libtool: line 1158: Xgcc: command not found ./libtool: line 1158: X-DPACKAGE_NAME="": command not found ./libtool: line 1158: X-DPACKAGE_TARNAME="": command not found

In order to fix this problem, I had to run this command to set  (which gets used in line 847 of the libtool script):

export echo=echo

and re-run  in the same shell session.

missing macro AM_PATH_SDL in making libsdl-gfx
In Ubuntu Server 11.04 amd64 I had to install the package libsdl1.2-dev to get past this. I also needed the X--tag=CC fix above. Also for Ubuntu 11.04 i386 install the package libsdl1.2-dev.

virtualbox-ose missing
I have the following error with Ubuntu 11.04 : ... Extracting nova-cust-image-sdk1457.vmdk Everything is Ok Size:      397672448 Compressed: 164460248 VBoxManage clonehd rootfs/i686/extract/nova-cust-image-sdk1457.vmdk rootfs/i686/extract/nova-cust-image-sdk1457.raw --format RAW make: VBoxManage: Command not found make: *** [rootfs/i686/.unpacked] Error 127

and I fix it by installing virtualbox-ose pakage as this : sudo apt-get install virtualbox-ose

etags: command not found
If staging fails during compilation of liblinphone (possibly other packages) with an error similar to the following:

(cd build/src; etags `find . -type f -print`) /bin/sh: etags: command not found make[2]: *** [build/.unpacked] Error 127 make[2]: Leaving directory `/srv/preware/cross-compile/packages/voip/liblinphone' make[1]: *** [build_voip/liblinphone] Error 2 make[1]: Leaving directory `/srv/preware/cross-compile' make: *** [stage-armv7] Error 2

Then you need to install the emacs common package. On Ubuntu the command you need is:

sudo apt-get install emacs23-bin-common

xorg-xserver: must install fontutil
If staging fails during compilation of xorg-xserver with an error similar to the following:

autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal --force -I m4 configure.ac:43: error: must install fontutil 1.1 or later before running autoconf/autogen configure.ac:43: the top level autom4te: /usr/bin/m4 failed with exit status: 1

Then you need to install the xfonts-utils package. On Ubuntu the command you need is:

sudo apt-get install xfonts-utils

Sample build of Application:Doom
Now, go to Building DOOM with scratchbox2 and follow the simple directions.

In Process Enhancements
Extracting the PDK on Linux