osx-cross / homebrew-arm

Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors (Cortex-M0/M0+/M3/M4/M7, Cortex-R4/R5/R7).
BSD 2-Clause "Simplified" License
152 stars 21 forks source link

Building from source #29

Open fauxpark opened 2 years ago

fauxpark commented 2 years ago

I've been tinkering with building binutils, newlib and gcc from source, to match homebrew-avr. So far I've got 2/3 going, but before I continue I was wondering if there was any interest in me adding them to the repo. Would be handy for when GHA eventually adds M1 runners.

ladislas commented 2 years ago

Thanks @fauxpark for working on that!

I was trying to do the same, but it seemed way too complicated so I gave up. A few take aways:

With all that, it might not be necessary to invest in building from source. They only reason I wanted to do so in the first place was to be able to have newer GCC versions, but it seems that this is now covered.

I've also been using ARM GCC 10 on an Apple M1 for a few months now, and even if it's using Rosetta 2, it's already way faster than on a high end Intel Macbook Pro 16 machine.

With all that said, if you still wish to proceed, I'll be happy to review and merge. In this case, it would be nice to have both formulae separated: from ARM and build from source.

fauxpark commented 2 years ago

It is a little complex, mainly because there is something of a circular dependency between newlib and GCC, as a result a "minimal" GCC must be built first in order to build newlib, then GCC. This part was not so much of a problem for me as I could draw on the Arch and MSYS2 build scripts. I've already had a little experience fixing up the ARM and AVR toolchains on MSYS2. In fact the hardest part for me was figuring out how to translate some of the bash-isms to Ruby 😄

Personally I think it's worth having formulae that can be built from source, for a few reasons:

ladislas commented 1 year ago

@fauxpark any news on that? :)

fauxpark commented 1 year ago

Sorry, I ran into some issue building GCC 10 and haven't had the time (or, I suspect, the knowledge) to investigate. I can make a draft PR for others to poke at, if you'd like?