Home > Linux, Linux 2.6 > Installing Emdebian ARM Cross Toolchain in Debian

Installing Emdebian ARM Cross Toolchain in Debian

Orange Pi Development Boards

I had previously installed Sourcery G++ ARM Linux toolchain in Ubuntu to build some software running in Debian, but I encountered some issues with some libraries (libavg) that use gethostbyname in static libraries without any easy way to make it dynamic. In that case, the library in the rootfs and cross-compiler must match.  So I decided to install Debian Squeeze (6.0.3) and the corresponding cross-toolchain by Emdebian (short for Embedded Debian).

First to use this toolchain, add the URL to get Emdebian packages to /etc/apt/sources.list:

#
# — Emdebian cross toolchains
#
deb http://www.emdebian.org/debian/ squeeze main

Then install Emdebian public key:

apt-get install emdebian-archive-keyring
apt-get update

If you don’t install the key, you’ll get the following error:

W: GPG error: http://www.emdebian.org squeeze Release: The following signatures couldn’t be verified because the public key is not available: NO_PUBKEY B5B7720097BB3B58

Search and install packages for the architecture that you need, in this case ‘armel’:

apt-cache search armel

This command will return a long list of armel packages.
Install the relevant package (you can check the version you want in the list returned above):

apt-get install linux-libc-dev-armel-cross
apt-get install libc6-armel-cross libc6-dev-armel-cross
apt-get install binutils-arm-linux-gnueabi
apt-get install gcc-4.4-arm-linux-gnueabi
apt-get install g++-4.4-arm-linux-gnueabi

The ARM toolchain is now installed:

 # arm-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v –with-pkgversion=’Debian 4.4.5-8′ –with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs –enable-languages=c,c++,fortran,objc,obj-c++ –prefix=/usr –program-suffix=-4.4 –enable-shared –enable-multiarch –enable-linker-build-id –with-system-zlib –libexecdir=/usr/lib –without-included-gettext –enable-threads=posix –with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.4.5 –libdir=/usr/lib –enable-nls –enable-clocale=gnu –enable-libstdcxx-debug –enable-objc-gc –disable-sjlj-exceptions –enable-checking=release –program-prefix=arm-linux-gnueabi- –includedir=/usr/arm-linux-gnueabi/include –build=i486-linux-gnu –host=i486-linux-gnu –target=arm-linux-gnueabi –with-headers=/usr/arm-linux-gnueabi/include –with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.4.5 (Debian 4.4.5-8)

If you need to install more pre-built ARMEL libraries, you’ll need to install xapt and dpkg-cross:

apt-get install pdebuild-cross dpkg-cross

Finally, to install an ARMEL library (e.g. libpng12-0), run xapt as follows:


Most of the instructions come from http://wiki.debian.org/EmdebianToolchain#Get_the_binaries for Debian Lenny.

  1. kurky18
    February 2nd, 2012 at 21:35 | #1

    Thank you for this tutorial.

    It helped me a lot.
    But I have troubles retrieving libcv2.1 for arm.
    I need to compile a program for ARM and using opencv for arm.
    When I do : xapt -a armel libcv2.1 it says some package are not installed (ex libcv2.1:i386).
    I’ve got Linux Mint 12 Lisa 64 bit.

    Any tips or hints? Thanks!

    • February 2nd, 2012 at 21:55 | #2

      I’m running Debian right now, and “aptitude search opencv” only returns:

      p opencv-doc – OpenCV documentation and examples
      p python-opencv – Python bindings for the computer vision li
      v python2.6-opencv –

      So opencv may not be available in the binary repositories.

      So you’d probably have to cross-compile OpenCV by yourself, following instructions such as http://processors.wiki.ti.com/index.php/Building_OpenCV_for_ARM_Cortex-A8.

      Edit: Sorry I should have looked for libcv, not opencv.
      Running “sudo /usr/share/pdebuild-cross/xapt -a armel libcv2.1 –force-yes” works for me in Debian Squeeze. I’m no sure what’s the problem on your side. It does not seem right that xapt is looking for libcv2.1:i386 for armel..

  2. kurky18
    February 3rd, 2012 at 21:16 | #3

    @cnxsoft
    Thank you for the reply.
    Are you running on Debian 64bits?
    I’m on Linux Mint 12 64bits.
    Here it’s what i got :
    libcv2.1:i386 : Depends: libc6:i386 (>= 2.4) but it is not going to be installed
    Depends: libgcc1:i386 (>= 1:4.1.1) but it is not going to be installed
    Depends: liblapack3gf:i386 but it is not going to be installed
    Depends: libstdc++6:i386 (>= 4.1.1) but it is not going to be installed
    Depends: zlib1g:i386 (>= 1:1.1.4) but it is not going to be installed

    I ‘ve got pdebuild (2.2.18) and xapt (2.2.18).
    Also, I can’t use “sudo /usr/share/pdebuild-cross/xapt -a armel libcv2.1 –force-yes”, there isn’t xapt in this folder…

  3. February 3rd, 2012 at 22:29 | #4

    @kurky18
    I’m using Debian 32 bits.

    Have you been able to install other armel libs with xapt?

    The images are for Debian, so I’m not sure if it would work on Mint. You might want to try something like:
    xapt -a armel -M http://ftp.uk.debian.org/debian -S squeeze libcv2.1 –force-yes

  4. kurky18
    February 6th, 2012 at 16:01 | #5

    @ cnxsoft
    Yeah! It’s seems to be working
    Thank you for the help 🙂

  5. quintusfelix
    May 11th, 2012 at 01:59 | #6

    Hi!

    I tried to install apt-get install gcc-4.4-arm-linux-gnueabi and apt-get install g++-4.4-arm-linux-gnueabi, but i got an error.
    gcc-4.4-arm-linux-gnueabi depends on cpp-4.4-arm-linux-gnueabi (= 4.4.5-8) but shouldn’t be installed.
    If i try to install cpp-4.4-arm-linux-gnueabi directly, it says “depends on libgmp3c2 but it is not installable.
    Same with g++-4.4-arm-linux-gnueabi.

    Any tips? Thanks!

  6. May 11th, 2012 at 09:09 | #7

    @ quintusfelix
    When I run into this kind of issues, I usually run “sudo apt-get install -f” and everything is miraculously fixed (most of the time).

  7. September 18th, 2012 at 23:21 | #8

    @quintusfelix You need to add a squeeze repository to your sources list

  8. October 29th, 2012 at 16:02 | #9

    FYI. I tried to install it on Debian Wheezy, and I had the same problem as @quintusfelix . The solution provided by @rmunoz worked fine for me. Thanks.

  9. Albert
    March 24th, 2013 at 22:40 | #10

    when i try to install gcc-4.4-arm-linux-gnueabi with the command sudo apt-get install -f gcc-4.4-arm-linux-gnueabi and use ubuntu 10.04
    i get this error :
    Lecture des listes de paquets… Fait
    Construction de l’arbre des dépendances
    Lecture des informations d’état… Fait
    Certains paquets ne peuvent être installés. Ceci peut signifier
    que vous avez demandé l’impossible, ou bien, si vous utilisez
    la distribution unstable, que certains paquets n’ont pas encore
    été créés ou ne sont pas sortis d’Incoming.
    L’information suivante devrait vous aider à résoudre la situation :

    Les paquets suivants contiennent des dépendances non satisfaites :
    gcc-4.4-arm-linux-gnueabi: Dépend: cpp-4.4-arm-linux-gnueabi (= 4.4.5-8) mais ne sera pas installé
    E: Paquets défectueux

  10. March 25th, 2013 at 16:54 | #11

    error: libicu is required, but not found?always this error?what can i do

  11. August 4th, 2013 at 23:06 | #12

    this worked for me on Debian 7.1 (wheezy):

    create a file /etc/apt/sources.list.d/emdebian.list, containing:

    deb http://www.emdebian.org/debian squeeze main
    deb http://ftp.us.debian.org/debian squeeze main contrib non-free

    then apt-get update and try again.

  12. Frank
    October 29th, 2013 at 03:28 | #13

    @John Comeau

    Thank you. This one works nice for me now. Did have some trouble finding a solution. (Debian 7.2)

  13. Jessie
    December 9th, 2014 at 01:36 | #14

    Is there anyone that possibly help walk me through this a little more detailed. I am a major linux noob. Also when I searched cache for armel, what i recieved as options were not the same as shown above. I’m guessing this has to do with updates made over the years. Or if anyone can point me in the right direction towards more up to date procedures, that would be GREAT.

  14. December 9th, 2014 at 09:19 | #15

    @Jessie
    Yes, the versions changed a bit, install gcc-4.7, or 4.8. Also check the comments above.

  1. March 12th, 2012 at 16:31 | #1
  2. June 13th, 2012 at 16:22 | #2
  3. July 16th, 2012 at 20:28 | #3
  4. March 20th, 2013 at 15:42 | #4