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

jaufranc@CNX-TOWER:~$ 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

Share this:
FacebookTwitterHacker NewsSlashdotRedditLinkedInPinterestFlipboardMeWeLineEmailShare

Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress

ROCK Pi 4C Plus

19 Replies to “Installing Linaro ARM Cross Toolchain on Ubuntu”

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

  2. 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

  3. 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

  4. 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

  5. 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

  6. 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

  7. @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.

  8. 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

  9. 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

  10. 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).

  11. 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

  12. 1.i need the steps to download and install gcc-arm-none-eabi-5-4-2016q3.tar.bz2 toolchain on ubuntu
    2.how to build and compile a c program on the above gcc toolchain
    3.how to execute the program in the toolchain on ubuntu

Leave a Reply

Your email address will not be published. Required fields are marked *

Khadas VIM4 SBC
Khadas VIM4 SBC