Application Cross Compile

To cross compile debian application, we need debian stretch os and setup multiarch enviroment.
The following wiki will introduce you two ways to do it.

Docker


Docker is a open-source application container engin and we can use it to prepare a application cross compile environment.
To cross compile via docker, please refer to readme in docker-rockchip.

normal:

DEB_BUILD_OPTIONS=nocheck debuild  -i -nc -us -uc -b -d  -aarmhf

libmali:
DEB_HOST_MULTIARCH=armhf debuild  -i -nc -us -uc -b -d  -aarmhf

gstreamer-rockchip first compile:
./autogensh; DEB_BUILD_OPTIONS=nocheck debuild  -i -us -uc -b -d  -aarmhf

Chroot


Build the chroot

sudo debootstrap --arch amd64 stretch ~/work/linaro-alip/cross-env  http://httpredir.debian.org/debian

To enter
sudo chroot ~/work/linaro-alip/cross-env

add the following repository to etc/apt/source.list
deb-src http://httpredir.debian.org/debian stretch main
deb http://emdebian.org/tools/debian/ stretch main

prepare Multiarch
dpkg --add-architecture armhf
apt-get update
apt-get install curl
curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | apt-key add -
apt-get update
apt-get install  crossbuild-essential-armhf

get zlib source
wget http://www.zlib.net/zlib-1.2.8.tar.gz
tar -xvzf zlib-1.2.8.tar.gz
cd zlib-1.2.8

installing zlib's cross-dependencies
apt-get build-dep -a armhf zlib
or
apt-get install xxxx:armhf

configure the zlib library
CC=arm-linux-gnueabihf-gcc ./configure --prefix=/usr/

compile it
make

install it
mkdir out
make install DESTDIR=./out

Documents


https://wiki.debian.org/Multiarch/HOWTO
https://wiki.debian.org/sbuild
https://wiki.ubuntu.com/SimpleSbuild
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/UsingMultiArch
https://wiki.ubuntu.com/CrossBuilding
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/CrossBuilding
https://wiki.linaro.org/Platform/DevPlatform/CrossCompile/CrossbuildingQuickStart
http://comments.gmane.org/gmane.linux.embedded.yocto.general/15379
https://help.launchpad.net/Packaging/PPA
https://www.debian.org/devel/buildd/

'