Crash when execute plugins that bring up window in Linux AppImage (i686 & x86-64, including CentOS 6.7)

• Mar 7, 2016 - 18:09
Type
Functional
Severity
S3 - Major
Status
closed
Project

on Parabola linux fresh install, running AppImage. Crash (SIGABORT) when try to execute a plugin. The small window very briefly displayes, but then crash.

Note: I'm able to use plugin manager and plugin creator just fine, but the crash only occurs when executing plugin.

Note: I'm able to run regular non-AppImage just fine without plugin crashing.

Attached is gdb backtrace of AppImage (with debug symbols included). The crash is a SIGABORT in Thread 1:

Thread 1 (Thread 0x7fb000397800 (LWP 20503)):
#0  0x00007fb00c19f2a8 in raise () from /usr/lib/libc.so.6
#1  0x00007fb00c1a072a in abort () from /usr/lib/libc.so.6
#2  0x00007fb00cb381e1 in QMessageLogger::fatal(char const*, ...) const () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Core.so.5
#3  0x00007fb0106e5b61 in QSGRenderLoop::handleContextCreationFailure(QQuickWindow*, bool) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Quick.so.5
#4  0x00007fb0106e6b75 in ?? () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Quick.so.5
#5  0x00007fb0106e7b16 in ?? () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Quick.so.5
#6  0x00007fb00d075455 in QWindow::event(QEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Gui.so.5
#7  0x00007fb010721081 in QQuickWindow::event(QEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Quick.so.5
#8  0x00007fb00d61e9ac in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Widgets.so.5
#9  0x00007fb00d623e86 in QApplication::notify(QObject*, QEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Widgets.so.5
#10 0x00007fb00cd2bbab in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Core.so.5
#11 0x00007fb00d06d5bc in QGuiApplicationPrivate::processExposeEvent(QWindowSystemInterfacePrivate::ExposeEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Gui.so.5
#12 0x00007fb00d06e32d in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Gui.so.5
#13 0x00007fb00d0536d8 in QWindowSystemInterface::sendWindowSystemEvents(QFlags) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Gui.so.5
#14 0x00007fb00001d8c0 in ?? () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5XcbQpa.so.5
#15 0x00007fb009b64d87 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#16 0x00007fb009b64fe0 in ?? () from /usr/lib/libglib-2.0.so.0
#17 0x00007fb009b6508c in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#18 0x00007fb00cd8254f in QEventDispatcherGlib::processEvents(QFlags) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Core.so.5
#19 0x00007fb00cd2957a in QEventLoop::exec(QFlags) () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Core.so.5
#20 0x00007fb00cd3153c in QCoreApplication::exec() () from /home/e/MuseScore/build.debug/MuseScore-.AppDir/lib/qt5/lib/libQt5Core.so.5
#21 0x0000000000bf853f in main (argc=1, av=0x7ffcc51213f8) at /home/e/MuseScore/mscore/musescore.cpp:5162

and here is the console output:

[e@m4500 MuseScore-.AppDir]$ ./AppRun 
initScoreFonts 0x4192b90
init Help from: 
qml: C, 60
qml: Richter (Blues Harp), 1
qml: Above staff, 0
AlsaDriver::write: snd_pcm_avail_update() (Broken pipe)
AlsaDriver: recover: stat = 00, xrun of at least  248.600 ms
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
QNetworkReplyImplPrivate::error: Internal problem, this method must only be called once.
QObject::connect: Cannot connect (null)::stateChanged(QNetworkSession::State) to QNetworkReplyHttpImpl::_q_networkSessionStateChanged(QNetworkSession::State)
qml: C, 60
qml: Richter (Blues Harp), 1
qml: Above staff, 0
qml: C, 60
qml: Richter (Blues Harp), 1
qml: Above staff, 0
QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile  0) 
./AppRun: line 14: 20811 Aborted                 (core dumped) "${APPDIR}/bin/mscore-portable" "$@"

Comments

I remember ArchLinux working with plugins, so might have something to do with non-free libraries (Parabola is free-software only).

Or might have something to do with window rendering (I say that because seems similar to previous issue with nativeDialogs).

Just to confirm: plugin manager works fine, plugin appears in Plugin menu (next to Help menu) like it should, but when you click select it from the plugin menu you get a crash?

Also, is anything missing if you run this? MuseScore*.AppImage check-depends

Just to confirm: plugin manager works fine, plugin appears in Plugin menu (next to Help menu) like it should, but when you click select it from the plugin menu you get a crash?

Yes.

output of check-depends: (EDIT: see attached check-depends-parabola-x86_64.txt )

Note that the following plugins fail:

  • ABC Import
  • panel
  • random2
  • scorelist
  • ScoreView
  • helloqml

Note that the following plugins work:

  • Color Notes
  • note names
  • create score
  • random

Note that the following does nothing, but they seems to do nothing in 2.0.2 anyway:

  • walk
  • run

Same behavior on both my Parabola machines (x86-64 Dell Precision M4500, x86-64 MacBook 2,1, and i686 ThinkPad X60s).

I think the common thread with the ones that fail is that htey bring up a seperate window. So I think the window is a causer of the crash.

Title Crash when execute plugin in Parabola Linux AppImage Crash when execute plugins that bring up window in Parabola Linux AppImage (i686 & x86-64)

Seems consistent with the error message

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile 0)

I agree.

Let me reiterate: Parabola linux is a strictly "free-software only" distro based off Arch linux. I'm pretty sure I remember AppImage plugins working correctly on regular Arch linux when I first tested AppImage about a month ago (but I could be wrong about that). So there might be some library or something that Arch includes but Parabola doesn't. Note that I'm running nouveau and that OpenGL works (I can see glxgears run fine).

Could try running with strace, ltrace and/or latrace.

E.g.:

latrace ./MuseScore*.AppImage -p /path/to/abc_import.qml

Note: you'll need to put a copy of abc_import.qml somewhere on your machine before you run that command because you won't be able to use the one inside the AppImage. You could use the distribution copy, which is probably at /usr/share/mscore-2.0/plugins/abc_import.qml.

I'm noticing the lines:

open("/usr/share/locale/en/LC_MESSAGES/bash.mo", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No such file or directory)

are in the strace that has pluginType: "dialog" but not in the strace without. Could my parabola be missing and important libc file? Or is that irrelevant?

TLDR: It looks like the problem is with bash.mo

I have the same problem with plugins not working in the AppImage on Ubuntu, when they do work with the distribution package. I've been doing this with program=mscore and program=MuseScore*.AppImage:

strace $program -p /usr/share/mscore-2.0/plugins/helloqml/helloqml.qml 2>&1 | grep -E "libc.mo|bash.mo"

I also get the same "no such file or directory" for libc.mo and bash.mo with the AppImage, like you, but I noticed that I also get the "file not found" for libc.mo with the distribution package, even when not loading plugins. I only get the "file not found" for bash.mo with the AppImage and only when trying to run a plugin, so it looks like that's the problem here.

Probably best to attach all long output in .txt files from now on to keep the comments clear.

OK.

But I think all that /usr/share/locale/$locale/LC_MESSAGES/ contains is is localized error messages. So I don't think missing bash.mo is the root cause of error.

(Regarding regular Arch linux, I'm thinking maybe I didn't test all the plugins...I might have just tried one that worked like "Color notes" and then just assumed all plugins worked.)

Title Crash when execute plugins that bring up window in Parabola Linux AppImage (i686 & x86-64) Crash when execute plugins that bring up window in Linux AppImage (i686 & x86-64)

I've attached strace output of debug build regular binary build.debug/mscore/mscore-portable (which successfuly completes with return code 0) and as the debug AppImage (which fails with exit code 139). I think(?) the debug contains more output.

(Oh, and I removed the inlined strace outputs and replaced with attached .txt files in my earlier comments)

anyone know good ways to debug this? I'm trying to figure out why helloqml will crash when run as AppImage, and I configured QtCreator to build the AppImage and can execute the mscore-portable binary from QtCreator, and I experience the crash, but there is no way for me to step through the code. In the Application Output tab I see:

"QML Debugger: Ignoring \"-qmljsdebugger=port:43544,block,services:DebugMessages,QmlDebugger,V8Debugger,QmlInspector\". Debugging has not been enabled."

I've noticed that "cat mscore-portable-debug-helloqml.txt | grep -E egl" produces:

lstat("/usr/lib/qt/plugins/platforms/libqeglfs.so", {st_mode=S_IFREG|0755, st_size=10736, ...}) = 0
open("/usr/lib/qt/plugins/platforms/libqeglfs.so", O_RDONLY|O_CLOEXEC) = 3
lstat("/usr/lib/qt/plugins/platforms/libqminimalegl.so", {st_mode=S_IFREG|0755, st_size=182984, ...}) = 0
open("/usr/lib/qt/plugins/platforms/libqminimalegl.so", O_RDONLY|O_CLOEXEC) = 3
lstat("/usr/lib/qt/plugins/platforms/libqwayland-egl.so", {st_mode=S_IFREG|0755, st_size=69960, ...}) = 0
open("/usr/lib/qt/plugins/platforms/libqwayland-egl.so", O_RDONLY|O_CLOEXEC) = 3
lstat("/usr/lib/qt/plugins/xcbglintegrations/libqxcb-egl-integration.so", {st_mode=S_IFREG|0755, st_size=69848, ...}) = 0
open("/usr/lib/qt/plugins/xcbglintegrations/libqxcb-egl-integration.so", O_RDONLY|O_CLOEXEC) = 6

But that "cat mscore-AppImage-debug-helloqml.txt | grep -E egl" yields nothing.

So maybe the egl shared libraries need to be included in the AppImage???

Have you tried an ordinary debug build?

If an ordinary debug build doesn't give the error then you could try linking it to the libraries from an AppImage. Simply extract the "lib" directory out of a nightly AppImage and then set LD_LIBRARY_PATH like this inside QtCreator:

LD_LIBRARY_PATH="/path/to/lib:/path/to/lib/qt5/lib"

That may not work at all though since the binary will have been compiled against different versions of the libraries, but it's worth a shot.

Other option is to test the AppImage on CentOS 6 to see if the plugins work there, and then work out what is present on CentOS that is missing elsewhere.

Edit: just so you know, apart from a few strings the mscore-portable binary inside an AppImage is identical to an ordinary mscore binary. Any problems with the AppImage must be due to the libraries or scripts that it was (or wasn't!) packaged with, not the binary itself. When the AppImage is run, it first runs the AppRun script which simply sets LD_LIBRARY_PATH and then starts MuseScore.

I did try ordinary debug builds, and those work without error. (I provided diff's above, but I guess those comments were "Too Long Didn't Read" :)

I'm thinking what you said about extracting the libs out from app image won't work well, because the error occurs in some libs, but since the libs aren't compiled as Debug, then it won't be very useful when stepping through anyway. :(

So right now I'm downloading CentOS 6 and will try out the app image in CentOS virtual machine. Thanks for the advice.

If you get the same problem on CentOS then try installing these dependencies. You might need to extract the mscore-portable binary out of the AppImage first to avoid LD_LIBRARY_PATH being set. If it works after that then revert back to a clean CentOS and install the dependencies one-by-one (starting with Qt QML) until it works again, then see what files were installed by that dependency (but remember the dependency might have dependencies of its own).

Title Crash when execute plugins that bring up window in Linux AppImage (i686 & x86-64) Crash when execute plugins that bring up window in Linux AppImage (i686 & x86-64, including CentOS 6.7)

I spun up CentOS 6.7 live DVD in qemu+kvm and installed to a virtual drive and booted up install. I got error:

fuse: Failed to execute fusermount: Permission denied

Then I installed all those dependencies. But still go that error and realized it wasn't a dependency issue, but rather just a permission issue. So I ran the nightly musescore master x86-64 image as root :)

I then got the crash when trying to run a plugin that opens a window.

Then I extracted the AppImage and ran the ./mscore-portable-nightly binary by itself from commandline, and I get error:

error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: no such file or directory

I realize now that you didn't want me to install those dependencies before first trying to run the ./mscore-portable-nightly binary, but I did that already, sorry. Anyway, I would think we would need Qt5Core.so.5 ...my terminal LD_LIBRARY_PATH is empty...let me see what is going on...

hello from my CentOS 6.7 VM install. I ran ldd mscore-portable-nightly from the latest AppImage and attached output. It seems that the "yum install qt5-base-devel" and all the other qt5-*-devel never installed because yum says "No package qt5-base-devel available." I'm pretty sure I'm following same steps as in description... (Maybe some qt5 packages never got copied. EDIT: of course not because mscore compiles in travis...silly me. Anyway, I'm running the receipie now to see if I missed an important step.)

well I installed those depencies, and now ./mscore-portable-nightly executes, however there are no plugins in pluginmanager. Which makes sense because I don't have musescore installed. So I downloed helloqml plugin and put in my ~/Documents/MuseScoreDevelopment/Plugins/ directory, and I can see helloqml in the plugin manager and I can press the checkmarkbox, but after I close the manager, I don't see helloqml in dropdown menu.

If I run Plugin Creator, and create new plugin (which just is a console.log("Hello world")), and press Run, then I see error "module QtQuick is not installed"...

ok...well I don't know what is going on with that "module QtQuick is not installed" business when I try to run an extracted AppImage portable binary.

To bypass that issue, I've went ahead and mounted the AppImage using these instructions :

sudo mount -o loop MuseScoreNightly-201603080846-master-61d1a87-x86_64.AppImage /mnt

I then had to

sudo chown e -R /mnt

so I could run as my regular user.

Then I was able to run /mnt/bin/mscore-portable-nightly and I when trying to execute a plugin that opens a window, I got the same crash:

QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior 2, swapInterval 1, profile  0)
Aborted (core dumped)

So this means that the CentOS 6.7 VM after running your recipe seems to not be containing some important OpenGL/EGL library...

note: output of "ldconfig -p | grep -i egl" in this CentOS 6.7 VM is:

        libgegl-0.1.so.0 (libc6,x86-64) => /usr/lib64/libgegl-0.1.so.0
        libEGL.so.1 (libc6,x86-64) => /usr/lib64/libEGL.so.1

while if I'm on my Parabola x86-64 machine, output is:

	libwayland-egl.so.1 (libc6,x86-64) => /usr/lib/libwayland-egl.so.1
	libwayland-egl.so.1 (libc6) => /usr/lib32/libwayland-egl.so.1
	libwayland-egl.so (libc6,x86-64) => /usr/lib/libwayland-egl.so
	libwayland-egl.so (libc6) => /usr/lib32/libwayland-egl.so
	libva-egl.so.1 (libc6,x86-64) => /usr/lib/libva-egl.so.1
	libva-egl.so (libc6,x86-64) => /usr/lib/libva-egl.so
	libQt5EglDeviceIntegration.so.5 (libc6,x86-64) => /usr/lib/libQt5EglDeviceIntegration.so.5
	libQt5EglDeviceIntegration.so (libc6,x86-64) => /usr/lib/libQt5EglDeviceIntegration.so
	libEGL.so.1 (libc6,x86-64) => /usr/lib/libEGL.so.1
	libEGL.so.1 (libc6) => /usr/lib32/libEGL.so.1
	libEGL.so (libc6,x86-64) => /usr/lib/libEGL.so
	libEGL.so (libc6) => /usr/lib32/libEGL.so

I don't know which ones of these need to be included......I'll look into this now...

libQt5EglDeviceIntegration.so.5 is suspiciously missing from the list of packages that in build/Linux+BSD/portable/copy-libs ...I'm going to install it, add it to copy libs, and see if that does the trick.

the centos vm is installing qt5-qtbase-gui from EL6 (Extra Packages for Enterprise Linux), which doesn't contain the needed "libQt5EglDeviceIntegration.so.5", but qt5-qtbase-gui from EL7 does contain the needed "libQt5EglDeviceIntegration.so.5". So I'm tryinig to figure out best way with recipe to force use EL7 repos.

EDIT: I'm not having luck trying to selectively force use EL7 repos in CentOS 6, and I'm comming to the conclusion that that is probably not a wise thing to do.

I tried:

wget https://dl.fedoraproject.org/pub/epel/7/x86_64/q/qt5-qtbase-gui-5.5.1-11.el7.x86_64.rpm
rpm2cpio /media/spare/qt5-qtbase-gui-5.5.1-11.el7.x86_64.rpm | cpio -ivd ./usr/lib64/qt5/plugins/xcbglintegrations/libqxcb-egl-integration.so
cp usr/lib64/qt5/plugins/xcbglintegrations/libqxcb-egl-integration.so /usr/lib64/qt5/plugins/xcbglintegrations/

now after recompiling make portable "$@" I'm able to execute build.release/mscore/mscore-portable and can sucessfully run helloqml without crashing.

but then when running /mnt/bin/mscore-portable-nightly the helloqml still crashed.

I'm realizing now that my CentOS Vm already has /usr/lib64/at5/plugins/xcbglintegrations/libqxcb-glx-integrations.so, so I'm wondering (a) why the mscore-portable-nightly isn't using that glx-integrations library (the error only wants either GLX or ELG: "QXcbIntegration: Cannot create platform OpenGL context, neither GLX nor EGL are enabled"), and I'm wondering (b) why the copy-libs didn't copy that glx-integrations library.

Anyway I think I'm nearing a solution.

solution is as simple as adding the following line to getCrossPlatformDependencies() in copy-libs:

copyQt plugins/xcbglintegrations/libqxcb-glx-integration.so

let me verify I can run my newly-compiled AppImage on another linux machien, and I'll submit a PR.

Status (old) active patch (code needs review)

I'm happy to report that I have fixed the crash, simply by adding that one line to copy-libs. Please accept my PR: https://github.com/musescore/MuseScore/pull/2436

(I was fearing that I was going to have to resort to something more drastic like install include some centos7 packages for libqxcb-egl-integration.so or download entire qt library from qt.io, or even worse compile every version.) It seems that the plugin windows only require EITHER libqxcb-egl-integration.so OR libqxcb-glx-integration.so, not both (as is consistent with the error message)! :)

FYI, I have tested to verify that all plugins no longer crash when executed, both on my x86-64 and i686 Parabola linux machines, using these travis builds (from the CentOS 6.7 VM):
https://bintray.com/artifact/download/ericfont/nightlies-linux/MuseScor…
https://bintray.com/artifact/download/ericfont/nightlies-linux/MuseScor…

Status (old) patch (code needs review) fixed

Fixed in branch master, commit eb9a93c5b9

fix #101171 portable copy-lib xcbglintegrations

This fixes a crash with AppImages when trying to run any plugin that opens up a window. Since copy-libs didn't copy any library for xcbglintegrations, that caused QXcbIntegration to panic "Cannot create platform OpenGL context, neither GLX nor EGL are enabled" and halt execution with a SIGABORT.

Fixed in branch 2.0.3, commit 51a50aa58c

fix #101171 portable copy-lib xcbglintegrations

This fixes a crash with AppImages when trying to run any plugin that opens up a window. Since copy-libs didn't copy any library for xcbglintegrations, that caused QXcbIntegration to panic "Cannot create platform OpenGL context, neither GLX nor EGL are enabled" and halt execution with a SIGABORT.