Home > Linux, Linux 2.6, Programming > Installing Linaro ARM Cross Toolchain on Ubuntu

Installing Linaro ARM Cross Toolchain on Ubuntu

You can easily install Linaro arm cross-compiler on Ubuntu 10.04 (Lucid), 10.10 (Maverick) and 11.04 (Natty) as follows:

sudo apt-get install gcc-arm-linux-gnueabi

This will install Linaro cross-toolchain version 4.4 on Ubuntu 10.04 and 10.10, and version 4.5 on Ubuntu 11.04.

You can check the installation worked by checking the cross-compiler version

[email protected]:~$ arm-linux-gnueabi-gcc -v
Using built-in specs.
Target: arm-linux-gnueabi
Configured with: ../src/configure -v –with-pkgversion=’Ubuntu/Linaro 4.4.4-14ubuntu4′ –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 –with-arch=armv7-a –with-float=softfp –with-fpu=vfpv3-d16 –with-mode=thumb –disable-werror –enable-checking=release –program-prefix=arm-linux-gnueabi- –includedir=/usr/arm-linux-gnueabi/include –build=i686-linux-gnu –host=i686-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 (Ubuntu/Linaro 4.4.4-14ubuntu4)

You can also install the latest version 4.5 (recommended) on Lucid and Maverick:

sudo add-apt-repository ppa:linaro-maintainers/toolchain
sudo apt-get update
sudo apt-get install gcc-4.5-arm-linux-gnueabi

If you are using an ARM platform running Ubuntu 10.10 or higher, you could also use the native GCC compiler.

sudo apt-get install gcc-4.5

Source: https://wiki.linaro.org/Resources/ToolchainInstall

  1. March 29th, 2011 at 17:55 | #1

    thank you for sharing it i was unable to do it from this now i can install linaro arm cross tool chain on ubuntu

  2. vivek yarra
    July 16th, 2011 at 17:33 | #2

    This is awesome

  3. ITH
    August 27th, 2011 at 20:35 | #3

    Thank you very much for your post. I’ve been looking around for this for a very long time. This is really awesome!

  4. September 28th, 2011 at 11:03 | #4

    The method above will not install g++ to build library or program using C++. To install the c++ cross-compiler on Ubuntu:

    sudo apt-get install g++-arm-linux-gnueabi

  5. kalpesh
    December 14th, 2011 at 21:31 | #5

    I am trying to build my u-boot like source code with the above toolchain i.e. “sudo apt-get install gcc-arm-linux-gnueabi” but it is giving me below error, can anybody please help

    arm-linux-gnueabi-gcc -Wa,-gstabs -D__ASSEMBLY__ -g -Os -fno-strict-aliasing -fno-common -ffixed-r8 -msoft-float -D__KERNEL__ -DTEXT_BASE=0x40304350 -I/home/kalpesh/Projects/Hitachi/panda_sdk/x-loader-omap4-L24.9git20100901/include -fno-builtin -ffreestanding -nostdinc -isystem /home/kalpesh/Projects/Hitachi/toolchain/arm_toolchain_linaro/bin/../lib/gcc/arm-linux-gnueabi/4.6.1/include -pipe -DCONFIG_ARM -D__ARM__ -march=armv7-a -mabi=apcs-gnu -c -o cpu/omap4/start.o /home/kalpesh/Projects/Hitachi/panda_sdk/x-loader-omap4-L24.9git20100901/cpu/omap4/start.S
    /home/kalpesh/Projects/Hitachi/toolchain/arm_toolchain_linaro/bin/../lib/gcc/arm-linux-gnueabi/4.6.1/cc1: error while loading shared libraries: libmpc.so.2: cannot open shared object file: No such file or directory
    /home/kalpesh/Projects/Hitachi/toolchain/arm_toolchain_linaro/bin/../lib/gcc/arm-linux-gnueabi/4.6.1/../../../../arm-linux-gnueabi/bin/as: /lib/libz.so.1: no version information available (required by /home/kalpesh/Projects/Hitachi/toolchain/arm_toolchain_linaro/i686-linux-gnu/arm-linux-gnueabi/lib/libbfd-2.21.53.20110810.so)
    make: *** [cpu/omap4/start.o] Error 1

  6. December 14th, 2011 at 21:51 | #6

    Looks like some libraries are missing.
    Are you using the instructions provided at http://omappedia.org/wiki/Get_started_with_ubuntu_on_omap4#Bootloaders ?

    Alternatively, u-boot linaro stable is available at http://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git (HEAD) or http://launchpad.net/u-boot-linaro/11.11/11.11/+download/u-boot-linaro-2011.11.2.tar.gz (11.11 release).

    I haven’t tried it (yet) but it should be like:
    make omap4_panda_config
    make

  7. kalpesh
    December 15th, 2011 at 13:00 | #7

    1. Where can I find the linaro arm toolchain precompiled binaries so that I can use them to compile u-boot, linux, applications etc
    2. I have checked out the linaro website but they have everything in source code format they do not have precompiled arm toolchain
    3. I should be able to download the linaro toolchain in a user specified directory so that I can tar it and freely use on any machine I want eg: I download the linaro toolchain on ubuntu I should be able to tar the toolchain put it on fedora/suse etc and compile my SDK (u-boot, linux, application source code etc) with the linaro arm cross toolchain. Is this possible? If yes how can I do that?

    Thanks
    Kalpesh

  8. kalpesh
    December 15th, 2011 at 17:05 | #9

    Ok, do you mean to say I have to download and install the linaro arm toolchain on every ubuntu machine I use for development, I dont have the flexibility to download it only once and then use the copy of the downloaded toolchain on other ubuntu machine. Is my understanding correct?

    Thanks,
    Kalpesh
    @cnxsoft

  9. December 15th, 2011 at 19:12 | #10

    @kalpesh
    That’s my understanding they don’t have a tar package yet for the toolchain although they are working on it.
    So yes, I suppose you’d have to run “apt-get install gcc-arm-linux-gnueabi” on all Ubuntu development machines.

  10. kalpesh
    December 26th, 2011 at 20:07 | #11

    Thank you very much for the update. Let me know if you have any idea of when will they release the tar package. Also do you have any guide/doc of building/cross-compiling the linaro toolchain

  11. December 27th, 2011 at 09:34 | #12

    @kalpesh
    I don’t know the ETA for the linaro tarball cross compiler. I’ve just found they are working on it at http://fossplanet.com/f13/%5Bfedora-arm%5D-linaro-toolchains-fedora-207013/#post631817.

    I don’t have docs to build the linaro toolchain. But somebody did it on Debian: http://blogs.igalia.com/vjaquez/2011/08/03/how-i-installed-the-linaros-toolchain/

  12. Nishanth
    February 3rd, 2012 at 22:33 | #14

    Hi,

    I have downloaded linaro tool chain by
    $ sudo apt-get install gcc-arm-linux-gnueabi

    I wanted to have Eglibc and uClibc for ARM, so that I can compile my application and link against them.

    So i followed the below steps:
    Eglibc:

    i)Downloaded Eglibc 2.15.90.
    ii)Cross compiled for ARM using the below commands:

    $ BUILD_CC=gcc CC=arm-linux-gnueabi-gcc CXX=arm-linux-gnueabi-cpp AR=arm-linux-gnueabi-ar RANLIB=arm-linux-gnueabi-ranlib /home/user/EGLIBC/eglibc/libc/configure –prefix=/home/user/EGLIBC/eglibc/INSTALL –with-headers=/usr/arm-linux-gnueabi/include –build=i686-linux-gnu –host=arm-linux-gnueabi –enable-kernel=2.6.15–enable-add-ons=libidn,ports,nptl –with-tls –with-__thread

    $ make
    $ sudo make install

    By the above steps got libc.so.6 in the prefix directory.

    iii)I checked the library by linking against an example application both statically and dynamically.Below is the steps i followed.

    DYNAMIC LINKING:
    $ arm-linux-gnueabi-gcc -L/home/user/EGLIBC/eglibc/INSTALL/lib test.c -lc -o dynamic_test

    Into the pandaboard i copied the neccessary libraries and app binary.

    $ ./dynamic_test
    Hello world!!! //It works

    STATIC LINKING:
    $ arm-linux-gnueabi-gcc -static -L/home/user/EGLIBC/eglibc/INSTALL/lib test.c -lc -o static_test

    Into the pandaboard i copied the static app binary.

    $ ./static_test
    Illegal instruction //It doesn’t work

    The size of the static application binary is only 2.7Mb and the size of the Eglibc static library libc.a is 15.2Mb.

    Even i tried the static compilation of application using the default libc.so.6 present in the Linaro tool chain.
    That also gave the same illegal instruction.

    uClibc:

    i)Downloaded uClibc 0.9.32.1
    ii)In the menuconfig,chose some basic options
    iii)make CROSS=arm-linux-gnueabi-
    iv)make PREFIX=/home/user/uClibc-0.9.32.1/install_dir

    libc.so.0 is the library produced.

    v)I checked the library by linking against an example application both statically and dynamically.Below is the steps i followed

    DYNAMIC LINKING:
    $ export LD_LIBRARY_PATH=/home/nishanthv/uClibc-0.9.32.1/install_dir/usr/arm-linux-uclibc/lib:/home/nishanthv/uClibc-0.9.32.1/install_dir/usr/arm-linux-uclibc/usr/lib

    $ arm-linux-gnueabi-gcc test.c -o dynamic_test
    $ file dynamic_test
    dynamic_test: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.16, not stripped
    $ objdump -x dynamic_test | grep NEEDED
    NEEDED libc.so.6

    It is not taking the libc.so.0 that i am including via LD_LIBRARY_PATH. It is taking libc.so.6 from the default location of the Linaro tool chain.

    STATIC LINKING:
    $ arm-linux-gnueabi-gcc -static test.c -o static_test

    If i run it on pandaboard it shows Illegal Instruction

    The thing is only Eglibc/dynamic pair works in the Eglibc,uClibc Dynamic,static pair.

    Please give me your suggestions on it.

    thanks and regards
    nishanth

  13. February 6th, 2012 at 09:22 | #15

    I don’t know what may cause your problem. It might be a toolchain issue, so It’s quite difficult to debug.

    eglibc library is already used in Linaro Ubuntu LEB, so you don’t really need to compile it: https://launchpad.net/ubuntu-leb/+source/eglibc, so you don’t need to cross-compile it.

    If you still have problems check out: http://www.linuxquestions.org/questions/linux-embedded-78/cross-compiling-eglibc-with-linaro-toolchain-924192/ You may also try to contact Michael Hope, Linaro toolchain group (contact in that thread).

  14. March 27th, 2012 at 22:42 | #16

    In Ubuntu 12.04, the toolchain supports hard-float and can be installed with:
    sudo apt-get install gcc-arm-linux-gnueabihf

  15. Rashi
    May 23rd, 2014 at 15:47 | #17

    Hi
    i am doing apt-get install gcc-arm-linux-gnueabi,
    but it is giving
    Couldn’t find package gcc-arm-linux-gnueabi
    Please tell me the solution for it

  16. May 23rd, 2014 at 16:18 | #18

    @Rashi
    Which OS are you using?

  1. January 17th, 2013 at 02:05 | #1