arielmalka
Posts: 43
Joined: Sun Aug 16, 2020 1:10 pm
Location: Tel-Aviv
Contact: Website Twitter

Help required for cross-compiling C/C++ to rpi from a mac

Thu Apr 29, 2021 12:37 pm

Hi, my goal is to cross-compile from a mac (intel), ideally targeting arm64 bit architecture.

I found a tutorial, which explains how to do it (targeting arm32 bit architecture, good enough for now):
https://www.jianshu.com/p/534bee6becee

The problem is that it refers to the linaro g++ compiler, which I can't find.
When going to https://www.linaro.org/downloads, it's not clear where to download and install the actual linaro toolchain for mac.

Any help would be greatly appreciated, thanks!

swampdog
Posts: 692
Joined: Fri Dec 04, 2015 11:22 am

Re: Help required for cross-compiling C/C++ to rpi from a mac

Sun May 09, 2021 3:01 pm

I haven't done this in a very long time but when I did I used ct-ng..
https://crosstool-ng.github.io/
..which appears to have grabbed a linaro-gcc as part of its build.

I can't help further. :-|

arielmalka
Posts: 43
Joined: Sun Aug 16, 2020 1:10 pm
Location: Tel-Aviv
Contact: Website Twitter

Re: Help required for cross-compiling C/C++ to rpi from a mac

Sun May 09, 2021 4:13 pm

Thanks.

But according to their docs: "macOS is no longer officially supported by crosstool-NG. If the instructions below work for you, congratulations. If they kill your cat, ye be warned."

So I ended-up using Docker and some ubuntu image, with this solution....

mattlewis
Posts: 134
Joined: Sat Jan 12, 2013 3:05 pm
Location: UK
Contact: Website

Re: Help required for cross-compiling C/C++ to rpi from a mac

Sun May 09, 2021 8:24 pm

FYI, I use Docker to cross compile on my Mac: https://hub.docker.com/r/diozero/diozero-cc
A bit new to me but working well so far, extremely convenient and fast. Just reading other comments regarding cross compilation and can see that it is a huge topic! Fortunately my use cases only require very basic features.
http://www.diozero.com/

Return to “C/C++”