[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cross-compiling Debian packages

Eric Cooper wrote:

Also, would you welcome patches that add the ability to handle
packages built with alternative libc implementations, namely uClibc,
Dietlibc and Newlib? Shall I file a "bug" report?

In the meantime, can you make these available somewhere? (I'm
interested in using dpkg-cross for a cross-gcc + uclibc toolchain.)

OK. Here is the stuff I've been playing with.

A. For starters, you need to setup Debian-based GNU Libc based cross-toolchain for your
architecture(s).  This includes, in this order:
1. binutils
2. db1-compat
3. linux-kernel-headers
4. glibc
5. gcc

I found this step to be the easiest. If you need more info, ask Nikita Youschenko.
He has some pre-compiled binaries of those packages somewhere.

Note the linux-kernel-headers, binutils and gcc are required to be installed for
building the uClibc package.

B. Update your dpkg. This patch
is needed to teach dpkg-architecture to allow for Debian architectures named
X-Y. I used i386-uclibc, arm-uclibc and mipsel-uclibc. Feel free to add
additional ones to debian/archtable and ostable.

C. Update your dpkg-cross. This patch
is needed to teach dpkg-cross about existence of lib/debug, lib/diet/lib and
lib/newlib and Debian architecures named X-Y (needed for uClibc). Feel free
to add more to the lists in dpkg-cross.pl.

D. Compile uClibc. Unfortunately, uClibc package is not designed for cross-supporting a a complete Debian distribution, so I had to modify it extensively with this patch.
Compiling this package with just a 'dpkg-buildpackage -ai386-uclibc' should give you a workable set of .debs that you can 'dpkg-cross -ai386-uclibc' after which you get a /usr/i486-linux-uclibc, just as you get /usr/i486-linux-gnu with glibc. You also get
uclibc-toolchain package with gcc wrappers.

Note: during compilation you will get errors that i486-linux-uclibc-gcc can not be found.

You can just do this somewhere in the $PATH:

$ for x in ar as cpp g++ gcc ld nm ranlib readelf size strings strip; do\
    ln -s /usr/bin/i486-linux-gnu-$x i486-linux-uclibc-$x\

E. Voila! If you want to just try how it all works, point your apt at
http://www.xs4all.nl/~kurzanov/debian/ and install the versions of
dpkg, dpkg-cross, libuclibc0, libuclibc-dev, uclibc-toolchain-i386-linux-uclibc that
can be found there.

Good luck!

Pjotr Kourzanov

Reply to: