I already asked this question on Stack Overflow, but I would like to know if anyone managed to build a GCC 4.7 toolchain for ARM cross-compilation (for a x86/x86-64 Linux host). There are many instructions for building GCC from source and many available cross-compilers for pre-4.7 GCC versions, just not the latest one.

Compiling on Rasp Pi itself works fine, but it's just a bit too slow for practical purposes.

I am eager to get compiling and I would like to use the latest and the best tools.

  • This seems along the lines what I need to do as well. We are developing for an ARM5 running Arch Linux. Development is on Ubuntu Linux 10.04 LTS (today, maybe we upgrade that tomorrow, I don't know yet). Currently we are running GCC 4.4, but the things I need to do will be helpful if not require GCC 4.7 (minimum) if not GCC 4.8 (if we can manage it), for C++11 language features. It seems like all the tool chains available for ARM (5 or anything else) are helplessly out-dated. Is it possible to build a cross compiler tool chain from source and support the GCC we want? Commented Mar 1, 2013 at 22:38
  • I have a little problem in the second step. in fact, I've done the ./configure and make commands. Everything works fine. but when i've tiped "install", i got an error message saying: install: missing file operand
    – user8773
    Commented Jul 31, 2013 at 7:57
  • See also: raspberrypi.stackexchange.com/q/14587/5538 I closed that as a dupe, but I thought it worth linking here because the accepted answer there goes into considerable detail not included here.
    – goldilocks
    Commented Jul 26, 2015 at 14:28

8 Answers 8


I found these instructions How to build a cross compiler for your Raspberry Pi. It is a great walk through using a crosstool-ng tool which simplifies configuring a cross-compiler build A LOT (it has a nice curses-based interface) and it supports GCC 4.7.

I've followed these steps and ended up with a successful build of a 4.7 cross-compiler.

Prerequisites: The following packages are required:bison, flex, gperf, gawk, libtool, automake, g++, ensure these are installed before proceeding.

  1. First download crosstool-ng from here (I used version 1.15.2).
  2. Unpack the distribution and do a ./configure / make / install
  3. Create a fresh directory somewhere in the file-system to build in and cd into it.
  4. Run ct-ng menuconfig. You will be presented with a nice set of menus to configure your build.
  5. Go into Paths and misc options. Enable Try features marked as EXPERIMENTAL.
  6. Choose a suitable Prefix directory. This is the directory that your compiler and libraries will get installed in (anything is fine basicallly, just make sure that the directory is empty).

    • NOTE: It is also important that you have write access to the chosen folder
  7. Go to the Target options menu.

    • Target architecture: arm
    • Endianness: little endian
    • Bitness: 32-bit
  8. You may also want to set floating point parameter to softfp (see this for more info), but hardfp is more appropriate for Raspbian.

  9. Go to Operating system menu and change Target OS to linux.
  10. Go to C compiler menu and choose gcc version 4.7.0 (the article recommends Linaro, but I managed to get it working with vanilla gcc). Also chose additional languages you want to be able to compile (C++, Fortran, ...)
  11. Go to C-library menu and chose one. The default is eglibc but that one didn't build fine for me, so I used glibc (the newest version).

    • NOTE: during the build step 13. eglibc can fail to build if subversion is not installed, as the source can't be retrieved from the repository
    • NOTE: eglibc is no longer a part of crosstool-ng as of version 1.21.0 due to its lack of development. See So long to eglibc. Use glibc as default.
  12. Exit the configuration tool while saving your changes.
  13. Run ct-ng build in the same directory. Wait a while (about 45 minutes in my case) and your cross compiler should be ready.

Seems to work great!

  • Wow, 45 minutes is a long time. How quick is your system? I'm waiting now.
    – Jivings
    Commented Jun 14, 2012 at 15:46
  • Well, maybe it was a bit less, but it has to compile all the prerequisites first and after bintools and gcc also libc and libstdc++, so 45 min sounds reasonable to me.
    – user13
    Commented Jun 14, 2012 at 15:55
  • Could we add details on how to install these properly and update the path, once tested of course? Commented Jun 27, 2012 at 16:38
  • 2
    Also, I think we should be using hardfp, as the RPi supports it. Commented Jun 27, 2012 at 16:39
  • May be, but IIRC, the Arch's GCC is configured with softfp. I don't have time to test this now, but I've made the answer community wiki, so feel free to improve it.
    – user13
    Commented Jun 28, 2012 at 11:10

I am eager to get compiling and I would like to use the latest and the best tools.

In fact, the latest and best tools do not need to be built by yourself. On the Raspberry Pi Tool GitHub Repository you will find the X86_64 and x686 toolchains for cross-compiling software.

I recommend using the x86-linux64-cross-arm-linux-hardfp toolchain, as that will compile for Hard Floating Point, which will result in a much faster system.

$ arm-bcm2708hardfp-linux-gnueabi-gcc --version

arm-bcm2708-linux-gnueabi-gcc-4.5.1 (Broadcom-2708) 4.5.1
Copyright (C) 2010 Free Software Foundation, Inc.

Note: If you are using an existing kernel then you will have to use the toolchain that matches the kernel. HardFP applications will not work on a SoftFP kernel.

To use the toolchain simply check out the repository:

git clone https://github.com/raspberrypi/tools.git --depth 1

The --depth parameter will mean that you don't have to wait for the repository history to be downloaded as well (since we wont be using it).

Then add the binaries to your PATH variable:

export PATH=~/tools/arm-bcm2708/x86-linux64-cross-arm-linux-hardfp/bin:$PATH

Or to persist the PATH:

echo "export PATH=~/tools/arm-bcm2708/x86-linux64-cross-arm-linux-hardfp/bin:$PATH" >> ~/.bashrc
source ~/.bashrc

To compile with the tool chain you can now add the CROSS_COMPILE parameter. For example, when running make:

make CROSS_COMPILE=arm-bcm2708hardfp-linux-gnueabi- 

Or to make this easier, you can save the variable to bashrc again:

echo "export TARGET=arm-bcm2708hardfp-linux-gnueabi" >> ~/.bashrc
source ~/.bashrc

and now use the variable when compiling:

  • 1
    This seems to be gcc-4.5.1.
    – user13
    Commented Jul 18, 2012 at 10:57
  • @Tibor Is that bad?
    – Jivings
    Commented Jul 18, 2012 at 11:04
  • @Jivings It totally does not answer the question! Commented Jul 18, 2012 at 11:26
  • 2
    I disapprove of the downvotes. @AlexChamberlain It suggests a valuable alternate method to the time consuming act of building your own toolchain.
    – Jivings
    Commented Jul 18, 2012 at 15:11
  • 2
    @Jivings: This is very helpful. Meanwhile it is gcc4.7.1 (the best I ever had) and floating point works right away. I couldn't make floating point work using Chris' original description that Tibor posted. Thanx a lot.
    – user3802
    Commented Dec 15, 2012 at 9:05

Note that when building the toolchain using ct-ng on centos 6.3 on a 64 bit system I was forced to deselect the option to statically link libstdc++ because static linking was not supported on the platform (apparently).

Also, while it would be great to use the prebuilt toolchain from the git repository, that chain does not seem to work on Centos 6.3 - probably because it is built for a more modern system or something. I did not really try to run this down.


This guide may be helpful.

It helped me get mine going. I added some comments about tuning as well.


If you want to benefit from a fast host for compiling things for your RPI I suggest to work in cross environment via chroot and QEMU. This by the way supersedes a cross compiler with no hassle.

Simply setup a Debian cross-environment using deboostrap/multistrap

(see chapter QEMU/debootstrap approach) and you are done.


In case you are going to cross-compile from the OS X : here is the great article (and the only one working on the web I found).

The greatest thing is author provides a complete precompiled toolchain, so you only need to download, unzip and mount dmg image. And thats it, you are ready to cross-compile.


If you installed Ubuntu 64 bits edition and the tools from Raspberry Pi SVN and you are getting the error:

-bash: /home/I/toolchain/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin/arm-linux-gnueabihf-c++: 
No such file or directory

just run:

sudo apt-get install ia32-libs

The Carlson-Minot Inc. provides a prebuilt toolchain for both bare-metal and GNU/Linux ARM targets. This toolchain is based on the Mentor Graphics Sourcery Lite toolchain with fixes and adoptions for build on the OS X. See

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.