user2563050
user2563050

Reputation: 69

How to cross compile debian package for ARM Raspberry Pi

I use arm-bcm2708 toolchain for cross compiler.

Now I want to build debian package.

$ dpkg-buildpackage -rfakeroot -us -uc

I got error

... (ELF format: 'elf32-littlearm'; RPATH: '')
dpkg-shlibdeps: error: cannot continue due to the error above
Note: libraries are not searched in other binary packages that do not have any shlibs or symbols file.
To help dpkg-shlibdeps find private libraries, you might need to set LD_LIBRARY_PATH.

I don't want to build it on the pi. So how to cross-compile a RPi debian package on PC?

Upvotes: 3

Views: 9480

Answers (1)

yegorich
yegorich

Reputation: 4849

The first method were to use the same host Debian distribution as Raspberry Pi Debian. For example 7.0. Add deb http://www.emdebian.org/debian/ unstable main to your /etc/apt/sources.list and install the toolchain:

apt-get update
apt-get install emdebian-archive-keyring
apt-get install gcc-4.7-arm-linux-gnueabihf g++-4.7-arm-linux-gnueabihf
apt-get install build-essential git debootstrap u-boot-tools

Via xapt you can then install cross-compiled dependencies. Perhaps you'll be able to use dpkg-buildpackage then.

Alternative:

You can convert your package to use CMake and use CPack to generate a deb file. This approach will work on other distributions like openSuSe, Fedora too.

Update:

As Emdebian distributions updates have ceased, it is recommended to switch to newer Debian versions and make use of multiarch feature.

Upvotes: 5

Related Questions