@ ptillisch
Back in March 2023, I made a post that the Apple Silicon install of the IDE contains an Intel architecture avg-g++, not an Apple Silicon version. The response was that GitHub Actions did not provide Apple Silicon runners yet, meaning the team could not build a native version of the toolchain.
I just wanted to let the team know that as of the beginning of October, Apple Silicon runners are available in public beta form . Hopefully, this helps the team get closer to having a fully native toolchain.
Thank you!
1 Like
Thanks @ccashman .
There hasn't been any work on the build system for the firmware toolchains, but we did incorporate the Apple Silicon runner into the build system for the Arduino IDE application as soon as it became available:
arduino:main ← arduino:gha-apple-silicon-build
opened 06:55PM - 04 Oct 23 UTC
On every release tag, and [manual trigger](https://docs.github.com/en/actions/us… ing-workflows/events-that-trigger-workflows#workflow_dispatch) when the "**Include builds on non-free runners**" [checkbox](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#providing-inputs) is checked, make the Arduino IDE build for native [Apple Silicon](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#providing-inputs) host in addition to the builds that are always generated by the "Arduino IDE" GitHub Actions workflow.
## Background
Previously, the build workflow only produced a build for x86-64 (AKA "Intel") macOS hosts. Although it is possible to use those builds on Apple Silicon machines via the [Rosetta 2](https://en.wikipedia.org/wiki/Rosetta_(software)#Rosetta_2) translation software, the performance is significantly inferior to a native build so Arduino must also provide Apple Silicon native builds (https://github.com/arduino/arduino-ide/issues/408).
Previously the Apple Silicon builds were produced manually. The reason for using that inefficient and error-prone approach instead of the automated continuous deployment system used for other builds was that GitHub did not provide the necessary Apple Silicon [runner machines](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners) and Arduino was not capable of setting up such a [self-hosted machine](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners) in a manner that would make them feasible for the project maintainers to use.
## Details
[GitHub hosted Apple Silicon runner machines are now available](https://github.blog/2023-10-02-introducing-the-new-apple-silicon-powered-m1-macos-larger-runner-for-github-actions/) so we can add the target to the build workflow.
GitHub gives [unlimited use of the basic runner machines for workflow runs in public repositories](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#about-billing-for-github-actions:~:text=free%20for%20standard%20GitHub%2Dhosted%20runners%20in%20public%20repositories). However, the macOS ARM architecture is only provided in runner machines which are classified as ["larger runner"](https://docs.github.com/en/actions/using-github-hosted-runners/about-larger-runners/about-larger-runners). Use of these runners is [charged on a per-minute basis](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#per-minute-rates), [without any of the free allowances GitHub provides for the normal runners](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions#per-minute-rates:~:text=larger%20runners.%22-,Included%20minutes%20cannot%20be%20used%20for%20larger%20runners.,The%20larger%20runners%20are%20not%20free%20for%20public%20repositories.,-Calculating%20minute%20and). In order to avoid unnecessary expenditures, native Apple Silicon builds must be generated only when there is compelling reason to do so. Such a build is needed for every release, so the workflow is configured to always generate the builds when triggered by a tag. In addition to releases, Apple Silicon tester builds will also be useful for pull requests that might have special implications for this target. For this reason, the [workflow is configured to allow Apple Silicon builds to be triggered manually](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_dispatch) by a repository maintainer:

### Job Matrix Generation
The workflow uses a [job matrix](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategymatrix) to run the build for each target on the appropriate runner machine in parallel, using the universally applicable workflow code for all jobs. It uses another job matrix to generate individual workflow artifacts for the tester builds of each target. Previously it was possible to always use the same matrix configurations for all workflow runs. With the addition of the selectively run macOS ARM job, it is now necessary to generate these matrixes on the fly.
### Merging Channel Files
The [electron-updater package](https://www.electron.build/auto-update.html) used by Arduino IDE's auto-update capability uses a data file (known as the "channel update info file") to check for the availability of updates. A single "channel update info file" is used for the data of the macOS x86 and ARM builds. Since a separate job is used to produce each of those builds, this means the "channel update info file" produced by each of the macOS build jobs must be merged into a single file.
## Notes for Reviewers
The first two commits do some minor refactoring of the workflow in preparation for the work to add the new build target. See the individual commit messages for details.
### Demos
Demonstration release I did in my fork using the updated workflow:
https://github.com/per1234/arduino-ide/releases/tag/0.0.0-rc.26
Demonstration of manually triggered run with the "**Include builds on non-free runners**" option enabled:
https://github.com/arduino/arduino-ide/actions/runs/6409533621
Demonstration of manually triggered run with the "**Include builds on non-free runners**" option disabled:
https://github.com/arduino/arduino-ide/actions/runs/6409535219
### Follow Up
After this is merged, I will submit a PR for the adjustments to https://github.com/arduino/arduino-ide/pull/2129 reflecting the change.
UPDATE: PR submitted https://github.com/arduino/arduino-ide/pull/2248
---
Resolves https://github.com/arduino/arduino-ide/issues/408
It was so nice to finally automate this as the Apple Silicon builds were previously produced manually by the project maintainers, which was the source of a lot of inefficiency in the release workflow. We are now back to being able to make a release build of Arduino IDE by simply pushing a Git tag to the repository.
GitHub does charge for the use of this runner, even in public repositories where the macOS x86 and other runners are free. But the cost is quite reasonable and significantly less than the AWS EC2 instance I had evaluated as a solution before the hosted GitHub Actions runner became available. Despite it still being in "beta" status, there hasn't been any problems at all.
Any idea when the firmware toolchain might be addressed? That is, is it on the schedule for somewhen, or has it not been scheduled yet?
1 Like
I bought a used M1 MacBook for programming my Arduino Nano RP2040 for maximum compatibility as both devices use Arm architecture and I was surprised I still needed to install x86 compatibility layer (Rosetta 2)
I'm happy Arduino Team is working on supporting Rosetta-free Arm toolchain, I love Arduino and Arm so much
1 Like
jatl
February 6, 2024, 2:42am
5
I've gotten c code to compile and run outside of the Arduino IDE on my M2 Mac via homebrew installed packages. I'd love to be able to bring-your-own-compiler or configure the IDE to use the system/homebrew installed compilers/tools (avr-g++, avrdude, avr-objcopy). Maybe this is possible, if so I could not find it. Any other known workarounds out there minus Rosetta?
1 Like
The task of producing builds of the AVR toolchain for Apple Silicon hosts is tracked by the Arduino developers here:
opened 08:17AM - 21 Aug 22 UTC
Hello!
I know we should be able to use the `avr-gcc-7.3.0-atmel3.6.1-arduino7-x… 86_64-apple-darwin14` with Rosetta 2 on Apple silicon Macs for now, but I'm curious if it's considered to provide a native build for Apple silicon Macs for the near or far future.
If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:
2 Likes
system
Closed
August 4, 2024, 7:36am
7
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.