emacs-builds icon indicating copy to clipboard operation
emacs-builds copied to clipboard

Apple Silicon Native Builds

Open jimeh opened this issue 3 years ago • 17 comments

Update (2023-11-23): Native Apple Silicon builds are now available. However, due to the high cost of M1-based GitHub-hosted Actions Runners at the moment, they are limited to stable releases, one nightly build per month (on the 1st of each month).

Ways to install native Apple Silicon builds:

  • Latest 29.1 release, which can be installed manually, or via homebrew: brew install --cask jimeh/emacs-builds/emacs-app
  • New monthly Homebrew Cask that only tracks nightly builds from the 1st of each month: brew install --cask jimeh/emacs-builds/emacs-app-monthly

Looking forward, I want to do Apple Silicon builds more frequently, and I'm hoping M1-based runners come down in price, or even become free like the base Intel-based macOS runners are. Until then though, I plan to look into GitHub's sponsorship feature, to see if I could use that to cover build costs, and start doing weekly or maybe even daily Apple Silicon builds.


Update (2021-11-30): Apple Silicon builds now purely depends on GitHub Actions having Apple Silicon based GitHub-hosted runners:

https://github.com/actions/virtual-environments/issues/2187


Main blocker for this right now is the lack of Apple Silicon support in GitHub Actions, as from what I understand it's not possible to build Emacs for Apple Silicon on an Intel machine. There is always the option of buying a Apple Silicon machine, but that'd go against my goal of keeping everything public and transparent, as I would be producing builds from custom self-hosted hardware, instead of GitHub hosted runners.

~~The secondary semi-blocker is that GCC and libgccjit are as of writing not yet available for Apple Silicon, meaning even if I had a Apple Silicon environment to produce builds from, native-comp would not be available.~~

jimeh avatar May 09 '21 20:05 jimeh

Although this isn't possible because of gccjit right now, in the future I can compile native apple silicon builds on my machine when it becomes available.

shaunsingh avatar May 12 '21 16:05 shaunsingh

Just for anyone wondering, the current intel builds do not work under rosetta

shaunsingh avatar May 12 '21 16:05 shaunsingh

@shaunsingh Thanks for the offer, but if possible I want to create builds on public and reproducible hardware to keep the whole process as transparent as possible.

And good point about the current Intel builds not even launching on M1 machines. I’ll update the readme to mention it.

jimeh avatar May 13 '21 19:05 jimeh

Looks like libgccjit is supported on Apple Silicon now. I'm currently building emacs-plus with it, looks good so far, I think emacs-build should work just fine too!

Of course it still isn't possible right now due to the whole GitHub actions issue, but I thought I should let you know.

shaunsingh avatar May 27 '21 23:05 shaunsingh

https://github.com/actions/virtual-environments/issues/2486#issuecomment-853514922 sorry for the late notice, macOS 11 runners are available now on request.

shaunsingh avatar Jun 06 '21 01:06 shaunsingh

@shaunsingh I've submitted the form for access to macOS 11 runners, let's see what happens. Though until they also bring out M1-based runners for macOS 11 (or 12), it's sadly not going to help all that much. But let's hope access to macOS 11 gets me access to M1-runners faster :)

jimeh avatar Jun 13 '21 11:06 jimeh

Apple Silicon builds now purely depends on GitHub Actions having Apple Silicon based GitHub-hosted runners:

https://github.com/actions/virtual-environments/issues/2187

Right now I would like to avoid having to resort to a self-hosted runner, as I'd like all builds to be as transparent as possible with full build logs available, running on standardized non-custom hardware, ensuring nothing has been tempered with.

My hesitance to self-hosted runners might fade when I eventually get a Apple Silicon machine myself, and if it's looking like it will be years before GitHub-hosted runners become available.

But for now, I'm simply gonna keep fingers crossed for the GitHub-hosted runners :)

jimeh avatar Nov 30 '21 22:11 jimeh

These are now available -- any interest in reviving this?

garyo avatar Oct 11 '23 15:10 garyo

@garyo Definitely. I'm hoping to have this sorted within the next couple of weeks, both due to, and because of, the fact that I now have an Apple Silicon machine myself. So testing ARM builds is much easier, and I personally would like to install nightly builds with Homebrew :)

jimeh avatar Nov 14 '23 21:11 jimeh

Ha. One kinda big snag for now, the M1 runners are only available in X-Large variants, which cost $0.16/minute to run, unlike the normal sized macOS runners which are free for public repos.

I'll be doing some experiments to see just how much each Apple Silicon build might cost. On my 11-core M3 Pro a build takes about 8 minutes. The GitHub Actions Runner is a 6-core M1 machine, so I'm expecting somewhere around $2.50-4.00 per build. This rules out nightly builds.

I'll definitely be doing stable builds, but master builds may need to limited to once a week or even once a month. At least until there's a free M1 runner available.

jimeh avatar Nov 15 '23 00:11 jimeh

Weekly master builds seem fine to me at least. Also I bet there are other folks like me who'd donate a small amount monthly for this. (Note: I do a set of monthly master emacs builds for Windows and Ubuntu/Debian; see https://github.com/garyo/emacs-build/releases)

garyo avatar Nov 15 '23 12:11 garyo

Yeah, once I get builds working and I have some idea of average cost for a build, and what can be improved, I'll consider opening up donations on this repo to cover some of the costs.

Last night I burned through $5 worth in about 30 minutes just trying to see if I could get a build to run, without success... lol

jimeh avatar Nov 15 '23 14:11 jimeh

Small update. I have Apple Silicon builds working, and I've managed to minize the use of the M1-based xlarge runners to only the essentials. This seems to yield roughly 17 minutes of billable runner time for each build, or around $3 USD per build.

In the short term, I believe I'll do Apple Silicon builds from master once a month, and have a look at the ins and outs of enabling sponsorships for this repo as a potential means of covering the costs for doing builds more frequently.

I'm about to investigate the most reasonable way to integrate this alternative schedule for Apple Silicon builds into the homebrew tap.

If anyone wants to try a native Apple Silicon build I've produced so far, you can grab the dmg asset from this GitHub Actions run: https://github.com/jimeh/emacs-builds/actions/runs/6917677489

jimeh avatar Nov 19 '23 11:11 jimeh

Small update. I have Apple Silicon builds working, and I've managed to minize the use of the M1-based xlarge runners to only the essentials. This seems to yield roughly 17 minutes of billable runner time for each build, or around $3 USD per build.

In the short term, I believe I'll do Apple Silicon builds from master once a month, and have a look at the ins and outs of enabling sponsorships for this repo as a potential means of covering the costs for doing builds more frequently.

I'm about to investigate the most reasonable way to integrate this alternative schedule for Apple Silicon builds into the homebrew tap.

If anyone wants to try a native Apple Silicon build I've produced so far, you can grab the dmg asset from this GitHub Actions run: https://github.com/jimeh/emacs-builds/actions/runs/6917677489

Please let us know sponsorship path, this is a valuable service you are providing.

Any chance we can have the monthly build be the stable branch (29.1 as of now) as opposed to master?

sawan avatar Nov 21 '23 04:11 sawan

@sawan Stable builds will definitely include both Intel and ARM builds. They're infrequent enough that the cost is acceptable. I will be updating the existing 29.1 release with an ARM build, along with a rebuilt Intel build to resolve #25 within the next few days. And I'll also try and make ARM builds for older stable releases when I have time.

With the nightly builds, my current plan is to include ARM builds on the 1st of the month, and add a new emacs-app-monthly Homebrew cask for it that would always support both Intel and ARM systems. The nightly cask will support ARM automatically if an ARM variant is available on that day.

Currently the 2023-11-19 nightly includes an ARM build, and is the starting point of the monthly cask. I'll be sorting out the final issues around the cask changes today, and updating READMEs as needed.

Over time I will be adjusting the frequency of ARM builds as costs allow thanks to sponsorships and/or changes to costs for the M1 runners.

jimeh avatar Nov 21 '23 08:11 jimeh

I've updated the main issue description with the current state of affairs with Apple Silicon builds. Though builds are available now, the situation is still not ideal, so I'll leave this issue open for now.

jimeh avatar Nov 23 '23 12:11 jimeh

I've been following this along, and just wanted to say, thank you! It's working smoothly for me on my M1.

jesse-c avatar Nov 25 '23 15:11 jesse-c