gpt4 book ai didi

c++ - Qt5 支持的应用程序使用 Qt4-libs 并失败。如何避免这种情况?

转载 作者:塔克拉玛干 更新时间:2023-11-03 00:23:04 24 4
gpt4 key购买 nike

我已经从源代码构建了 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 libs('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 时搞砸了。任何想法?提前致谢。

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

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

PS2。我无法卸载 Qt4 库,因为发行版与 KDE 打包在一起。

最佳答案

抱歉,您无能为力。这是一个常见的 Qt 设计缺陷。 Qt5 程序使用第 3 方库,它链接到 Qt4 -> 崩溃。

只有一种可能的解决方案:重新编译您的 Qt5:

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

关于c++ - Qt5 支持的应用程序使用 Qt4-libs 并失败。如何避免这种情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18148140/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com