Cross compile when using apt-get

2.9k views Asked by At

I am currently using Scratchbox2 for cross compiling. I can do ./configure, make install from my toolchain prompt:

[SB2 mapping-armv7 armv7]

Is there a way to cross compile while using apt-get install?

1

There are 1 answers

0
josch On BEST ANSWER
dpkg-buildpackage -us -uc -aarmel

BUT: Debian is not (yet) fully fit to cross compile every package easily. Packages are created with native compilation in mind. Debian doesnt even contain any crosscompilers. If you want to crosscompile anyways, then the easiest way to do that with Debian is to add the emdebian repository. For example:

apt-get install emdebian-archive-keyring
echo deb http://www.emdebian.org/debian/ squeeze main >> /etc/apt/sources.list
apt-get update
apt-get install gcc-4.4-arm-linux-gnueabi
export ARCH=arm CROSS_COMPILE=arm-linux-gnueabi-

But for most packages you will run into problems that might be hard to fix so I would suggest you either run qemu or build natively on the target platform.

If you want to crosscompile anyways, consider joining #emdebian at irc.debian.org or subscribe to the debian-embedded mailinglist. Those are the guys that are interested in introducing better cross compilation support into Debian.