[MacPorts] #63268: 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
MacPorts
noreply at macports.org
Tue Jul 20 14:44:51 UTC 2021
#63268: 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
-------------------------+-------------------------------------------------
Reporter: snarkhunter | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.7.1
Keywords: | Port: gobject-introspection gtk3
| py38-gobject
-------------------------+-------------------------------------------------
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"
}}}
--
Ticket URL: <https://trac.macports.org/ticket/63268>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list