lucianodato / noise-repellent

Lv2 suite of plugins for broadband noise reduction
GNU Lesser General Public License v3.0
463 stars 39 forks source link

Ardour segfaults when adding plugin #63

Closed cdhowie closed 4 years ago

cdhowie commented 5 years ago

When I try to add this plugin to an Ardour channel's processors, Ardour immediately segfaults. I have compiled Ardour 5.12 from source with debugging symbols and have captured the following backtrace:

#0  0x00007fffe8b97940 in hanning () at /usr/lib/x86_64-linux-gnu/libcodec2.so.0.8.1
#1  0x00007fffbc007e0e in fft_window () at /usr/local/lv2/nrepel.lv2/nrepel.so
#2  0x00007fffbc009281 in spl_reference () at /usr/local/lv2/nrepel.lv2/nrepel.so
#3  0x00007fffbc009bf0 in instantiate () at /usr/local/lv2/nrepel.lv2/nrepel.so
#4  0x00007ffff2ddf22b in lilv_plugin_instantiate () at /usr/lib/x86_64-linux-gnu/liblilv-0.so.0
#5  0x00007ffff793fe00 in ARDOUR::LV2Plugin::init(void const*, long) (this=0x5555572a9000, c_plugin=0x55555752c920, rate=48000)
    at ../libs/ardour/lv2_plugin.cc:557
#6  0x00007ffff793ed22 in ARDOUR::LV2Plugin::LV2Plugin(ARDOUR::AudioEngine&, ARDOUR::Session&, void const*, long) (this=0x5555572a9000, engine=..., 
    session=..., c_plugin=0x55555752c920, rate=48000) at ../libs/ardour/lv2_plugin.cc:369
#7  0x00007ffff794ef7b in ARDOUR::LV2PluginInfo::load(ARDOUR::Session&) (this=0x555557e718e0, session=...) at ../libs/ardour/lv2_plugin.cc:3359
#8  0x000055555625cd88 in PluginSelector::load_plugin(boost::shared_ptr<ARDOUR::PluginInfo>) (this=0x555557ae0aa0, pi=...)
    at ../gtk2_ardour/plugin_selector.cc:551
#9  0x000055555625f653 in PluginSelector::plugin_chosen_from_menu(boost::shared_ptr<ARDOUR::PluginInfo> const&) (this=0x555557ae0aa0, pi=...)
    at ../gtk2_ardour/plugin_selector.cc:951
#10 0x0000555556266111 in sigc::bound_mem_functor1<void, PluginSelector, boost::shared_ptr<ARDOUR::PluginInfo> const&>::operator()(boost::shared_ptr<ARDOUR::PluginInfo> const&) const (this=0x555557e37b30, _A_a1=...) at /usr/include/sigc++-2.0/sigc++/functors/mem_fun.h:2066
#11 0x0000555556265b2b in sigc::adaptor_functor<sigc::bound_mem_functor1<void, PluginSelector, boost::shared_ptr<ARDOUR::PluginInfo> const&> >::operator()<boost::shared_ptr<ARDOUR::PluginInfo>&>(boost::shared_ptr<ARDOUR::PluginInfo>&) const (this=0x555557e37b28, _A_arg1=...)
    at /usr/include/sigc++-2.0/sigc++/adaptors/adaptor_trait.h:89
#12 0x00005555562653e4 in sigc::bind_functor<-1, sigc::bound_mem_functor1<void, PluginSelector, boost::shared_ptr<ARDOUR::PluginInfo> const&>, boost::shared_ptr<ARDOUR::PluginInfo>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>::operator()() (this=0x555557e37b20)
    at /usr/include/sigc++-2.0/sigc++/adaptors/bind.h:1124
#13 0x000055555626488e in sigc::internal::slot_call0<sigc::bind_functor<-1, sigc::bound_mem_functor1<void, PluginSelector, boost::shared_ptr<ARDOUR::PluginInfo> const&>, boost::shared_ptr<ARDOUR::PluginInfo>, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil, sigc::nil>, void>::call_it(sigc::internal::slot_rep*)
    (rep=0x555557e37af0) at /usr/include/sigc++-2.0/sigc++/functors/slot.h:136
#14 0x00007ffff57cedc8 in Glib::SignalProxyNormal::slot0_void_callback(_GObject*, void*) () at /usr/lib/x86_64-linux-gnu/libglibmm-2.4.so.1
#15 0x00007ffff572ac8d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#16 0x00007ffff573de64 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#17 0x00007ffff57472be in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#18 0x00007ffff574797f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#19 0x00007ffff53eca4a in gtk_widget_activate () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#20 0x00007ffff52e94bd in gtk_menu_shell_activate_item () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#21 0x00007ffff52e978e in  () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#22 0x00007ffff52d71eb in  () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#23 0x00007ffff572ac8d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#24 0x00007ffff573dbbd in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#25 0x00007ffff57469ab in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#26 0x00007ffff574797f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#27 0x00007ffff53edcac in  () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#28 0x00007ffff52d548c in gtk_propagate_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#29 0x00007ffff52d587b in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#30 0x00007ffff5148bac in  () at /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0
#31 0x00007ffff5648f2e in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#32 0x00007ffff56491c8 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#33 0x00007ffff56494c2 in g_main_loop_run () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007ffff52d48e7 in gtk_main () at /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0
#35 0x00007ffff5e55332 in Gtkmm2ext::UI::run(Receiver&) (this=0x555556e36e40, old_receiver=...) at ../libs/gtkmm2ext/gtk_ui.cc:284
#36 0x0000555556063d1b in main(int, char**) (argc=1, argv=0x7fffffffc848) at ../gtk2_ardour/main.cc:426

Note that I'm using libfftw3 from Debian Buster, which is 3.3.8.

Let me know if there is any other information I can provide to help diagnose this issue.

x42 commented 5 years ago
#0  0x00007fffe8b97940 in hanning () at /usr/lib/x86_64-linux-gnu/libcodec2.so.0.8.1

should call the local method in extra-functions.c: https://github.com/lucianodato/noise-repellent/blob/9efdd0b41ec184a792087c87cbf5382f455e33ec/src/extra_functions.c#L786

Declaring those helper functions static should fix this issues. The plugin should also be compiled with -fvisibility-hidden.

Otherwise, since plugins a shared objects, functions like hamming or hanning are exposed in the global namespace, or methods already present there in are used instead.

cdhowie commented 5 years ago

I've tested and the PR does resolve the issue for me.