altdesktop / playerctl

🎧 mpris media player command-line controller for vlc, mpv, RhythmBox, web browsers, cmus, mpd, spotify and others.
GNU Lesser General Public License v3.0
2.42k stars 79 forks source link

player:ctl symbol lookup error on most commands #191

Open carlblomqvist opened 3 years ago

carlblomqvist commented 3 years ago

The player I am using is chrome (spotify web player).

However, this happens for all players.

playerctl: symbol lookup error: playerctl: undefined symbol: pctl_player_get_instance

I can do playerctl -p and see my instance, but if I do play-pause or any other command that interacts with the player I get this error. I was thinking it had something to do with libplayerctl2 missing, but it is installed.

acrisci commented 3 years ago

What is your distro and how did you install playerctl? What does playerctl -v say?

Xyene commented 3 years ago

Just ran into this while installing playerctl from master on Debian Buster. The issue seems to occur only when installing it into /usr/local/bin; running it from the build directory doesn't fail.

(master) xyene@lynwood:/code/playerctl$ git rev-parse --short HEAD
9b49fd7
(master) xyene@lynwood:/code/playerctl$ meson build -Dgtk-doc=false                                                                        
The Meson build system
Version: 0.54.3
Source dir: /code/playerctl
Build dir: /code/playerctl/build
Build type: native build
Project name: playerctl
Project version: 2.2.1
C compiler for the host machine: cc (gcc 8.3.0 "cc (Debian 8.3.0-6) 8.3.0")
C linker for the host machine: cc ld.bfd 2.34
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (0.29)
Run-time dependency gobject-2.0 found: YES 2.58.3
Run-time dependency gio-unix-2.0 found: YES 2.58.3
Run-time dependency glib-2.0 found: YES 2.58.3
Run-time dependency bash-completion found: YES 2.8
Configuring playerctl-version.h using configuration
Found pkg-config: /usr/bin/pkg-config (0.29)
Run-time dependency gobject-introspection-1.0 found: YES 1.58.3
Configuring org.mpris.MediaPlayer2.playerctld.service using configuration
Configuring playerctl.1 using configuration
Build targets in project: 10

Found ninja-1.10.0 at /usr/bin/ninja
(master) xyene@lynwood:/code/playerctl$ ninja -C build                                                                                                   
ninja: Entering directory `build'
[21/22] Generating Playerctl-2.0.gir with a custom command
g-ir-scanner: link: cc -o /code/playerctl/build/tmp-introspect37rodx1k/Playerctl-2.0 /code/playerctl/build/tmp-introspect37rodx1k/Playerctl-2.0.o -L. -Wl,-rpath,. -Wl,--no-as-needed -L/code/playerctl/build/playerctl -Wl,-rpath,/code/playerctl/build/playerctl -lplayerctl -lgobject-2.0 -lglib-2.0 -lgio-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0
[22/22] Generating Playerctl-2.0.typelib with a custom command            
(master) xyene@lynwood:/code/playerctl$ sudo ninja -C build install                                                                                      
ninja: Entering directory `build'
[0/1] Installing files.
Installing playerctl/playerctl-enum-types.h to /usr/local/include/playerctl
Installing playerctl/libplayerctl.so.2.2.1 to /usr/local/lib/x86_64-linux-gnu
Installing playerctl/libplayerctl.a to /usr/local/lib/x86_64-linux-gnu
Installing playerctl/playerctl to /usr/local/bin
Installing playerctl/playerctld to /usr/local/bin
Installing playerctl/Playerctl-2.0.gir to /usr/local/share/gir-1.0
Installing playerctl/Playerctl-2.0.typelib to /usr/local/lib/x86_64-linux-gnu/girepository-1.0
Installing /code/playerctl/playerctl/playerctl.h to /usr/local/include/playerctl
Installing /code/playerctl/playerctl/playerctl-player.h to /usr/local/include/playerctl
Installing /code/playerctl/playerctl/playerctl-player-manager.h to /usr/local/include/playerctl
Installing /code/playerctl/playerctl/playerctl-player-name.h to /usr/local/include/playerctl
Installing /code/playerctl/build/playerctl/playerctl-version.h to /usr/local/include/playerctl
Installing /code/playerctl/build/doc/playerctl.1 to /usr/local/share/man/man1
Installing /code/playerctl/build/meson-private/playerctl.pc to /usr/local/lib/x86_64-linux-gnu/pkgconfig
Installing /code/playerctl/build/data/org.mpris.MediaPlayer2.playerctld.service to /usr/local/share/dbus-1/services

The error:

(master) xyene@lynwood:/code/playerctl$ /usr/local/bin/playerctl -v
v2.2.1
(master) xyene@lynwood:/code/playerctl$ /usr/local/bin/playerctl metadata --player=spotify --format '{{lc(status)}}'                                     
/usr/local/bin/playerctl: symbol lookup error: /usr/local/bin/playerctl: undefined symbol: pctl_player_get_instance

Running out of build works:

(master) xyene@lynwood:/code/playerctl$ ./build/playerctl/playerctl -v                                                                                   
v2.2.1
(master) xyene@lynwood:/code/playerctl$ ./build/playerctl/playerctl metadata --player=spotify --format '{{lc(status)}}'                                  
playing

The playerctl binary in build and /usr/local/bin have the same BuildID...

(master) xyene@lynwood:/code/playerctl$ file /usr/local/bin/playerctl ./build/playerctl/playerctl
/usr/local/bin/playerctl:    ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4199e3929aac68a8cfa9f6f3b643cea6ad8dcea4, for GNU/Linux 3.2.0, with debug_info, not stripped
./build/playerctl/playerctl: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=4199e3929aac68a8cfa9f6f3b643cea6ad8dcea4, for GNU/Linux 3.2.0, with debug_info, not stripped

...but not the same hashes:

(master) xyene@lynwood:/code/playerctl$ md5sum /usr/local/bin/playerctl build/playerctl/playerctl
fe44c5d2a8e7745b969e919a60b82e8e  /usr/local/bin/playerctl
c156f09c0c79ac3d1a7f33cc7973def0  build/playerctl/playerctl
acrisci commented 3 years ago

Are the libraries in your path? export LD_LIBRARY_PATH=/usr/local/lib/x86_64-linux-gnu

Xyene commented 3 years ago

They are, but your comment was on the right path and led to a solution -- thanks.

Default search paths do include /usr/local/lib/x86_64-linux-gnu:

$ \cat /etc/ld.so.conf.d/*                                                                                                   
/usr/lib/x86_64-linux-gnu/libfakeroot
# Multiarch support
/usr/local/lib/i386-linux-gnu
/lib/i386-linux-gnu
/usr/lib/i386-linux-gnu
/usr/local/lib/i686-linux-gnu
/lib/i686-linux-gnu
/usr/lib/i686-linux-gnu
# libc default configuration
/usr/local/lib
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu
# Legacy biarch compatibility support
/lib32
/usr/lib32

But it looks like calling ldconfig after installation is necessary to get things working.

xyene@lynwood:~$ /usr/local/bin/playerctl metadata --player=spotify --format '{{lc(status)}}'                                                            
/usr/local/bin/playerctl: symbol lookup error: /usr/local/bin/playerctl: undefined symbol: pctl_player_get_instance
xyene@lynwood:~$ sudo ldconfig                                                                                                                           
xyene@lynwood:~$ /usr/local/bin/playerctl metadata --player=spotify --format '{{lc(status)}}'                                                            
playing
carlblomqvist commented 3 years ago

What is your distro and how did you install playerctl? What does playerctl -v say?

Distro is Ubuntu 18.04 LTS

I installed it from the .deb packages: libplayerctl2_2.0.2-1_amd64.deb playerctl-2.2.1_amd64.deb

So I have

 â–³ ~ playerctl -v
v2.2.1

My library path is correct:

 â–² ~ locate libplayerctl.so.2
/usr/lib/libplayerctl.so.2
/usr/lib/libplayerctl.so.2.2.1
/usr/lib/x86_64-linux-gnu/libplayerctl.so.2
/usr/lib/x86_64-linux-gnu/libplayerctl.so.2.0.2
 â–² ~ cat /etc/ld.so.conf.d/*
/usr/lib/x86_64-linux-gnu/libfakeroot
# libc default configuration
/usr/local/lib
# Multiarch support
/usr/local/lib/x86_64-linux-gnu
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu

Running sudo ldconfig did not resolve the problem for me

acrisci commented 3 years ago

I think my deb package might be broken. I'll try to fix that soon.

carlblomqvist commented 3 years ago

I'll wait for your updated package. Thank you!

skorokithakis commented 3 years ago

I am running into the same error.

acrisci commented 3 years ago

I can't reproduce this on ubuntu 20.04. The deb package works fine for me.

carlblomqvist commented 3 years ago

Is there anything I can do to help you debug this for Ubuntu 18.04, where it seems to not work?

acrisci commented 3 years ago

Can I provide you a different way to install the project other than a deb file? I don't want to support that anymore. Would you be ok using a snap instead? https://snapcraft.io/store

skorokithakis commented 3 years ago

Would maybe compiling the binary statically solve the problem? Is that hard to do?

gauthamp10 commented 3 years ago

I'm using debian 10 buster and I'm getting the same error on v2.2.1. Downgraded to v2.0.1 and it solved.

acrisci commented 3 years ago

I have a snap package now you can get with snap install --edge playerctl.

ginsterbusch commented 3 years ago

its now broken on Ubuntu 20.04(.2) LTS, too.

I have a snap package now you can get with snap install --edge playerctl. and snap packages tend to either break half of the system or not work at all .. so .. nah. This is my workstation = it needs to WORK. Guess I downgrade for now, and figure out compiling it myself when I got time to spare (roughly in 2025).

cu, w0lf.

edi9999 commented 2 years ago

I still have the same problem even with the latest version, using following commands :

version="2.4.1"
f="playerctl-$version.deb"
curl -sSL "https://github.com/altdesktop/playerctl/releases/download/v${version}/playerctl-${version}_amd64.deb" > "$f"
sudo dpkg -i "$f"

playerctl -v 
# shows : v2.4.1 

playerctl status 
# shows : playerctl: symbol lookup error: playerctl: undefined symbol: pctl_player_get_instance

Additional info :

locate libplayerctl.so.2

/usr/lib/x86_64-linux-gnu/libplayerctl.so.2
/usr/lib/x86_64-linux-gnu/libplayerctl.so.2.0.2

cat /etc/ld.so.conf.d/* | grep linux-gnu

/usr/lib/x86_64-linux-gnu
acrisci commented 2 years ago

If you install both the deb I provide and from your package manager one after the other, it will break. Uninstall the system version, then purge the installation with apt purge to remove all the files of the system installation.

edi9999 commented 2 years ago

That is working indeed !

Maybe this issue can be closed since this seems to be a working solution ?