DEV Community

Kai Sasaki
Kai Sasaki

Posted on

3

How to achieve ARM cross-compilation on macOS

This article originally comes from lewuathe.com. Please visit there too if you find this interesting.

Cross-compilation is occasionally troublesome. It often requires us to install additional toolchain to get it done.

Now, I found I needed to compile my source code for the Arm architecture machine for Mbed application. I do not have any idea how to install the toolchain for Arm compilation. Thus this is the post to describe the fastest way to prepare the toolchain for the cross-compilation for Arm.

Xcode Compiler

Please ensure to install Xcode first. Xcode contains the first compiler sets, such as clang.

$ xcode-select --install

Arm Toolchains from Homebrew

You can install Arm GCC toolchains by using Homebrew. There are two options.

There is no difference between these two distributions. They use precisely the same package internally. You can use whichever you want.
For my Mbed application, I choose the second one.

$ brew tap ArmMbed/homebrew-formulae
$ brew install arm-none-eabi-gcc

You should be able to find the compiler eventually. The following tools are installed in the local machine.

$ arm-none-eabi-gcc
$ arm-none-eabi-g++
...

It looks like they are GCC for Arm architecture. I believe it is the easiest way to prepare the Arm build toolchains in macOS platform.

Thanks

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more