1

I'm looking for a pre-packaged arm-linux-gnueabihf-gcc toolchain for OSX. Can someone point me to one?

  • If you couldn't find this on the Internet, and given that most guides you'll find will be Linux-based, I'd highly recommend doing this on Linux. If you're confident using the command line, you can use Docker, otherwise you can spin up a VM or install Linux natively. I'm not saying it can't be done on OSX, but if you're just starting out it's best to follow the existing guides and practices. – tttapa May 25 '21 at 21:08

2 Answers2

2

Check out this guide from Jeff Geerling. He does a lot of work on the Raspberry Pi and has setup kernel cross compiling on his macbook.

https://github.com/geerlingguy/raspberry-pi-pcie-devices/tree/master/extras/cross-compile

https://www.youtube.com/c/JeffGeerling/

Joe Schroedl
  • 191
  • 1
  • 2
1

There is an ARM toolchain for macOS (scroll the page until you see macOS):

Also available as a homebrew formula:

brew install arm-linux-gnueabihf-binutils

Another alternative for building on macOS is Docker with the experimental buildx extension with something similar to:

# create a builder instance
docker buildx create --name my-pi-crosscompiler --platform linux/arm/v7 --bootstrap --use

build from a Dockerfile in the current folder

docker buildx build --platform linux/arm/v7 --progress tty -t picompiler --load .

A minimal Dockerfile:

FROM ubuntu:18.04 AS cross-compiler

RUN apt-get update &&
apt-get -y install --no-install-recommends g++ cmake libconfig++-dev zlib1g &&
rm -rf /var/lib/apt/lists/*

WORKDIR /root

CMD ["/bin/bash"]

❗️ Warning: compilation will be (significantly) slower than on bare metal because of the emulation layer.

Another example on using docker buildx here.

ccpizza
  • 431
  • 3
  • 8