Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some of bundled LADSPA plugin causes crash on some system #4030

Closed
Martin1995 opened this issue Dec 2, 2017 · 29 comments
Closed

Some of bundled LADSPA plugin causes crash on some system #4030

Martin1995 opened this issue Dec 2, 2017 · 29 comments
Labels
Milestone

Comments

@Martin1995
Copy link

Martin1995 commented Dec 2, 2017

if i try to start lmms on my Arch Linux it crashes after the splashscreen since today.
The console gives me a little bit more output:

Edited by tresf, added backtrace:

#14 0x00007ffff69254b9 in QLibrary::resolve(char const*) () at /usr/lib/libQtCore.so.4
#15 0x00005555556e7556 in disableAutoKeyAccelerators(QWidget*) (mainWindow=mainWindow@entry=0x555555d29e50) at /home/martin/lmms-build/lmms/src/gui/MainWindow.cpp:75
        kf5WidgetsAddon = <incomplete type>
        setNoAccelerators = <optimized out>
#16 0x00005555556e8dd9 in MainWindow::MainWindow() (this=0x555555d29e50) at /home/martin/lmms-build/lmms/src/gui/MainWindow.cpp:96
/usr/lib/lmms/ladspa/tap_dynamics_m.so: undefined symbol: _ZGVbN4v___expf_finite 
(/usr/lib/lmms/ladspa/tap_dynamics_st.so: undefined symbol: _ZGVbN4v___expf_finite)
(/usr/lib/lmms/ladspa/tap_sigmoid.so: undefined symbol: _ZGVbN2v___exp_finite)
VST_PATH not set, defaulting to /home/$username/vst:/usr/local/lib/vst:/usr/lib/vst

can you help me please, because the git version was the better running solution for my system.

@tresf
Copy link
Member

tresf commented Dec 2, 2017

@Martin1995, lmms-git isn't a package we maintain, so this is really a question for whoever maintains that package.

That said, we have made some changes to TAP plugins very recently, so that's a good place to start looking. #3960

If you think some programmers can help you iron this out locally, we have a dedicated #support channel on discord here: https://lmms.io/chat

@Martin1995
Copy link
Author

While trying to reinstall lmms i had looked a littlebit around inside the PKGBUILD file that is used on every version of Arch to install it from the user repository and it seems that is using the latest sources from github
"git://github.com/LMMS/lmms.git" (thats the cloning source for the Package that the package manager uses)

@tresf
Copy link
Member

tresf commented Dec 3, 2017

That [git branch] changes with time. It's currently stable-1.2 branch but will switch back to master when stable-1.2 is released.

The stable-1.2 branch is a good branch to run, it's modern and stable, however this doesn't really help point at the problem.

When an undefined symbol occurs it's often a sign that a precompiled binary has changed. Since we do not yet offer any precompiled binaries for Linux we can't own this bug.

As a temporary measure, you can move the tap plugins out of the way. LMMS does not require them to run.

If you can reproduce this when building [manually] from source, it would help us identify it. This would help us gather more information about your build environment.

@Martin1995
Copy link
Author

ok i will try this tomorrow

@Martin1995
Copy link
Author

If i'm trying to build it directly from github then i get some config errors out of cmake (see attached txt-file)
log-lmms_build.txt
but the package from whoever uploaded it compiles fine but lmms crashes and closes after the splash

@tresf
Copy link
Member

tresf commented Dec 4, 2017

@Martin1995, git submodule update --init --recursive will solve that problem.

@Martin1995
Copy link
Author

ok my fault, im not so familiar with git, because i'm not a programmer i only tinker around with arduino and shell scripts.
Thank you for the help now it compiles fine without any error

@tresf
Copy link
Member

tresf commented Dec 5, 2017

ok my fault, im not so familiar with git, because i'm not a programmer i only tinker around with arduino and shell scripts.

That's fine, submodules are not very intuitive to deal with in git yet. Thanks for the update.

@tresf tresf closed this as completed Dec 5, 2017
@Martin1995
Copy link
Author

Martin1995 commented Dec 5, 2017

oh i forgot testing the software itself, compiling worked now but if i start the software three errors are gone but the software crashes anyway. i think libQt5Core.so.5 is the culprit but im not sure backtrace
gdb-backtrace-full-lmms-2017-12-05.txt
sorry @tresf

@tresf
Copy link
Member

tresf commented Dec 5, 2017

@Martin1995 thanks for the backtrace. This is a regression caused by #3872. I'm tagging @BumblingCoder and reopening.

@tresf tresf reopened this Dec 5, 2017
@tresf tresf changed the title LMMS-GIT crashes on startup (Arch Linux [LTS-Kernel]) LMMS crashes on startup Dec 5, 2017
@PhysSong
Copy link
Member

PhysSong commented Dec 6, 2017

undefined symbol: _ZGVbN4v___expf_finite

I got similar crash when I tried to load TAP Dynamics (St). This occurs if I compile LMMS with gcc from ubuntu-toolchain-r/test. It was fine with default gcc shipped with Ubuntu 16.04. So I need to manually relink plugins with libm.

@tresf
Copy link
Member

tresf commented Dec 6, 2017

As @PhysSong has illustrated, the TAP issue is a much less severe error that happened to appear before the segfault, it should be handled as a standalone plugin and not segfault LMMS. So there were actually two unrelated issues in the same bug report.

We'll leave open so that the TAP issue can be confirmed as fixed as well. @PhysSong thanks for the background info on the compiler.

@Martin1995
Copy link
Author

Oh i hadn't known that you also have a precompiled portable version, just downloaded it and the portable version works fine on Arch. I think i have also to ask for help in the Arch Linux forum, somebody could also know a way to fix this Problem on Arch.

@Martin1995
Copy link
Author

Problem was solved by itselft, i don't know how and actually what cuased the Problemn, but i'm happy that LMMS works again.

Thank you all for your help.
I think some Package had caused some problem and this package got eventually updated

@PhysSong
Copy link
Member

I can reproduce the undefined symbol: _ZGVbN4v___expf_finite issue with Ubuntu 18.04, gcc 7.3.0 when I try to open unfa-spoken.mmp. One should be able to reproduce it with latest AppImage from CircleCI. I guess we need to link math library for the plugin.
Related: owlbarn/owl#61

@PhysSong PhysSong reopened this Apr 29, 2018
@PhysSong PhysSong added this to the 1.2.0 milestone Apr 29, 2018
@musikBear
Copy link

musikBear commented Apr 29, 2018

@PhysSong - a question - if you open 'spoken.mmp' in a code-editor, and changes all 'open==1' to 'open==0' -eg closes all sub-window, what happen then, if you try to open that project in lmms

@PhysSong
Copy link
Member

It's related to LADSPA plugin build issue with new compilers, so that's not related.

@PhysSong PhysSong removed this from the 1.2.0 milestone Apr 29, 2018
@PhysSong
Copy link
Member

For some reason, It seems to work fine on stable-1.2 and be broken on master. COMPILE_FLAGS property doesn't seem to be applied properly on stable-1.2 and dropping -ffast-math fixes the issue.
If we still need the flag, I guess we need to link math library. I don't know if it can cause any issues.

@PhysSong PhysSong changed the title LMMS crashes on startup Some of bundled LADSPA plugin causes crash on some system Apr 29, 2018
@Reflexe
Copy link
Member

Reflexe commented May 10, 2018

It could be solved by this patch:

diff --git a/plugins/LadspaEffect/tap/CMakeLists.txt b/plugins/LadspaEffect/tap/CMakeLists.txt
index 0ae8ae54e..fd017555d 100644
--- a/plugins/LadspaEffect/tap/CMakeLists.txt
+++ b/plugins/LadspaEffect/tap/CMakeLists.txt
@@ -12,16 +12,10 @@ FOREACH(_item ${PLUGIN_SOURCES})
        INSTALL(TARGETS "${_plugin}" LIBRARY DESTINATION "${PLUGIN_DIR}/ladspa")
        SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES PREFIX "")
        # Don't strip if "Debug" or "RelWithDebInfo"
-       IF(LMMS_BUILD_APPLE)
-               SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS} -Bsymbolic -lm")
-       ELSEIF(NOT LMMS_BUILD_OPENBSD)
-               SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -Wl,-no-undefined -Wl,-Bsymbolic -lm")
-       ENDIF()
-       IF(LMMS_BUILD_LINUX OR LMMS_BUILD_HAIKU)
-               SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES LINK_FLAGS "${LINK_FLAGS}")
-       ENDIF()
+
+        target_link_libraries ("${_plugin}" m)
 ENDFOREACH()

We basically have to use target_link_libraries instead of manually adding link flags. It changes the position of the flags in the command and make sure other targets that depends on this library get its flags too.

@PhysSong
Copy link
Member

Recent gcc compiler use vector math when both -ffast-math and -O3 is specified. These functions are implemented in libmvec(provided by glibc >= 2.22).
LMMS binary is linked against math library, so not linking math library is generally not an issue on POSIX systems. However, gcc doesn't link libmvec when -lm is passed unless vectorized functions are used.
Now there's a problem: some TAP/SWH plugin requires vectorized math functions, but LMMS itself doesn't. So references to such functions couldn't be resolved on runtime.
@Reflexe your patch looks good. I think SWH needs similar changes(a few plugins including SC1 cause crash, too).

Notes about dropped flags:

  • -shared is automatically added by CMake
  • -Wl,-no-undefined isn't needed because DLLs can't have undefined symbols
  • -Bsymbolic has some effects, but I think dropping it won't break stuffs.

@Reflexe
Copy link
Member

Reflexe commented May 10, 2018

@PhysSong Thanks for the detailed explanation; However, the same error still exist when specifically adding -lm.

This is the command before my patch (no libmvec):

> /usr/bin/gcc -fPIC -Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow -Wno-array-bounds  -O3 -Wno-write-strings -fomit-frame-pointer -fno-strict-aliasing -funroll-loops -ffast-math -g -DLMMS_DEBUG  -lm -shared  -o plugins/ladspa/tap_autopan.so plugins/LadspaEffect/tap/CMakeFiles/tap_autopan.dir/tap-plugins/tap_autopan.c.o
> ldd plugins/ladspa/tap_autopan.so 
	linux-vdso.so.1 (0x00007ffd89962000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f182a737000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f182a37b000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f182acd0000)

And this is after my patch (have libmvec):

> /usr/bin/gcc -fPIC -Wall -Werror=unused-function -Wno-sign-compare -Wno-strict-overflow -Wno-array-bounds  -O3 -Wno-write-strings -fomit-frame-pointer -fno-strict-aliasing -funroll-loops -ffast-math -g -DLMMS_DEBUG   -shared  -o plugins/ladspa/tap_autopan.so plugins/LadspaEffect/tap/CMakeFiles/tap_autopan.dir/tap-plugins/tap_autopan.c.o  -lm 
> ldd plugins/ladspa/tap_autopan.so 
	linux-vdso.so.1 (0x00007ffcb4afa000)
	libm.so.6 => /usr/lib/libm.so.6 (0x00007f5f72977000)
	libmvec.so.1 => /usr/lib/libmvec.so.1 (0x00007f5f7274d000)
	libc.so.6 => /usr/lib/libc.so.6 (0x00007f5f72391000)
	/usr/lib64/ld-linux-x86-64.so.2 (0x00007f5f72f10000)

Am I missing another difference other than the place of -lm?
I think we just found another compiler mystery :D

@PhysSong
Copy link
Member

Am I missing another difference other than the place of -lm?

No, that's THE reason. Some compiler/linker flags may lead to different results when their places are changed. In this case, -lm should be passd after relevant object files are specified. That's strange but how gcc works...

@Reflexe Do you have this issue on master(and branches based on it) only? I've never seen this issue on stable-1.2 though.

@Reflexe
Copy link
Member

Reflexe commented Jun 16, 2018

@PhysSong I do have the problem with the current master (1bdaafc). However, stable-1.2 does crash to on the start ("double free or corruption (out)").

@PhysSong
Copy link
Member

@Reflexe Do you have a backtrace for stable-1.2 crash? If you have some master-only plugins(Freeboy, OpulenZ, Xpressive) in your plugin directory, you need to delete them first.

@Reflexe
Copy link
Member

Reflexe commented Jun 17, 2018

@PhysSong

#0  0x00007ffff3db186b in raise () at /usr/lib/libc.so.6
#1  0x00007ffff3d9c40e in abort () at /usr/lib/libc.so.6
#2  0x00007ffff3df38b8 in __libc_message () at /usr/lib/libc.so.6
#3  0x00007ffff3df9d4a in  () at /usr/lib/libc.so.6
#4  0x00007ffff3dfa2a4 in  () at /usr/lib/libc.so.6
#5  0x00007fffa1196777 in delete_descriptor (descriptor=0x555555f5d620)
    at /home/reflexe/Packs/lmms_clean/lmms/plugins/LadspaEffect/tap/tap_autopan.c:330
#6  0x00007ffff7debebd in _dl_close_worker () at /lib64/ld-linux-x86-64.so.2
#7  0x00007ffff7deac70 in _dl_open () at /lib64/ld-linux-x86-64.so.2
#8  0x00007ffff5baee66 in  () at /usr/lib/libdl.so.2
#9  0x00007ffff3eae94f in _dl_catch_exception () at /usr/lib/libc.so.6
#10 0x00007ffff3eae9df in _dl_catch_error () at /usr/lib/libc.so.6
#11 0x00007ffff5baf597 in  () at /usr/lib/libdl.so.2
#12 0x00007ffff5baef06 in dlopen () at /usr/lib/libdl.so.2
#13 0x00007ffff6929548 in  () at /usr/lib/libQtCore.so.4
#14 0x00007ffff6924319 in  () at /usr/lib/libQtCore.so.4
#15 0x00005555556c53a0 in LadspaManager::LadspaManager() (this=0x555555e39590)
    at /home/reflexe/Packs/lmms_clean/lmms/src/core/LadspaManager.cpp:82
#16 0x00005555556c2cae in Ladspa2LMMS::Ladspa2LMMS() (this=0x555555e39590)
    at /home/reflexe/Packs/lmms_clean/lmms/src/core/Ladspa2LMMS.cpp:30
#17 0x00005555556acf0f in LmmsCore::init(bool) (renderOnly=false)
    at /home/reflexe/Packs/lmms_clean/lmms/src/core/Engine.cpp:64
#18 0x0000555555745590 in GuiApplication::GuiApplication() (this=0x555555db55a0) at /home/reflexe/Packs/lmms_clean/lmms/src/gui/GuiApplication.cpp:115
#19 0x00005555556815a5 in main(int, char**) (argc=1, argv=0x7fffffffe888) at /home/reflexe/Packs/lmms_clean/lmms/src/core/main.cpp:756

It would only happen when I compile lmms from the console with make or Ninja:

$ cmake .
$ make -j12
$ ./lmms

Comping with QtCreator is ok.

@PhysSong
Copy link
Member

Strange. I'll try 1.2 with from both manual cmake/make and QtCreator.

@PhysSong
Copy link
Member

Test summary:

  • TAP: Crashes both stable-1.2 and master for gcc 8
  • SWH: Crashes master for gcc 7 and 8(stable-1.2 works fine)

@PhysSong PhysSong added this to the 1.2.0 milestone Jun 17, 2018
@Reflexe
Copy link
Member

Reflexe commented Jun 17, 2018

@PhysSong The difference between QtCreator and manually running cmake was probably the compiler (QtCreator: Clang, Default: Gcc)

@PhysSong
Copy link
Member

It seems like we're setting compiler flags for SWH in 1.2 in wrong way. The second SET_TARGET_PROPERTIES overrides setting added by first one, instead of appending. Also,
-c here looks like a mistake because it means "Do not link" and has no meaning here.

SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "-O3 -Wall -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -c -fno-strict-aliasing")
IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET "${_plugin}" POST_BUILD COMMAND "${STRIP}" \"$<TARGET_FILE:${_plugin}>\")
ELSE(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES("${_plugin}" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC -DPIC")

As of CMake 2.8.12, TARGET_COMPILE_OPTIONS is available for setting per-target compiler flags and old approach(using COMPILE_FLAGS property) is deprecated. I think we should switch to this one in master(not stable-1.2 due to compatibility issues).

We basically have to use target_link_libraries instead of manually adding link flags. It changes the position of the flags in the command and make sure other targets that depends on this library get its flags too.

Agreed. That works for old version of CMake, too.

For some issues with adding flags/libraries, I opened a new issue #4430.

  • -Wl,-no-undefined isn't needed because DLLs can't have undefined symbols

I found that libtool requires it, but we don't use it anymore. Now we can safely drop this.

mojofunk added a commit to mojofunk/lmms that referenced this issue Jun 21, 2018
Add math library using target_link_libraries instead of setting LINK_FLAGS
properties with target_link_libraries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants