spesmilo / spesmilo/electrum

Build macOS binary (.app/.dmg) from GNU/Linux; so that we no longer need a dedicated macbook just for building for OSX

Open
#7,265 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

build/packaging 📦 OS-mac pull-request wanted 📣
Dominant language
Python
Stars
8.6k
Forks
3.5k
Avg merge
2d 8h
Merged PRs (30d)
61

Description

Currently building the macOS release binary can only be done on an actual Mac.
For many years now, we have been building it on a macbook, inside a VM that also runs macOS.
(see https://github.com/spesmilo/electrum/blob/ef3293ab6ac64970bb6fa24be33dbe606bbd344e/contrib/osx/README.md)

This is in stark contrast to ALL other binaries/distributables we build, the source dist, the Windows exes, the Linux AppImage, the Android apk, are all built on GNU/Linux. All these other builds are nicely containerised using docker.
Not so much for macOS...


Note that the main tool used to create the macOS binaries is pyinstaller, and PyInstaller is not a cross-compiler:

PyInstaller is tested against Windows, Mac OS X, and GNU/Linux. However, it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a GNU/Linux app you run it in GNU/Linux, etc.

We work around this limitation for Windows by using Wine (though see https://github.com/spesmilo/electrum/issues/6566).
(I am personally very happy with Wine, there have been hardly any issues caused by it over the years.)
Perhaps a similar workaround could be used for OSX? That would be nice.

Alternatively, we could use another tool instead of pyinstaller.
This would require a substantial rewrite of the build script of course, but the main issue is finding such a tool in the first place. Something that could cross-compile from Linux to OSX.
PyOxidizer, an alternative to PyInstaller, has an open issue about this, but it does not look like anyone is working on it :(

Alternatively, maybe we could run a VM with macOS guest on a Linux host. I don't know if Apple's licenses allow this...........
Ideally this should be scripted though (including setting up the VM). Note that obviously we don't want to trust large binary blobs supplied by random third parties, so the blobs (which would be inevitable in the context of an OSX VM I guess) should either come from Apple or some reputable source.

Maybe we could find another project that found a solution to cross-compile from Linux to macOS. :) I had no luck so far.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with contrib/osx/README.md to understand the current macOS build process, then compare it with the containerized approach in contrib/build-wine. Investigate whether a Linux-based cross-build or scripted macOS VM can produce the macOS .app/.dmg, and consider the work complete when the release binary can be built reproducibly from GNU/Linux without a dedicated Mac.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, macos, python
Domain
build-system, devops, release
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.