jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
543 stars 68 forks source link

MPV 0.33 broken #146

Closed jrch2k20 closed 3 years ago

jrch2k20 commented 3 years ago

LOG 2020-12-02 18:47:12,519 [ INFO] conf: Loaded settings from json: /home/junior/.config/jellyfin-mpv-shim/conf.json Traceback (most recent call last): File "/usr/bin/jellyfin-mpv-shim", line 33, in sys.exit(load_entry_point('jellyfin-mpv-shim==1.8.0', 'console_scripts', 'jellyfin-mpv-shim')()) File "/usr/lib/python3.9/site-packages/jellyfin_mpv_shim/mpv_shim.py", line 64, in main from .player import playerManager File "/usr/lib/python3.9/site-packages/jellyfin_mpv_shim/player.py", line 36, in import mpv File "/usr/lib/python3.9/site-packages/mpv.py", line 514, in backend.mpv_client_api_version.restype = c_ulong File "/usr/lib/python3.9/ctypes/init.py", line 387, in getattr func = self.getitem(name) File "/usr/lib/python3.9/ctypes/init.py", line 392, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /usr/lib/libmpv.so.1: undefined symbol: mpv_client_api_version

MPV version [cplayer] Command line options: '-v' [cplayer] mpv 0.33.0-1-gfa7afc3e19 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects [cplayer] built on Sun Nov 22 18:50:57 -04 2020 [cplayer] FFmpeg library versions: [cplayer] libavutil 56.51.100 [cplayer] libavcodec 58.91.100 [cplayer] libavformat 58.45.100 [cplayer] libswscale 5.7.100 [cplayer] libavfilter 7.85.100 [cplayer] libswresample 3.7.100 [cplayer] FFmpeg version: n4.3.1 [cplayer] [cplayer] Configuration: ./waf configure --prefix=/usr --confdir=/etc/mpv --enable-libmpv-shared --enable-dvdnav --enable-cdda --enable-libarchive --lua=luajit [cplayer] List of enabled features: alsa asm build-date caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build drm dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffnvcodec gbm gbm.h gl gl-wayland glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo librt linux-fstatfs linux-input-event-codes lua luajit memfd_create optimize plain-gl posix posix-or-mingw pthreads pulse rubberband shaderc shaderc-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vaapi-x-egl vaapi-x11 vapoursynth vdpau vt.h vulkan wayland wayland-protocols x11 xv zimg zlib

Tyvm for your time

jaseg commented 3 years ago

Hey there,

I'm having trouble reproducing this (see log below). Could you please make 120% sure your python interpreter is looking for the same mpv version you've installed as a command-line tool? On most distros, the "mpv" package containing the "mpv" binary is separate from a "libmpv" package that contains libmpv. It might be that although your mpv binary is current, your libmpv is not. In case you built mpv yourself, make sure pass "--enable-libmpv-shared" to "waf configure", otherwise it won't build libmpv at all.

Best, jaseg

dev-pypi~/mpv <3 git checkout fa7afc3e19 Previous HEAD position was 0728b51498 Release 0.33.0 HEAD is now at fa7afc3e19 Update VERSION dev-pypi~/mpv <3 ./waf build Waf: Entering directory /home/user/mpv/build' [1/1] Compiling version.sh [198/418] Compiling common/version.c [415/418] Compiling common/version.c [416/418] Linking build/libmpv.so [417/418] Linking build/mpv [418/418] Symlinking build/libmpv.so Waf: Leaving directory/home/user/mpv/build' 'build' finished successfully (1.954s) dev-pypi~/mpv <3 sudo ./waf install (fa7afc3e…) Waf: Entering directory `/home/user/mpv/build' [1/1] Compiling version.sh

  • install /usr/local/bin/mpv (from build/mpv)
  • install /usr/local/share/doc/mpv/mpv.conf (from etc/mpv.conf)
  • install /usr/local/share/doc/mpv/input.conf (from etc/input.conf)
  • install /usr/local/share/doc/mpv/mplayer-input.conf (from etc/mplayer-input.conf)
  • install /usr/local/share/doc/mpv/restore-old-bindings.conf (from etc/restore-old-bindings.conf)
  • symlink /usr/local/lib/libmpv.so (to libmpv.so.1.109.0)
  • install /usr/local/lib/libmpv.so.1.109.0 (from build/libmpv.so)
  • symlink /usr/local/lib/libmpv.so.1 (to libmpv.so.1.109.0)
  • install /usr/local/include/mpv/client.h (from libmpv/client.h)
  • install /usr/local/include/mpv/opengl_cb.h (from libmpv/opengl_cb.h)
  • install /usr/local/include/mpv/render.h (from libmpv/render.h)
  • install /usr/local/include/mpv/render_gl.h (from libmpv/render_gl.h)
  • install /usr/local/include/mpv/stream_cb.h (from libmpv/stream_cb.h)
  • install /usr/local/lib/pkgconfig/mpv.pc (from build/libmpv/mpv.pc)
  • install /usr/local/share/man/man1/mpv.1 (from build/DOCS/man/mpv.1)
  • install /usr/local/share/zsh/site-functions/_mpv (from etc/_mpv.zsh)
  • install /usr/local/share/bash-completion/completions/mpv (from etc/mpv.bash-completion)
  • install /usr/local/share/applications/mpv.desktop (from etc/mpv.desktop)
  • install /usr/local/etc/mpv/encoding-profiles.conf (from etc/encoding-profiles.conf)
  • install /usr/local/share/icons/hicolor/32x32/apps/mpv.png (from etc/mpv-icon-8bit-32x32.png)
  • install /usr/local/share/icons/hicolor/16x16/apps/mpv.png (from etc/mpv-icon-8bit-16x16.png)
  • install /usr/local/share/icons/hicolor/64x64/apps/mpv.png (from etc/mpv-icon-8bit-64x64.png)
  • install /usr/local/share/icons/hicolor/128x128/apps/mpv.png (from etc/mpv-icon-8bit-128x128.png)
  • install /usr/local/share/icons/hicolor/scalable/apps/mpv.svg (from etc/mpv-gradient.svg)
  • install /usr/local/share/icons/hicolor/symbolic/apps/mpv-symbolic.svg (from etc/mpv-symbolic.svg) Waf: Leaving directory `/home/user/mpv/build' 'install' finished successfully (0.459s) dev-pypi~/mpv <3 cd ../python-mpv/ dev-pypi~/python-mpv <3 env LD_LIBRARY_PATH=/usr/local/lib python3 -c 'import mpv; print(mpv.MPV().mpv_version)' (1) master mpv 0.33.0-1-gfa7afc3e19
jrch2k20 commented 3 years ago

Sure.

[junior@archlinux ~]$ ls -lah /usr/lib/libmpv* lrwxrwxrwx 1 root root 17 Dec 3 20:25 /usr/lib/libmpv.so -> libmpv.so.1.109.0 lrwxrwxrwx 1 root root 17 Dec 3 20:25 /usr/lib/libmpv.so.1 -> libmpv.so.1.109.0 -rwxr-xr-x 1 root root 14K Dec 3 20:25 /usr/lib/libmpv.so.1.109.0

[cplayer] mpv 0.33.0-22-g84d0930fa1 Copyright © 2000-2020 mpv/MPlayer/mplayer2 projects

[junior@archlinux ~]$ python3 -c 'import mpv; print(mpv.MPV().mpv_version)' Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/site-packages/mpv.py", line 514, in backend.mpv_client_api_version.restype = c_ulong File "/usr/lib/python3.9/ctypes/init.py", line 387, in getattr func = self.getitem(name) File "/usr/lib/python3.9/ctypes/init.py", line 392, in getitem func = self._FuncPtr((name_or_ordinal, self)) AttributeError: /usr/lib/libmpv.so.1: undefined symbol: mpv_client_api_version

Archlinux python mpv package https://aur.archlinux.org/packages/python-mpv/

Best, Rafael

jaseg commented 3 years ago

I still can't reproduce this. I've tested both the latest release v0.5.2 and master on arch against arch's packaged mpv (v0.33.0-2), upstream master and the precise commit you're running (84d0930fa1) but it... just works?

If you still have this problem, could you please send me your /usr/lib/libmpv.so.1 e.g. to the email on my github account page? That file should not contain any private information beyond debug info pointing to the path where it was compiled, so it should be safe to send. I can then have a look at what went wrong with that library file.

jrch2k20 commented 3 years ago

mmm, could be my cflags that for some reason are hiding certain symbols, i'll try later on or LTO doing something.

my Flags -march=native -O2 -pipe -fno-plt -ftree-vectorize -fvisibility=hidden -flto=24

Also my Python version is 3.9, not sure if that affects something.

If persist i'll send you the packages with the compilations tries

jrch2k20 commented 3 years ago

Fixed, this was the culprit -fvisibility=hidden.

Is this known or should be reported back to mpv?

jaseg commented 3 years ago

I'm glad you found the issue!

A quick search through the mpv codebase and issues didn't show me any instances where mpv functions are explicitly marked "default"-visible or hidden, so I think it's simply nothing upstream is doing right now. mpv_client_api_version is simply the first symbol python-mpv tries to access, all other symbols in libmpv will have the same problem.

Feel free to open a PR about everything being "default"-visible with upstream. I could understand if they wouldn't want to do it because of the amount of work involved, but I think it's a reasonable proposal :)