Qt5驱动的应用程序使用Qt4-libs并失败。怎么避免这个?

时间:2013-08-09 13:45:24

标签: c++ linux linker qt5

我已经从源代码构建了Qt5并用于构建我的应用程序。不幸, 它在VLC播放器的某些内部功能中失败(我称之为libvlc_new 功能)。调用堆栈中有一个最顶行:

Level   Function      File
0    ??    /usr/lib/x86_64-linux-gnu/libQtGui.so.4        0x7fffdb861afc
1    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7deb1a6
2    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7deb28a
3    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7def20f
4    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7deafe6
5    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7deeb7c
6    dlopen_doit    dlopen.c    67    0x7fffee6d7016
7    ??    /lib64/ld-linux-x86-64.so.2        0x7ffff7deafe6
8    _dlerror_run    dlerror.c    164    0x7fffee6d75ec
9    __dlopen    dlopen.c    88    0x7fffee6d70b1
10    ??    /usr/lib/libvlccore.so.5        0x7fffef1b98fd
11    ??    /usr/lib/libvlccore.so.5        0x7fffef1a0927
12    ??    /usr/lib/libvlccore.so.5        0x7fffef1a0bfb
13    ??    /usr/lib/libvlccore.so.5        0x7fffef1a0ded
14    ??    /usr/lib/libvlccore.so.5        0x7fffef1a0f10
15    ??    /usr/lib/libvlccore.so.5        0x7fffef1a159d
16    libvlc_InternalInit    /usr/lib/libvlccore.so.5        0x7fffef1366eb
17    libvlc_new    /usr/lib/libvlc.so.5        0x7ffff6fd3625
18    QVlcInstance::QVlcInstance    qvlcinstance.cpp    54    0x7ffff6694228
19    VideoPlayer::VideoPlayer    VideoPlayer.cpp    12    0x4b988a
20    ResourcePlayer::registerPlayersAndControls    ResourcePlayer.cpp    196    0x4c019b
...    <More>

/ usr / lib / x86_64-linux-gnu目录中有Qt4库,确实 ('ldconfig -v'显示它们)。它解释了SIGSEGV信号,因为 Qt的版本完全不同。但是,我无法弄清楚 Qt4库甚至被使用的原因是什么?在运行我的应用程序之前,我 从QtCreator中删除自动检测到的Qt版本。

我用ldd分析了我的可执行文件(我使用基于Debian的发行版)和 它只显示Qt5库:

$ ldd bin_debug/editor
    linux-vdso.so.1 =>  (0x00007fff91bff000)
    libfbxsdk.so => not found
    libflashviewd.so.1 => not found
    libvlc.so.5 => /usr/lib/libvlc.so.5 (0x00007f6eb49bd000)
    libglsceneviewd.so.1 => not found
    libqwikpadwidgetd.so.1 => not found
    libLogger.so.1 => not found
    libqtvlcd.so.1 => not found
    libQt5WebKitWidgets.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5WebKitWidgets.so.5   (0x00007f6eb4779000)
    libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6    (0x00007f6eb443d000)
    libxslt.so.1 => /usr/lib/x86_64-linux-gnu/libxslt.so.1  (0x00007f6eb41ff000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2  (0x00007f6eb3ea0000)
    libQt53D.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt53D.so.5 (0x00007f6eb3962000)
    libQt5MultimediaWidgets.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5MultimediaWidgets.so.5   (0x00007f6eb3744000)
    libQt5Quick.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5Quick.so.5 (0x00007f6eb321c000)
    libQt5OpenGL.so.5 =>    /aux/dev/qt/qt5.1/qtbase/lib/libQt5OpenGL.so.5 (0x00007f6eb2fb6000)
    libQt5PrintSupport.so.5 =>  /aux/dev/qt/qt5.1/qtbase/lib/libQt5PrintSupport.so.5    (0x00007f6eb2d62000)
    libQt5Multimedia.so.5 =>    /aux/dev/qt/qt5.1/qtbase/lib/libQt5Multimedia.so.5  (0x00007f6eb2a99000)
    libQt5Qml.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5Qml.so.5   (0x00007f6eb2617000)
    libQt5WebKit.so.5 =>    /aux/dev/qt/qt5.1/qtbase/lib/libQt5WebKit.so.5 (0x00007f6eb03f6000)
    libQt5Widgets.so.5 =>   /aux/dev/qt/qt5.1/qtbase/lib/libQt5Widgets.so.5 (0x00007f6eafc18000)
    libQt5Sensors.so.5 =>   /aux/dev/qt/qt5.1/qtbase/lib/libQt5Sensors.so.5 (0x00007f6eaf9db000)
    libQt5Network.so.5 =>   /aux/dev/qt/qt5.1/qtbase/lib/libQt5Network.so.5 (0x00007f6eaf69d000)
    libQt5Sql.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5Sql.so.5   (0x00007f6eaf45e000)
    libQt5Gui.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5Gui.so.5   (0x00007f6eaee1b000)
    libQt5Core.so.5 =>  /aux/dev/qt/qt5.1/qtbase/lib/libQt5Core.so.5 (0x00007f6eae7ad000)
    libGL.so.1 => /usr/lib/libGL.so.1 (0x00007f6eae47f000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0    (0x00007f6eae261000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6  (0x00007f6eadf5a000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6eadcd7000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1    (0x00007f6eadac0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6ead734000)
    libvlccore.so.5 => /usr/lib/libvlccore.so.5 (0x00007f6ead44a000)
    libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6  (0x00007f6ead238000)
    libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1    (0x00007f6ead018000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f6eace14000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f6eacbfb000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f6eac9d8000)
    libQt5V8.so.5 => /aux/dev/qt/qt5.1/qtbase/lib/libQt5V8.so.5 (0x00007f6eac340000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6eac138000)
    libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1    (0x00007f6eabf2e000)
    libicui18n.so.48 => /usr/lib/x86_64-linux-gnu/libicui18n.so.48  (0x00007f6eabb62000)
    libicuuc.so.48 => /usr/lib/x86_64-linux-gnu/libicuuc.so.48  (0x00007f6eab7f3000)
    libicudata.so.48 => /usr/lib/x86_64-linux-gnu/libicudata.so.48  (0x00007f6eaa482000)
    libgthread-2.0.so.0 =>  /usr/lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007f6eaa280000)
    libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0  (0x00007f6ea9f87000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f6eb4bf1000)
    libnvidia-tls.so.319.32 =>  /usr/lib/tls/libnvidia-tls.so.319.32 (0x00007f6ea9d84000)
    libnvidia-glcore.so.319.32 =>   /usr/lib/libnvidia-glcore.so.319.32 (0x00007f6ea782d000)
    libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f6ea75e6000)
    libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6    (0x00007f6ea73e3000)
    libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6    (0x00007f6ea71dd000)
    libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f6ea6fa0000)

libvlccore.so根本不使用Qt:

$ ldd /usr/lib/libvlccore.so
    linux-vdso.so.1 =>  (0x00007fffd85ff000)
    libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3  (0x00007fd102675000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fd10246d000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0    (0x00007fd10224f000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fd10204b000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd101dc8000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd101a3b000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd102bbd000)

似乎我搞砸了几个版本的Qt。任何 想法?提前谢谢。

PS。我使用以下选项配置Qt:

./configure -qt-xcb -prefix "$PWD/qtbase" -opensource -confirm-license -nomake examples -nomake tests

PS2。我无法卸载Qt4库,因为发行版是用KDE打包的。

2 个答案:

答案 0 :(得分:1)

对不起,你无能为力。这是一个普遍的Qt设计缺陷。 Qt5程序使用第三方lib,它链接Qt4 - &gt;崩溃。

只有一种可能的解决方案:使用以下代码重新编译Qt5:

-qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.

答案 1 :(得分:1)

也许有人帮忙:

只需要删除 libqt4_plugin.so

来自vlc插件目录 - 在我的debian上/ usr / lib / vlc / plugins / gui /