loskutov / deadbeef-lyricbar

A simple plugin for DeaDBeeF audio player that fetches and shows the song’s lyrics
MIT License
29 stars 8 forks source link

Using the plugin with the latest deadbeef master #2

Closed yunake closed 8 years ago

yunake commented 8 years ago

First of all, thank you for this excellent plugin, I've been using it for a while now.

I've encountered some crashes when trying to update lyrics on some of my (potentially ill-formed) files, here's a backtrace:

Thread 15 "deadbeef-main" received signal SIGABRT, Aborted.
[Switching to Thread 0x7fffb65f4700 (LWP 31059)]
0x00007ffff734a04f in raise () from /usr/lib/libc.so.6
(gdb) bt
#0  0x00007ffff734a04f in raise () from /usr/lib/libc.so.6
#1  0x00007ffff734b47a in abort () from /usr/lib/libc.so.6
#2  0x00007fffec37f4bd in __gnu_cxx::__verbose_terminate_handler () at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/vterminate.cc:95
#3  0x00007fffec37d276 in __cxxabiv1::__terminate (handler=<optimized out>) at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47
#4  0x00007fffec37d2c1 in std::terminate () at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57
#5  0x00007fffec37d4d8 in __cxxabiv1::__cxa_throw (obj=obj@entry=0x7fff980012c0, tinfo=0x7fffec668a38 <typeinfo for std::logic_error>, 
    dest=0x7fffec392cc0 <std::logic_error::~logic_error()>) at /build/gcc-multilib/src/gcc/libstdc++-v3/libsupc++/eh_throw.cc:87
#6  0x00007fffec3a6caf in std::__throw_logic_error (__s=__s@entry=0x7fffec42a610 "basic_string::_M_construct null not valid")
    at /build/gcc-multilib/src/gcc/libstdc++-v3/src/c++11/functexcept.cc:74
#7  0x00007fffec414384 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (
    this=this@entry=0x7fffb65f3ef0, __beg=__beg@entry=0x0, __end=<optimized out>)
    at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.tcc:212
#8  0x00007fffec41453c in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*> (
    __end=<optimized out>, __beg=0x0, this=0x7fffb65f3ef0)
    at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:196
#9  std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=<optimized out>, __beg=0x0, 
    this=0x7fffb65f3ef0) at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:215
#10 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (this=0x7fffb65f3ef0, __s=0x0, __a=...)
    at /build/gcc-multilib/src/gcc-build/x86_64-pc-linux-gnu/libstdc++-v3/include/bits/basic_string.h:456
#11 0x00007fffee58c435 in update_lyrics(void*) () from /home/yunake/.local/lib64/deadbeef/ddb_lyricbar_gtk2.so
#12 0x00007ffff76bc454 in start_thread () from /usr/lib/libpthread.so.0
#13 0x00007ffff73ff7df in clone () from /usr/lib/libc.so.6

This is on deadbeef master and lyricbar built from master around March I think. I've ignored them for a while but I had some free time today and decided to investigate. First things first I thought, lets update! I updated to the current deadbeef master without problems. After a while I managed to compile the latest lyricbar master using the fix from #1.

Right now though the plugin can't be loaded, with the following message:

load_plugin_dir /home/yunake/.local/lib64/deadbeef: scandir found 4 files
loading plugin /home/yunake/.local/lib64/deadbeef/ddb_lyricbar_gtk3.so
dlsym error: (null) (_lyricbar_gtk3_load)
plugin not found or failed to load

Current Makefile generates ddb_lyricbar.so, but if I'm reading deadbeef's plugins.c correctly, it expects the entry symbol to be PLUGINFILENAME_load:

    void *handle = dlopen (fullname, RTLD_NOW);
    d_name[l-sizeof (PLUGINEXT)+1] = 0;
    strcat (d_name, "_load");
    DB_plugin_t *(*plug_load)(DB_functions_t *api) = dlsym (handle, d_name+3);

lyricbar defines ddb_lyricbar_gtk2_load() so I tried renaming the file to ddb_lyricbar_gtk2.so. This allows the plugin to load successfully (well, at least it does not produce any error messages or crashes), but the main GTK thread seems to be stalled and stuffed immediately and no deadbeef window appears:

$ deadbeef
<SNIP>
searching for GUI plugins in /home/yunake/.local/lib64/deadbeef
load_plugin_dir /home/yunake/.local/lib64/deadbeef: scandir found 4 files
searching for GUI plugins in /home/yunake/.local/lib/deadbeef
searching for GUI plugins in /usr/lib/deadbeef
load_plugin_dir /usr/lib/deadbeef: scandir found 66 files
found gui plugin ddb_gui_GTK2.so
added GTK2 gui plugin
load gui plugin
checking GUI plugin: GTK2
found selected GUI plugin: GTK2
loading plugin /usr/lib/deadbeef/ddb_gui_GTK2.so
loading plugins from /home/yunake/.local/lib64/deadbeef
load_plugin_dir /home/yunake/.local/lib64/deadbeef: scandir found 4 files
loading plugin /home/yunake/.local/lib64/deadbeef/ddb_lyricbar_gtk2.so
loading plugins from /home/yunake/.local/lib/deadbeef

<SNIP>

gtkui plugin compiled for gtk version: 2.24.30
connecting button tray signals

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkCursor'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkDevice'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplay'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkDisplayManager'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkDragContext'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkScreen'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkVisual'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

(deadbeef:5940): GLib-GObject-WARNING **: cannot register existing type 'GdkWindow'

(deadbeef:5940): GLib-CRITICAL **: g_once_init_leave: assertion 'result != 0' failed

<HANGS HERE>
^C

Any hint on how to further debug this would be appreciated :)

yunake commented 8 years ago

i've just tried renaming the entry function and it produces the same result as renaming the file.

loskutov commented 8 years ago

I guess that's because main.c links against gtkmm-2.4. Sorry for breaking the master, I'll fix it soon.

yunake commented 8 years ago

thank you for your swift response, you are awesome!

does this mean gtk2 backend is no longer supported?

lyricbar-gtk3: can't find gtkui plugin
plugin Lyricbar failed to connect to dependencies, deactivated.
loskutov commented 8 years ago

It means that master is still pretty much broken :(

loskutov commented 8 years ago

I've fixed the Makefile, please check if it works properly.

yunake commented 8 years ago

It almost does :)

I think second GTKMM should be GTK, copy-paste error?

Also, on my Arch system gtk+2.4 installs itself as gtk+2.0 for pkg-config, not sure if this is universal? Can't test on a different system right now.

The following diff does it for me:

diff --git a/Makefile b/Makefile
index 4ff842a..ffc6f47 100644
--- a/Makefile
+++ b/Makefile
@@ -9,7 +9,7 @@ gtk3: LYRICBAR=ddb_lyricbar_gtk3.so
 gtk3: lyricbar

 gtk2: GTKMM=gtkmm-2.4
-gtk2: GTKMM=gtk+-2.4
+gtk2: GTK=gtk+-2.0
 gtk2: LYRICBAR=ddb_lyricbar_gtk2.so
 gtk2: lyricbar

thank you for all your help with this mate!