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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay