WebOS Internals PDK

From WebOS Internals

Jump to: navigation, search

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.

Contents

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.


VirtualBox tips for Windows users

If you are running your Ubuntu server in a VirtualBox client on a Windows desktop host, there are a few tricks you should know.

If you run the various commands below from the ubuntu console in VirtualBox, you can not cut and paste into and out of the console. It is to your benefit then, to use PUTTY to control the VirtualBox console instead of running in it directly.

To reach your VirtualBox Ubuntu with Putty, you will need to do some set up steps.

  • From the ubuntu server console apt-get install openSSH-server
  • shut down the ubuntu server
  • In the VirtualBox manager, choose your ubuntu server and pick setup.
  • In setup choose the network adaptor 1, and change it's type from NAT to bridged.

Now, restart your ubuntu server and log into it from the regular console. At prompt after logging in, type ifconfig eth0 . The server will reply with the ip address of the virtualbox server.

Now, go to putty, and create a new login to your ubuntu server with that IP address, type ssh port 22.

Now, you can log into your server, and cut and paste commands and output, you can scroll back and see things that have scrolled off the screen etc. etc.

This is strongly advised.

Toolchain

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.

git sudo apt-get install git-core
gcc sudo apt-get install build-essential
curl sudo apt-get install curl
unzip sudo apt-get install unzip
7zip * sudo apt-get install p7zip-full
autoconf sudo apt-get install autoconf
subversion sudo apt-get install subversion
libtool sudo apt-get install libtool
wget sudo apt-get install wget
pkg-config sudo apt-get install pkg-config
gettext sudo apt-get install gettext
fakeroot sudo apt-get install fakeroot
javac * sudo apt-get install sun-java6-jdk (if this command line does not work, then do : sudo add-apt-repository ppa:ferramroberto/java; sudo apt-get update; sudo apt-get install sun-java6-jdk )
ant sudo apt-get install ant
cmake sudo apt-get install cmake
xsltproc sudo apt-get install xsltproc
intltool sudo apt-get install intltool
mkimage sudo apt-get install uboot-mkimage
lsdiff sudo apt-get install patchutils
flex sudo apt-get install flex
bison sudo apt-get install bison
libssl-dev sudo apt-get install libssl-dev
zlib1g-dev sudo apt-get install zlib1g-dev
libbz2-dev sudo apt-get install libbz2-dev
xar * sudo apt-get install xar
help2man sudo apt-get install help2man
texinfo sudo apt-get install texinfo
automake 1.10 sudo apt-get install automake1.10
autopoint sudo apt-get install autopoint
xutils-dev sudo apt-get install xutils-dev
  • 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 sudo apt-get install xar 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 xar cannot be installed with sudo apt-get install xar, then you have to download two .deb-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 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 <commit-ish>

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 "<No>" 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.

IRC name Linux Distribution Version Date Comments
Scoutcamper Ubuntu 9.04,9.10,10.04,10.10 10-18-10 Works Great!
elpollodiablo1 Ubuntu 11.04 7-13-11 Works With updated Wiki Info
nebula Ubuntu 11.04 9-7-11 It works!
yannick56 Ubuntu 11.04 12-31-11 Works With updated Wiki Info

Errors during make stage

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)


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

  • TRUE and FALSE are not defined:

Manually add the definition:

#ifndef TRUE
# define TRUE 1
#endif
#ifndef FALSE
# define FALSE 0
#endif
  • $po_makefile_in could not be found:
    • Open the file /srv/preware/cross-compile/packages/dev-e/ecore/build/src/configure.ac and search for the line with: $po_makefile_in (in my case line 1437) and replace it with po/Makefile.in

/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 $echo (which gets used in line 847 of the libtool script):

export echo=echo

and re-run make stage 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

Personal tools
Google AdSense