Opened 3 years ago
Closed 3 years ago
#63268 closed defect (fixed)
gtk3 @3.24.23_0+x11, py38-gobject3 @3.38.0_0, gobject-introspection @1.60.2_6: Can't load Gtk when built from source
Reported by: | snarkhunter (Steve Langer) | Owned by: | mascguy (Christopher Nielsen) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.7.1 |
Keywords: | Cc: | ||
Port: | gobject-introspection gtk3 py38-gobject |
Description
In a fresh MacPorts installation on Big Sur, and building all packages from source, Gtk won't load in Python. I ran these tests on a standard installation, from MacPorts-2.7.1-11-BigSur.pkg, using Xcode 12.5.1.
% sudo port uninstall installed % sudo port -Ns install py38-gobject3 gtk3 % sudo port select --set python3 python38 % python3 Python 3.8.11 (default, Jul 20 2021, 00:52:17) [Clang 12.0.5 (clang-1205.0.22.11)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import gi >>> gi.require_version("Gtk", "3.0") >>> from gi.repository import Gtk ** (process:70128): WARNING **: 09:16:41.518: Failed to load shared library './gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib' referenced by the typelib: dlopen(./gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib, 9): image not found Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 144, in load_module importlib.import_module('gi.repository.' + dep.split("-")[0]) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 144, in load_module importlib.import_module('gi.repository.' + dep.split("-")[0]) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1014, in _gcd_import File "<frozen importlib._bootstrap>", line 991, in _find_and_load File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap>", line 618, in _load_backward_compatible File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/importer.py", line 145, in load_module dynamic_module = load_overrides(introspection_module) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/__init__.py", line 118, in load_overrides override_mod = importlib.import_module(override_package_name) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/GdkPixbuf.py", line 32, in <module> class Pixbuf(GdkPixbuf.Pixbuf): File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gi/overrides/__init__.py", line 195, in override assert g_type != TYPE_NONE AssertionError >>> ^D
A conversation on the mailing list implied that the problem is due to relative paths in .gir files:
% grep "shared-library" /opt/local/share/gir-1.0/*.gir | grep -v /opt/local/lib /opt/local/share/gir-1.0/Atk-1.0.gir: shared-library="./atk/libatk-1.0.0.dylib" /opt/local/share/gir-1.0/Atspi-2.0.gir: shared-library="./atspi/libatspi.0.dylib" /opt/local/share/gir-1.0/GdkPixbuf-2.0.gir: shared-library="./gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib" /opt/local/share/gir-1.0/GdkPixdata-2.0.gir: shared-library="./gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib"
Uninstalling everything and reinstalling with the pre-built binaries gives a very different result. Gtk loads properly, but there's still one relative path in the .gir files:
% sudo port uninstall installed % sudo port -N install py38-gobject3 gtk3 % sudo port select --set python3 python38 % python3 Python 3.8.11 (default, Jul 5 2021, 09:52:53) [Clang 12.0.5 (clang-1205.0.22.9)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import gi >>> gi.require_version("Gtk", "3.0") >>> from gi.repository import Gtk >>> ^D % grep "shared-library" /opt/local/share/gir-1.0/*.gir | grep -v /opt/local/lib /opt/local/share/gir-1.0/Atspi-2.0.gir: shared-library="libatspi.0.dylib"
Change History (8)
comment:1 Changed 3 years ago by ryandesign (Ryan Carsten Schmidt)
comment:2 Changed 3 years ago by nortcele
Could an update of gobject-introspection solve the problem. I proposed a portfile to upgrade to version @1.68.0 in #62863.
comment:3 Changed 3 years ago by kencu (Ken)
feel free to try; it has not fixed it previously.
Michael spent a week or two on this last year, looked to have made headway, but no bueno in the end.
If you like python, linkers, and tables of library locations, this might be your mountain to climb!
comment:4 Changed 3 years ago by snarkhunter (Steve Langer)
Installing gdk-pixbuf2 +x11, even if other ports are +quartz -x11, makes this problem go away. Is that a safe workaround? (gdk-pixbuf2 @2.42.2_2+x11, macOS 11.6)
comment:5 Changed 3 years ago by mascguy (Christopher Nielsen)
Cc: | dbevans removed |
---|---|
Owner: | set to mascguy |
Status: | new → assigned |
I'll add this to my backlog.
comment:6 Changed 3 years ago by mascguy (Christopher Nielsen)
Is this still an issue, even with the updated versions of all of these ports (gtk3 3.24.31, py-gobject 3.42.0, gobject-introspection 1.70.0)?
comment:7 follow-up: 8 Changed 3 years ago by snarkhunter (Steve Langer)
I can't repeat the problem, so it looks like it's fixed. I didn't rebuild all my ports from source, but I did rebuild gtk3, gobject-introspection, and py38-gobject3.
comment:8 Changed 3 years ago by mascguy (Christopher Nielsen)
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Replying to snarkhunter:
I can't repeat the problem, so it looks like it's fixed. I didn't rebuild all my ports from source, but I did rebuild gtk3, gobject-introspection, and py38-gobject3.
Great, glad to hear that it's resolved!
There have been a zillion tickets about this. The fact that new tickets keep appearing suggests that whatever fix we put in before is not sufficient.