Building an ARM cross compiler on OSX


We’ve tried building our own ARM cross compiler on a Linux box and it’s no picnic. Luckily there is a free cross compiling toolchain available through Mentor Graphics (formerly called Code Sourcery G++). But those looking to develop on a Mac aren’t so lucky. There is help via a script, and [Michael] wrote a guide detailing¬†how to use crosstool-ng to build an ARM toolchain on Mountain Lion.

Crosstool-ng is a script which automates much of what is needed when compiling all the different components. But there is a some groundwork that needs to be in place before you can run it. For instance, some of the tools that ship with OSX aren’t entirely compatible with the GNU tools the script is looking for. One example is ‘grep’. Mountain Lion has the BSD version of grep but it is missing a few of the GNU version’s commands used by crosstool-ng. [Michael] will guide you through this and a handful of other issues until you have a functioning toolchain up and running.


  1. Okachobi says:

    MacPorts to the rescue… pick your poison…
    $ sudo port install arm-elf-gcc
    $ sudo port install arm-aout-gcc
    $ sudo port install arm-elf-gcc3
    $ sudo port install arm-none-eabi-gcc
    $ sudo port install arm-none-linux-gnueabi-gcc
    $ sudo port install arm-rtems-gcc

    • Amos Sam says:

      well, I tried arm-none-eabi-gcc 4.6.2 from ports for launchpad, and it has a bug (or something) with floating point math… I ended with building arm-eabi-toolchain toolchain from jsnyder from source…

      so, sometimes, easiest way is not the correct way… but that’s maybe only me… :-D

      • asdf says:

        That script pulls the sources from Mentor/CodeSourcery, so there may be changes from vanilla FSF tools. Just something to be aware of.

        The script also installs/builds GCC’s dependent libraries separately, while instead you should run the script $(gcc-sources)/contrib/download_prerequisites to download the appropriate sources into the GCC source tree where they will be built as part of GCC’s normal build process.

        It’s worth figuring out how to build the toolchain from scratch, by hand, so you’re not dependent on whatever scripts or pre-built versions you can find.

  2. jc says:

    This just looks so sad :)

  3. Kenn Sebesta says:

    I just run this script. It’s very easy, the hardest part is that it’s not well explained which precise archive you want, but that’s very quickly solved with a bit of poking around (hint, it’s gcc-arm-none-eabi-4_6-2012q4-20121016-src.tar.bz2).

  4. Stepan says:

    These guys seems to release a build for OSX based on the Code Sorcery one. I haven’t tested it much though.

  5. Toolchain built using crosstool-ng with raspberry pi preset:

  6. ben says:

    been here, just a pain… easier to go buy a used thinkpad and stick ubuntu on it.. then at least you don’t blow up your mac if you make a mistake with wires on your dev board !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

Join 96,388 other followers