1

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

1
  • 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, 2021 at 21:08

2 Answers 2

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/

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.