The steps of this tutorial have been tested on an ubuntu-x86 box. If you don't have linux installed on a PC, you can use:

pdax86 is just like pdaxrom on your Zaurus, except that it runs on a desktop pc. The benefit of using this distribution rather than another one is that it contains all the libraries and utilities with which the cross-compiler has been built.

Not the cross compiler will not work under cygwin, MacOsx or non x86 linux (ie linux-ppc). The cross compiler contains linux-x86 binaries.

1 Installation

1.1 download the cross sdk

Go to the pdaxrom download page and fetch the cross compiler archive you need, for instance for my SL-C860 I use cross-sdk-armv5tel-cacko-linux-3.4.5-2.2.5-softfloat.tar.bz2

1.2 uncompress the archive in the root directory

On my ubuntu box, I need super user rights to do this, so I use sudo.
ubuntu@ubuntu:/$ cd / 
ubuntu@ubuntu:/$ sudo tar jxvf ~/Desktop/cross-sdk-armv5tel-cacko-linux-3.4.5-2.2.5-softfloat.tar.bz2

1.3 libiconv

If you use pdax86, you can skip this step. pdaxrom uses libiconv to avoid the dependency on gconv. However most recent linux distributions use the functions from the glibc library rather than a separate libiconv. If your system doesn't have installed, for instance if you get the error:

error while loading shared libraries: cannot open shared object file: No such file or directory
while running arm-cacko-linux-gcc, you need to install the library.

First download, place it in /opt/cross/arm/3.4.5-xscale-softvfp/lib/ and make it executable:

ubuntu@ubuntu:/$ sudo mv ~/Desktop/ /opt/cross/arm/3.4.5-xscale-softvfp/lib/
ubuntu@ubuntu:/$ sudo chmod  a+x /opt/cross/arm/3.4.5-xscale-softvfp/lib/

Then modify /opt/cross/arm/3.4.5-xscale-softvfp/ add the line, somewhere with the other export, before bash:

export LD_LIBRARY_PATH=/opt/cross/arm/3.4.5-xscale-softvfp/lib
For instance use:
ubuntu@ubuntu:/$ sudo gedit /opt/cross/arm/3.4.5-xscale-softvfp/

That's it, the cross-compiler is installed

2 Usage.

2.1 initialize the environment

The cross-compiler contains a little script that will set up the right environment variables: Use the sdk only in a terminal where you have previously run this script. The script does not set the environment of the whole system.

ubuntu@ubuntu:~$ /opt/cross/arm/3.4.5-xscale-softvfp/
Type exit for leave armv5tel-cacko-linux cross environment.

2.2 try the compiler

Make sure to be in a directory where you have enough rights (for instance go to your home directory)
ubuntu@ubuntu:~$ cd 
ubuntu@ubuntu:~$ echo -e '#include "stdio.h"\n int main(){ printf("Hello World\\n"); }' > hello.c
ubuntu@ubuntu:~$ armv5tel-cacko-linux-gcc -o hello hello.c 
ubuntu@ubuntu:~$ file hello
hello: ELF 32-bit LSB executable, ARM, version 1 (ARM), for GNU/Linux 2.0.0, dynamically linked (uses shared libs), not stripped
You can try now to run "hello" on you zaurus. Hopefully you have successfully cross-compiled your first programs for pdaxrom. :)

2.3 cross-compiling an application- an example compiling links2

2.3.1 download an uncompress the sources:
ubuntu@ubuntu:~$ wget
ubuntu@ubuntu:~$ tar zxvf links-2.1pre20.tar.gz
ubuntu@ubuntu:~/links-2.1pre20$ cd  links-2.1pre20 
2.3.2 configure:
A lot of applications for linux can be compiled and installed with a simple "./configure;make; make install". But this is not allways the case. Save your time, and do read the instructions!
ubuntu@ubuntu:~/links-2.1pre20$ ./configure --help

in most cases running "./configure --host=armv5tel-cacko-linux --build=i686-linux" is enough but here it fails :

configure: error: no acceptable cc found in $PATH

We need to specify the compiler using the CC environement variable, like this:

ubuntu@ubuntu:~/links-2.1pre20$ CC=armv5tel-cacko-linux-gcc ./configure --host=armv5tel-cacko-linux --build=i686-linux --enable-graphics --enable-javascript

I have also added 2 more options for graphics and javascript support

This is enough to configure links2, but it's not allways that easy. Other options and variables that you might need to set:

But even with these, configure might still fail. Cross-compilation is not allways straightforward, you can try to get some help on the forums

2.3.3 compilation

on ubuntu you might need to install the make package:

ubuntu@ubuntu:~$ sudo apt-get install make

We are now ready to launch the compilation:

ubuntu@ubuntu:~/links-2.1pre20$ make

Hopefully after some time the compilation should end succsessfully.

2.3.4 installation:

first we are going to create a directory where the application is to be installed:

ubuntu@ubuntu:~/links-2.1pre20$ mkdir ipkg-temp 
next we specify the destination using the variable DESTDIR:
ubuntu@ubuntu:~/links-2.1pre20$  make DESTDIR=/home/ubuntu/links-2.1pre20/ipkg-temp/ install
Again, not all applications uses the DESTDIR variable, to check this I usually do:
ubuntu@ubuntu:~/links-2.1pre20$ grep DESTDIR Makefile
        $(mkinstalldirs) $(DESTDIR)$(bindir)
            echo "  $(INSTALL_PROGRAM) $$p $(DESTDIR)$(bindir)/`echo $$p|sed 's/
If it returns something, then there is a good chance that DESTDIR is valid.

Now you have an install tree that you can put and try on your Zaurus in ipkg-tmp/

2.3.5 a bit more on installation
You can strip the binary files it will reduce their size, here:
ubuntu@ubuntu:~/links-2.1pre20$ cd ipkg-temp/usr/local/bin/
ubuntu@ubuntu:~/links-2.1pre20/ipkg-temp/usr/local/bin$ ls -l links -rw-------  1 ubuntu ubuntu 4720295 2005-12-28 16:33 links
ubuntu@ubuntu:~/links-2.1pre20/ipkg-temp/usr/local/bin$ armv5tel-cacko-linux-strip links
ubuntu@ubuntu:~/links-2.1pre20/ipkg-temp/usr/local/bin$ ls -l links
-rw-------  1 ubuntu ubuntu 3018352 2005-12-29 03:45 links
Sometimes the Makefile provides an install-strip target, that will strip the binaries for your. here:
ubuntu@ubuntu:~/links-2.1pre20$  make DESTDIR=/home/ubuntu/links-2.1pre20/ipkg-temp/ install-strip
install-strip fails because it tries to use "strip" instead of "armv5tel-cacko-linux-strip". Passing an environment variable STRIP during the configuration might solve this problem.

making an ipk

This will be discussed in an other howto.