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

M1 build fixes #148

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

matthiasdiener
Copy link

No description provided.

@matthiasdiener
Copy link
Author

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

@@ -101,14 +101,14 @@ module_autogenargs['tango-icon-theme'] ='--disable-nls --disable-icon-frami
module_autogenargs['harfbuzz'] = '--disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --with-coretext --without-icu '# + autogenargs
module_autogenargs['root-harfbuzz'] = '--disable-gtk-doc --disable-gtk-doc-html --disable-gtk-doc-pdf --with-coretext --without-icu '# + autogenargs
module_autogenargs['fontconfig'] = '--with-cache-dir="~/Library/Caches/org.gnome.meld.fontconfig" --with-default-fonts=/System/Library/Fonts --with-add-fonts=/Library/Fonts,/Network/Library/Fonts,/System/Library/Fonts --disable-cache-build --disable-docs --disable-dependency-tracking'
#module_autogenargs['python3'] = '--enable-optimizations --disable-ipv6 --with-ensurepip=yes --with-system-expat --without-readline --with-pkg-config --disable-test-modules '
module_autogenargs['python3'] = '--enable-optimizations --disable-ipv6 --with-ensurepip=yes --with-system-expat --without-readline --with-pkg-config --disable-test-modules --with-openssl=/opt/homebrew/opt/openssl@3/'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one will tie us to homebrew being installed at run-time. While the adjustment for paths during compile time are fine, we can't assume that homebrew is installed. It's better not to build support for SSL in python altogether since Meld won't need it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but without this line, Python will not have SSL support (it only looks in /usr... by default). Without SSL support, installation fails later in build_app.sh:

*** using recipe: setuptools *** {'expected_missing_imports': {'pkg_resources.extern.packaging._manylinux', 'pkg_resources.extern.jaraco.context', 'pkg_resources.extern.importlib_resources._itertools', 'pkg_resources.extern.jaraco', 'pkg_resources.extern.importlib_resources.abc', 'pkg_resources.extern.packaging.specifiers', 'pkg_resources.extern.importlib_resources', 'pkg_resources.extern.platformdirs', 'pkg_resources.extern.jaraco.functools', 'pkg_resources.extern.platformdirs.unix', 'pkg_resources.extern.packaging.markers', 'pkg_resources.extern.platformdirs.version', 'pkg_resources.extern.packaging._elffile', 'pkg_resources.extern.packaging.metadata', 'pkg_resources.extern.more_itertools.recipes', 'pkg_resources.extern.packaging', 'pkg_resources.extern.more_itertools', 'pkg_resources.extern.typing_extensions', 'pkg_resources.extern.importlib_resources._legacy', 'pkg_resources.extern.more_itertools.more', 'pkg_resources.extern.packaging._structures', 'pkg_resources.extern.zipp', 'pkg_resources.extern.importlib_resources._compat', 'pkg_resources.extern.packaging.tags', 'pkg_resources.extern.platformdirs.__main__', 'pkg_resources.extern.packaging.utils', 'pkg_resources.extern.platformdirs.macos', 'pkg_resources.extern.packaging.requirements', 'pkg_resources.extern.jaraco.text', '__builtin__', 'pkg_resources.extern.platformdirs.android', 'pkg_resources.extern.importlib_resources.readers', 'pkg_resources.extern.packaging._musllinux', 'pkg_resources.extern.packaging._parser', 'pkg_resources.extern.platformdirs.windows', 'pkg_resources.extern.importlib_resources._adapters', 'pkg_resources.extern.platformdirs.api', 'pkg_resources.extern.importlib_resources.simple', '__main__.__requires__', 'pkg_resources.extern.packaging.version', 'pkg_resources.extern.packaging._tokenizer', 'pkg_resources.extern.importlib_resources._common'}, 'prescripts': [<_io.StringIO object at 0x1079369e0>]}
--- Skipping recipe PIL ---
--- Skipping recipe autopackages ---
--- Skipping recipe black ---
--- Skipping recipe gcloud ---
--- Skipping recipe lxml ---
--- Skipping recipe matplotlib ---
--- Skipping recipe opencv ---
--- Skipping recipe pandas ---
*** using recipe: platformdirs *** {'includes': ['platformdirs.macos']}
--- Skipping recipe PIL ---
--- Skipping recipe autopackages ---
--- Skipping recipe black ---
--- Skipping recipe gcloud ---
--- Skipping recipe lxml ---
--- Skipping recipe matplotlib ---
--- Skipping recipe opencv ---
--- Skipping recipe pandas ---
--- Skipping recipe pydantic ---
--- Skipping recipe pyenchant ---
--- Skipping recipe pygame ---
--- Skipping recipe pylsp ---
--- Skipping recipe pyopengl ---
--- Skipping recipe pyside ---
--- Skipping recipe pyside2 ---
--- Skipping recipe pyside6 ---
--- Skipping recipe qt5 ---
--- Skipping recipe qt6 ---
--- Skipping recipe rtree ---
--- Skipping recipe shiboken2 ---
--- Skipping recipe shiboken6 ---
--- Skipping recipe sip ---
--- Skipping recipe six ---
--- Skipping recipe sphinx ---
--- Skipping recipe sqlalchemy ---
Traceback (most recent call last):
  File "/Users/mdiener/Work/meld/setup_py2app.py", line 82, in <module>
    setup(
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/__init__.py", line 103, in setup
    return distutils.core.setup(**attrs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
    return run_commands(dist)
           ^^^^^^^^^^^^^^^^^^
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
    dist.run_commands()
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
    self.run_command(cmd)
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/dist.py", line 989, in run_command
    super().run_command(command)
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
    cmd_obj.run()
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/py2app/build_app.py", line 984, in run
    self._run()
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/py2app/build_app.py", line 1214, in _run
    self.run_normal()
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/py2app/build_app.py", line 1311, in run_normal
    self.process_recipes(mf, filters, flatpackages, loader_files)
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/py2app/build_app.py", line 1160, in process_recipes
    rval = check(self, mf)
           ^^^^^^^^^^^^^^^
  File "/Users/mdiener/gtk/inst/lib/python3.11/site-packages/py2app/recipes/sslmod.py", line 26, in check
    import ssl
  File "/Users/mdiener/gtk/inst/lib/python3.11/ssl.py", line 100, in <module>
    import _ssl             # if we can't import it, let the error propagate
    ^^^^^^^^^^^
ModuleNotFoundError: No module named '_ssl'

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Humm.. Will probably need py2app to skip the ssl module.
This can probably be done here: https://github.com/yousseb/meld/blob/master/setup_py2app.py#L119

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that seems to work, although it is a bit hard to tell cause starting from a fresh environment is difficult...

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be ok, but I'll probably have to have different file setup.cfg.in and generate the file during build for m1&x64. Maybe even skip this altogether and use py2app's arg from command line for arch.

@@ -1,6 +1,6 @@
[py2app]
app = ['bin/meld']
arch = x86_64
arch = universal2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let me know if this works. :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, it works! universal2 works, universal does not.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect! Thank you very much for doing this.

@DamianoP
Copy link

DamianoP commented Nov 8, 2023

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

this version always asks me for permission to access the files every time it compares a folder
Generally, once permission is given, it should not be asked every time (over and over again)

@Damecek
Copy link

Damecek commented Nov 8, 2023

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

getting this on M2

See the py2app website for debugging launch issues

@zexpe zexpe mentioned this pull request Nov 9, 2023
@dusanscensny
Copy link

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

Thanks for build @matthiasdiener.
Build works nice also on Mac M2 . Thanks a lot. I would appreciate to get this official on Meld. I had just to uncheck "use system font settings" as text was not readable.

@unilock
Copy link

unilock commented Nov 9, 2023

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

This build works great on my M2 machine! Just had to run xattr -rc /Applications/Meld.app to shut up Gatekeeper. ^u^

@fadeopolis
Copy link

fadeopolis commented Nov 15, 2023

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

The dmg seems to depend on some libraries from homebrew.
It seems to die because it cannot find libpng on a machine without homebrew:

** (process:97829): WARNING **: 22:45:16.820: Failed to load shared library '@executable_path/../Frameworks/libpango-1.0.0.dylib' referenced by the typelib: dlopen(@executable_path/../Frameworks/libpango-1.0.0.dylib, 0x0009): Library not loaded: /opt/homebrew/opt/libpng/lib/libpng16.16.dylib
  Referenced from: <18E08805-971F-3010-A09C-B33FCA63EE36> .../Downloads/Meld.app/Contents/Frameworks/libfreetype.6.20.0.dylib
  Reason: tried: '/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file), '/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file)
...
  File ".../Meld.app/Contents/Resources/lib/python3.11/gi/overrides/Pango.py", line 41, in <module>
    FontDescription = override(FontDescription)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../Meld.app/Contents/Resources/lib/python3.11/gi/overrides/__init__.py", line 195, in override
    assert g_type != TYPE_NONE
           ^^^^^^^^^^^^^^^^^^^
AssertionError

@kf6kjg
Copy link

kf6kjg commented Nov 20, 2023

Echoing what @fadeopolis posted, though in my case homebrew IS installed, but the paths are not standard on my system due to having an installation that I've just kept nursing since my user was on an x86_64 CPU...

$ ll /usr/local/opt/libpng*
lrwxr-xr-x  1 x  x  23 Nov 20 10:53 /usr/local/opt/libpng@ -> ../Cellar/libpng/1.6.40

$ ll /opt/homebrew/opt     
total 0
drwxrwxr-x   2 x  x    64 Jan  6  2022 ./
drwxr-xr-x  32 x  x  1024 Jan  6  2022 ../

Edit: Re-installing homebrew and then installing brew install pango brotli makes it work. Now I have the care and feeding of two homebrew installations: one arm64 brew and one x86_64, aliased as ibrew. Fun times :P

@Alfystar
Copy link

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

This solution work for me! And, for what I see, to a lot of other people,
when do you integrate it on brew package manager? I love MELD! ❤️

@jerryOnlyZRJ
Copy link

jerryOnlyZRJ commented Nov 29, 2023

It doesn't work on my M3 machine.I need to find an alternative solution.

@rsireland
Copy link

It does not work on my MacBookPro running Sonoma.

meld_crash.log

@alvarogonzalez-packlink

Seems like there's a path problem while importing libraries. It looks for libpng16.16.dylib and libbrotlidec.1.dylib in the homebrew path, even when they're included in the package.

It looks for them in /opt/homebrew/opt/libpng/lib/libpng16.16.dylib and /opt/homebrew/opt/brotli/lib/libbrotlidec.1.dylib but they're located in ./Meld.app/Contents/Frameworks/.

So I did a couple of soft links and it started working:

sudo mkdir -p /opt/homebrew/opt/libpng/lib/
sudo ln -s /YOURPATH/Meld.app/Contents/Frameworks/libpng16.16.dylib /opt/homebrew/opt/libpng/lib/
sudo mkdir -p /opt/homebrew/opt/brotli/lib/
sudo ln -s /YOURPATH/Meld.app/Contents/Frameworks/libbrotlidec.1.dylib /opt/homebrew/opt/brotli/lib/

Substitute YOURPATH for the path to Meld location.

@ramonotsu
Copy link

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

Funciona en M1 con Sonoma 14.1.2 (23B92)

Muchas gracias.

@ilyagr
Copy link

ilyagr commented Dec 26, 2023

Update: The best solution at the moment is described in a gist linked from #151 (comment). It involves installing a prerelease (not the homebrew nor the Nix version) and running a couple of commands to patch it.

I wanted to share a couple of imperfect workarounds, adding on to the workaround in #148 (comment) (that I haven't tried).

The Nix meld package does seem to run on Mac OS Sonoma on Apple Silicon. It does not run perfectly; there are some graphical glitches, but seems usable. I posted a few more instructions at https://gitlab.gnome.org/GNOME/meld/-/issues/804#note_1953154.

As another option, you can run XQuartz and lima, and install the Linux version of meld inside the VM (sudo apt install meld). Make sure to add the following to the lima YAML config file:

ssh:
  forwardX11: true

I think I got it to work, if a bit slowly. The QEMU emulation is better for graphical acceleration. I'm not sure whether there are additional necessary steps I forgot; I might update this post if I remember something.

@RoganDawes
Copy link

With the changes in this PR, meld builds successfully on M1 for me!

A built dmg can be found here: https://uofi.box.com/s/o2ci9nk9qit9jatv3pzjv3dybbp94dqr

This version works successfully for me on my M1 Mac. The version available from brew, as well as the most recent version available for download on this repo only showed the title bar for me.

@ASCine
Copy link

ASCine commented May 6, 2024

@matthiasdiener is your PR still running? I just downloaded the provided PR from your box, but I get a Launch Error ?

@matthiasdiener
Copy link
Author

@matthiasdiener is your PR still running? I just downloaded the provided PR from your box, but I get a Launch Error ?

It runs fine for me, what is the error you get?

@ASCine
Copy link

ASCine commented May 10, 2024

It runs fine for me, what is the error you get?

Bildschirmfoto 2024-05-10 um 20 39 26

what do I have to do with this message?

@ilyagr
Copy link

ilyagr commented May 10, 2024

I've seen similar-looking errors when I used the system-installed python on Mac OS instead of the homebrew python.

@ASCine
Copy link

ASCine commented May 10, 2024

I've seen similar-looking errors when I used the system-installed python on Mac OS instead of the homebrew python.

I run 3.12.3 from brew...

@ASCine
Copy link

ASCine commented May 13, 2024

@matthiasdiener

this is the terminal output:
% /Applications/Meld.app/Contents/MacOS/Meld
/Applications/Meld.app/Contents/Resources/boot.py:118: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html

** (process:11394): WARNING **: 15:21:27.844: Failed to load shared library '@executable_path/../Frameworks/libpango-1.0.0.dylib' referenced by the typelib: dlopen(@executable_path/../Frameworks/libpango-1.0.0.dylib, 0x0009): Library not loaded: /opt/homebrew/opt/libpng/lib/libpng16.16.dylib
Referenced from: <18E08805-971F-3010-A09C-B33FCA63EE36> /Applications/Meld.app/Contents/Frameworks/libfreetype.6.20.0.dylib
Reason: tried: '/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file), '/opt/homebrew/opt/libpng/lib/libpng16.16.dylib' (no such file)
Traceback (most recent call last):
File "/Applications/Meld.app/Contents/Resources/boot.py", line 163, in
_run()
File "/Applications/Meld.app/Contents/Resources/boot.py", line 86, in _run
exec(compile(source, path, "exec"), globals(), globals())
File "/Applications/Meld.app/Contents/Resources/meld", line 517, in
sys.exit(main())
^^^^^^
File "/Applications/Meld.app/Contents/Resources/meld", line 508, in main
check_requirements()
File "/Applications/Meld.app/Contents/Resources/meld", line 276, in check_requirements
r.check()
File "/Applications/Meld.app/Contents/Resources/meld", line 243, in check
mod = importlib.import_module(module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "importlib/init.pyc", line 126, in import_module
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 674, in _load_unlocked
File "", line 634, in _load_backward_compatible
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/importer.py", line 149, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "importlib/init.pyc", line 126, in import_module
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 674, in _load_unlocked
File "", line 634, in _load_backward_compatible
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/importer.py", line 149, in load_module
importlib.import_module('gi.repository.' + dep.split("-")[0])
File "importlib/init.pyc", line 126, in import_module
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 674, in _load_unlocked
File "", line 634, in _load_backward_compatible
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/importer.py", line 150, in load_module
dynamic_module = load_overrides(introspection_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/overrides/init.py", line 118, in load_overrides
override_mod = importlib.import_module(override_package_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "importlib/init.pyc", line 126, in import_module
File "", line 1204, in _gcd_import
File "", line 1176, in _find_and_load
File "", line 1147, in _find_and_load_unlocked
File "", line 690, in _load_unlocked
File "", line 940, in exec_module
File "", line 241, in _call_with_frames_removed
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/overrides/Pango.py", line 41, in
FontDescription = override(FontDescription)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Applications/Meld.app/Contents/Resources/lib/python3.11/gi/overrides/init.py", line 195, in override
assert g_type != TYPE_NONE
^^^^^^^^^^^^^^^^^^^
AssertionError
2024-05-13 15:21:27.912 Meld[11394:212273] Launch error
2024-05-13 15:21:27.912 Meld[11394:212273] Launch error
See the py2app website for debugging launch issues

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.

None yet