polybar/polybar-scripts

Arch Linux Import Error libffi.so.7 player-mpris-tail

exu-g opened this issue · 5 comments

exu-g commented

Libffi was recently updated to a new api version and now provides libffi.so=8-64 instead of libffi.so.7
This breaks the player-mpris-tail python script, which relies on libffi.so.7

The workaround I found is installing libffi7 from the AUR

Actual error output:
ImportError: libffi.so.7: cannot open shared object file: No such file or directory

I don't seem to be able to reproduce this with libffi-git, could you send what versions you have for other deps?

I think though this is an issue with GLib, as it's arch package doesn't specify a libffi version, but I don't really know as Manjaro keeps delaying updates :P

They also seem to be testing on libffi-devel, which is still libffi7, per their CI files

exu-g commented

I tested on a second Arch install as well now and everything works without issue there.
Both installs are on the same versions of dependencies: libffi 3.4.2-4, glib2 2.70.0-2 and python-gobject 3.40.1-2

I didn't include the full traceback in my first post, so I'll include it here. It just point more to an issue with either python-gobject, glib or libffi.

Traceback (most recent call last):
  File "/home/marc/scripts/polybar/./player-mpris-tail.py", line 12, in <module>
    from gi.repository import GLib
  File "/home/marc/.local/lib/python3.9/site-packages/gi/__init__.py", line 40, in <module>
    from . import _gi
ImportError: libffi.so.7: cannot open shared object file: No such file or directory

Based on this askubuntu answer I checked which libraries are provided with ldconfig -p | grep libffi without libffi7 installed.
The output is the same for both my Arch installs, so nothing weird here:

libffi.so.8 (libc6,x86-64) => /usr/lib/libffi.so.8
libffi.so.8 (libc6) => /usr/lib32/libffi.so.8
libffi.so (libc6,x86-64) => /usr/lib/libffi.so
libffi.so (libc6) => /usr/lib32/libffi.so

With libffi7 installed, there's obviously also a libffi.so.7 file.

Not sure how I could force python to properly relink to the newest libffi
It's probably just my increasingly broken install (I broke it) with weird fixes (when I tried to fix it) that's the problem here.

Weird, seems that I also have the same packages, I'm not really sure what exactly is the issue but my guess is: as the gi package is provided by python-gobject, it shouldn't be installed locally on .local/bin but globally on /usr/lib, so it's possible that you have an outdated version of it conflicting there, perhaps given by an pip package

I'm not sure which packages could cause such conflict but my guess is PyGObject on PyPI. It could also be useful to share the output of pip freeze and pip freeze --user in somewhere if that isn't too much

On another note: _gi is actually a compiled C module, so I don't think there's much to do to force it to use the proper version apart from recompiling it

exu-g commented

I found the problem after having a look through the outputs of pip freeze and pip freeze --user
Both of them included PyGObject.
I removed the local version and everything works properly now, using the distro package, without libffi7 installed.

x70b1 commented

@dzshn Thanks for looking into it!