Building An ARM Cross Compiler On OSX

arm-cross-compiler-for-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.

11 thoughts on “Building An ARM Cross Compiler On OSX

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

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

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

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.