Fri Jul 10 11:01:26 CEST 2009

bootstrapping and cross-compiling with qemu

Trying to cross-compile scsh for mipsel.  The problem is that the
build process executes compiled code.  It's perfectly possible to use
qemu to run that code, but convincing autotools it can do so is not so
simple apparently..

I.e. for the openwrt build I use:

qemu-mipsel -L /opt/xsrc/openwrt/8.09/build_dir/mipsel/root-brcm-2.4/ <program>

The -L parameter is necessary for shared libraries.  Static programs
don't need it.

Now this seems to be automated with scratchbox[1][2]

apt-get install scratchbox2

$ cd /opt/xc/openwrt/8.09/build_dir/mipsel/root-brcm-2.4
$ sb2-init -c qemu-mipsel openwrt mipsel-linux-gcc

hmm... errors.. it doesn't work on amd64 (the tools are built on a
32bit machine) and when running in a 32bit schroot i get:

2009-07-11 15:59:11.766 (ERROR)	sh[31476]	Unidentified executable detected (/opt/xc/openwrt/8.09//staging_dir/toolchain-mipsel_gcc3.4.6/bin/mipsel-linux-gcc)

Like this[4].

Maybe I'm misunderstanding.  Does it use cross tools or not?
I.e. does gcc itself run in the simulator, or on the host[3]?  No it
does use cross tools...  Hmm, I don't get it..

Let's leave this for another time when I find more docs..  It does
look like an interesting project though.

[1] http://felipec.wordpress.com/2009/06/07/installing-scratchbox-1-and-2-for-arm-cross-compilation/
[2] http://www.freedesktop.org/wiki/Software/sbox2
[3] http://scratchbox.org/wiki/ForeignToolchains
[4] http://lists.openmoko.org/nabble.html#nabble-td2457004