Opened 3 years ago

Last modified 3 years ago

#61792 assigned defect

py-gobject3, py-graph-tool error: Failed to load shared library 'libgdk_pixbuf-2.0.0.dylib'

Reported by: essandess (Steve Smith) Owned by: dbevans (David B. Evans)
Priority: Normal Milestone:
Component: ports Version: 2.6.4
Keywords: Cc: michaelld (Michael Dickens)
Port: py-gobject3 py-graph-tool

Description

The python package py-gobject3 (and its dependency py-graph-tool fail with this error:

import graph_tool.all as gt

…

import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, Gdk, GdkPixbuf

** (process:56675): WARNING **: 09:29:10.365: Failed to load shared library 'libgdk_pixbuf-2.0.0.dylib' referenced by the typelib: dlopen(libgdk_pixbuf-2.0.0.dylib, 9): image not found
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
<ipython-input-3-8850e2a9ffc3> in <module>
----> 1 from gi.repository import Gtk, Gdk, GdkPixbuf

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_backward_compatible(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/importer.py in load_module(self, fullname)
    142             # https://bugzilla.gnome.org/show_bug.cgi?id=656314
    143             for dep in repository.get_immediate_dependencies(namespace):
--> 144                 importlib.import_module('gi.repository.' + dep.split("-")[0])
    145             dynamic_module = load_overrides(introspection_module)
    146 

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_backward_compatible(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/importer.py in load_module(self, fullname)
    142             # https://bugzilla.gnome.org/show_bug.cgi?id=656314
    143             for dep in repository.get_immediate_dependencies(namespace):
--> 144                 importlib.import_module('gi.repository.' + dep.split("-")[0])
    145             dynamic_module = load_overrides(introspection_module)
    146 

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _gcd_import(name, package, level)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_unlocked(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/_bootstrap.py in _load_backward_compatible(spec)

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/importer.py in load_module(self, fullname)
    143             for dep in repository.get_immediate_dependencies(namespace):
    144                 importlib.import_module('gi.repository.' + dep.split("-")[0])
--> 145             dynamic_module = load_overrides(introspection_module)
    146 
    147         dynamic_module.__file__ = '<%s>' % fullname

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/overrides/__init__.py in load_overrides(introspection_module)
    116             return introspection_module
    117 
--> 118         override_mod = importlib.import_module(override_package_name)
    119 
    120     finally:

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py in import_module(name, package)
    125                 break
    126             level += 1
--> 127     return _bootstrap._gcd_import(name[level:], package, level)
    128 
    129 

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/overrides/GdkPixbuf.py in <module>
     30 
     31 @override
---> 32 class Pixbuf(GdkPixbuf.Pixbuf):
     33 
     34     @classmethod

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/overrides/__init__.py in override(type_)
    193 
    194         g_type = info.get_g_type()
--> 195         assert g_type != TYPE_NONE
    196         if g_type != TYPE_INVALID:
    197             g_type.pytype = type_

AssertionError: 

I confirm that the library libgdk_pixbuf-2.0.0.dylib exists and is installed by the port gdk-pixbuf2:

ls /opt/local/lib/libgdk_pixbuf-2.0.0.dylib 
/opt/local/lib/libgdk_pixbuf-2.0.0.dylib*

port provides /opt/local/lib/libgdk_pixbuf-2.0.0.dylib
/opt/local/lib/libgdk_pixbuf-2.0.0.dylib is provided by: gdk-pixbuf2

Change History (12)

comment:1 Changed 3 years ago by michaelld (Michael Dickens)

We need to rev-bump dependencies of gobject-introspection (GI here) ... that would fix this issue. Same same as a few other related tickets.

FYI the issue here is with the "GIR" file generated for gdk-pixbuf2 (and possibly other GI-using ports): it lists just libgdk_pixbuf-2.0.0.dylib, not /opt/local/lib/libgdk_pixbuf-2.0.0.dylib with the full path. When GI tries to load this library, it fails because there is no reference directory starting point for the library as stored in the GIR file. We fixed this issue in GI a week ago ... just forgot to rev-bump dependencies & then got busy with other stuff.

One solution is to do something like:

sudo port -f uninstall gdk-pixbuf2
sudo port install gdk-pixbuf2

and then try the import graph_tool.all as gt again .. should work now.

comment:2 Changed 3 years ago by mf2k (Frank Schima)

Cc: dbevans removed
Owner: set to dbevans
Port: py-gobject3, py-graph-toolpy-gobject3 py-graph-tool
Status: newassigned

comment:3 Changed 3 years ago by michaelld (Michael Dickens)

Cc: michaelld added

comment:4 Changed 3 years ago by essandess (Steve Smith)

Thank you, but still seeing this related issue after a reinstall of gdk-pixbuf2:

python3 -c 'import graph_tool.all as gt'

** (process:25790): WARNING **: 10:16:52.987: Failed to load shared library 'libgdk_pixbuf-2.0.0.dylib' referenced by the typelib: dlopen(libgdk_pixbuf-2.0.0.dylib, 9): image not found
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graph_tool/all.py", line 34, in <module>
    from graph_tool.draw import *
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graph_tool/draw/__init__.py", line 874, in <module>
    from . cairo_draw import graph_draw, cairo_draw, \
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/graph_tool/draw/cairo_draw.py", line 1456, in <module>
    from gi.repository import Gtk, Gdk, GdkPixbuf
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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.7/lib/python3.7/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.7/lib/python3.7/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.7/lib/python3.7/site-packages/gi/overrides/GdkPixbuf.py", line 32, in <module>
    class Pixbuf(GdkPixbuf.Pixbuf):
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/gi/overrides/__init__.py", line 195, in override
    assert g_type != TYPE_NONE
AssertionError

comment:5 Changed 3 years ago by essandess (Steve Smith)

This workaround works, but there's still some library path issue:

DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib python3 -c 'import graph_tool.all as gt'

I don't see anything amiss in otool -L /opt/local/lib/libgdk_pixbuf-2.0.0.dylib.

comment:6 Changed 3 years ago by michaelld (Michael Dickens)

Did you upgrade gobject-introspection yet? port installed gobject-introspection should return gobject-introspection @1.60.2_4. If not then upgrade, then reinstall any ports that depend on it.

comment:7 Changed 3 years ago by ra1nb0w

You need to update the ports and then rebuild in the following way:

sudo port -sn upgrade --force gobject-introspection gdk-pixbuf2

until rev-dump.

comment:8 Changed 3 years ago by essandess (Steve Smith)

That worked! Thank you.

comment:9 Changed 3 years ago by pftbest (Vadzim Dambrouski)

Hello,

I have the same exact problem with meld. When I run it with fallback path it works fine

DYLD_FALLBACK_LIBRARY_PATH=/opt/local/lib meld

if not then it fails with the same error. But the rebuild command from above doesn't help in my case. Is there some other port I can rebuild to fix this?

comment:10 Changed 3 years ago by michaelld (Michael Dickens)

@pftbest: so you're saying that when running meld as you note without the DYLD_FALLBACK_LIBRARY_PATH setting, you see something like

** (process:25790): WARNING **: 10:16:52.987: Failed to load shared library 'libgdk_pixbuf-2.0.0.dylib' referenced by the typelib: dlopen(libgdk_pixbuf-2.0.0.dylib, 9): image not found

which specific shared library fails to load? If it is as noted, then make sure you have installed the following:

$ port installed gobject-introspection gdk-pixbuf2 atk
The following ports are currently installed:
  atk @2.36.0_1 (active)
  gdk-pixbuf2 @2.42.2_0 (active)
  gobject-introspection @1.60.2_4 (active)

and make sure the versions are the same. If not, then you need to do something like:

sudo port sync
sudo port upgrade outdated

and hopefully that will take care of the issue.

comment:11 Changed 3 years ago by VinDuv

Hi,

I have a similar problem, except that in my case dlopen tries to load ./gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib. The file /opt/local/share/gir-1.0/GdkPixbuf-2.0.gir contains:

shared-library="./gdk-pixbuf/libgdk_pixbuf-2.0.0.dylib"

Interestingly, the problem only happens when I build gdk-pixbuf2 from source (which I was doing because I tried to install the -x11 variant). The binary package contains the expected

shared-library="/opt/local/lib/libgdk_pixbuf-2.0.0.dylib"

in the .gir file.

I’m running High Sierra.

EDIT: After investigating, I found out that this problem comes from g-ir-scanner, in a part of the code that seems to come from a MacPort patch. Will open a separate bug report.

Last edited 3 years ago by VinDuv (previous) (diff)

comment:12 Changed 3 years ago by evanmiller (Evan Miller)

In 8f58afc2f37e944f1b96b2bbdf21bbdf67b10258/macports-ports (master):

meson: Fix dylib install paths for typelib files

See: #62391
See: #61792
See: #61934

Note: See TracTickets for help on using tickets.