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 executable for M- series Macs #2263

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

JakenHerman
Copy link

@JakenHerman JakenHerman commented Oct 2, 2024

I noticed there was a GitHub Action that generated a Windows (.exe) executable, but nothing for macOS. This pull request adds a GitHub Action to generate an executable binary for macOS.

Testing

There is a test step in the GitHub Action, so no manually testing should be necessary, however, if you'd like you can download the artifact produced from the GitHub Action run. You'll need to run chmod +x weasyprint-macos/dist/weasyprint in order to be able to execute, but once you do, you can run ./weasyprint-macos/dist/weasyprint --info to verify the executable is working.

Use cases

This executable can be bundled with Electron or Tauri applications so PDF generation is a possibility without requiring users of the built applications to install additional resources.

@JakenHerman JakenHerman marked this pull request as ready for review October 2, 2024 04:55
@JakenHerman
Copy link
Author

I'm not sure where the appropriate place to update documentation on using this binary would be, but I would be happy to contribute to the documentation as the team sees fit. You can see the result of the GitHub action run on my fork here.

@liZe
Copy link
Member

liZe commented Dec 7, 2024

Hi!

Thanks for this pull request.

For now, we’re not sure that we want to generate and support a macOS executable. We tried with Windows, and it actually introduced a number of bugs that are hard to understand, reproduce, and fix for us. The problem is that we don’t have regular Windows or macOS testers in the team, and that nobody wants to take care of this in the long term. So, if we have a large number of users ready to try, report and fix bugs, why not, but we can’t promise anything.

That being said, from a technical point of view, there’s a couple of things I don’t understand:

  • Isn’t PyInstaller supposed to find libraries? All the --add-binary should be useless if we do set the DYLD_FALLBACK_LIBRARY_PATH environment variable when calling PyInstaller (see this line:
    env:
    DYLD_FALLBACK_LIBRARY_PATH: /opt/homebrew/lib
    ). Even better: if we don’t use setup-python and rely on Homebrew’s Python instead, we shouldn’t need to set the environment variable at all.
  • I don’t think that we should set DYLD_LIBRARY_PATH at runtime. PyInstaller should be able to put the libraries somewhere at runtime and to let Python find them automatically, with no runtime hook. That’s at least what it does for Windows, and I think that it was the case for macOS too last time we tried to generate a macOS executable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants