Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SomberNight opened this issue May 1, 2021 · 1 comment
Labels
build/packaging 📦 OS-mac pull-request wanted 📣 Help would be much appreciated if you have expertise and time.

Comments

@SomberNight
Copy link
Member

SomberNight commented May 1, 2021

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 #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.

@SomberNight SomberNight added OS-mac build/packaging 📦 pull-request wanted 📣 Help would be much appreciated if you have expertise and time. labels May 1, 2021
@SomberNight
Copy link
Member Author

I guess even if we managed to build the unsigned binary, signing and notarisation itself on Linux might pose a problem:
tpoechtrager/osxcross#198

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build/packaging 📦 OS-mac pull-request wanted 📣 Help would be much appreciated if you have expertise and time.
Projects
None yet
Development

No branches or pull requests

1 participant