Arch-Linux

找不到 Qt 平台外掛“wayland”

  • November 2, 2021

執行 vlc 時出現以下錯誤:

$ vlc
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[0000561d2cc24a30] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[0000561d2cbf2f50] main interface error: no suitable interface module
[0000561d2cb5a460] main libvlc error: interface "globalhotkeys,none" initialization failed
[0000561d2cb5a460] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

pacman我已經在 Arch Linux 中安裝了 vlc 。我正在嘗試執行sway作為wayland視窗管理器的 vlc。

在設置以下任何環境變數後執行 vlc 會導致相同的錯誤。

$ QT_QPT_PLATFORM=wayland vlc
$ QT_QPT_PLATFORM=offscreen vlc
$ QT_PLUGIN_PATH=/usr/lib/qt/plugins/ vlc

此外,解除安裝 vlc 並使用pacman(which uninstalls and reinstalls qt) 重新安裝並不能解決問題;同樣的錯誤仍然存在。

這是打開 QT_DEBUG_PLUGINS 標誌執行 vlc 的輸出。

$ QT_DEBUG_PLUGINS=1 vlc
VLC media player 3.0.11 Vetinari (revision 3.0.11-0-gdc0c5ced72)
[000055b67a7aea30] vlcpulse audio output error: PulseAudio server connection failure: Connection refused
[000055b67a847f60] main interface error: no suitable interface module
[000055b67a6e4460] main libvlc error: interface "globalhotkeys,none" initialization failed
[000055b67a6e4460] main libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
QFactoryLoader::QFactoryLoader() checking directory path "/usr/lib/qt/plugins/platforms" ...
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqeglfs.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqeglfs.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "eglfs"
       ]
   },
   "archreq": 0,
   "className": "QEglFSIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("eglfs")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqlinuxfb.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqlinuxfb.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "linuxfb"
       ]
   },
   "archreq": 0,
   "className": "QLinuxFbIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("linuxfb")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqminimal.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqminimal.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "minimal"
       ]
   },
   "archreq": 0,
   "className": "QMinimalIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("minimal")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqminimalegl.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqminimalegl.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "minimalegl"
       ]
   },
   "archreq": 0,
   "className": "QMinimalEglIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("minimalegl")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqoffscreen.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqoffscreen.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "offscreen"
       ]
   },
   "archreq": 0,
   "className": "QOffscreenIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("offscreen")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqvnc.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqvnc.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "vnc"
       ]
   },
   "archreq": 0,
   "className": "QVncIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("vnc")
QFactoryLoader::QFactoryLoader() looking at "/usr/lib/qt/plugins/platforms/libqxcb.so"
Found metadata in lib /usr/lib/qt/plugins/platforms/libqxcb.so, metadata=
{
   "IID": "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3",
   "MetaData": {
       "Keys": [
           "xcb"
       ]
   },
   "archreq": 0,
   "className": "QXcbIntegrationPlugin",
   "debug": false,
   "version": 331520
}


Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/usr/bin/platforms" ...
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

這裡的輸出ldd /usr/lib/qt/plugins/platforms/libqxcb.so意味著所有依賴項都已安裝。

$ ldd /usr/lib/qt/plugins/platforms/libqxcb.so
   linux-vdso.so.1 (0x00007ffc2cbdc000)
   libQt5XcbQpa.so.5 => /usr/lib/libQt5XcbQpa.so.5 (0x00007faa3c086000)
   libQt5Gui.so.5 => /usr/lib/libQt5Gui.so.5 (0x00007faa3b9b3000)
   libQt5Core.so.5 => /usr/lib/libQt5Core.so.5 (0x00007faa3b461000)
   libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007faa3b284000)
   libc.so.6 => /usr/lib/libc.so.6 (0x00007faa3b0bd000)
   libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x00007faa3b072000)
   libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x00007faa3af9c000)
   libQt5DBus.so.5 => /usr/lib/libQt5DBus.so.5 (0x00007faa3af16000)
   libpthread.so.0 => /usr/lib/libpthread.so.0 (0x00007faa3aef4000)
   libX11-xcb.so.1 => /usr/lib/libX11-xcb.so.1 (0x00007faa3aeef000)
   libxcb-icccm.so.4 => /usr/lib/libxcb-icccm.so.4 (0x00007faa3aee9000)
   libxcb-image.so.0 => /usr/lib/libxcb-image.so.0 (0x00007faa3aee3000)
   libxcb-shm.so.0 => /usr/lib/libxcb-shm.so.0 (0x00007faa3aedc000)
   libxcb-keysyms.so.1 => /usr/lib/libxcb-keysyms.so.1 (0x00007faa3aed7000)
   libxcb-randr.so.0 => /usr/lib/libxcb-randr.so.0 (0x00007faa3aec5000)
   libxcb-render-util.so.0 => /usr/lib/libxcb-render-util.so.0 (0x00007faa3aebf000)
   libxcb-render.so.0 => /usr/lib/libxcb-render.so.0 (0x00007faa3aeaf000)
   libxcb-shape.so.0 => /usr/lib/libxcb-shape.so.0 (0x00007faa3aeaa000)
   libxcb-sync.so.1 => /usr/lib/libxcb-sync.so.1 (0x00007faa3ae9e000)
   libxcb-xfixes.so.0 => /usr/lib/libxcb-xfixes.so.0 (0x00007faa3ae94000)
   libxcb-xinerama.so.0 => /usr/lib/libxcb-xinerama.so.0 (0x00007faa3ae8f000)
   libxcb-xkb.so.1 => /usr/lib/libxcb-xkb.so.1 (0x00007faa3ae71000)
   libxcb-xinput.so.0 => /usr/lib/libxcb-xinput.so.0 (0x00007faa3ae4c000)
   libxcb.so.1 => /usr/lib/libxcb.so.1 (0x00007faa3ae22000)
   libX11.so.6 => /usr/lib/libX11.so.6 (0x00007faa3acdf000)
   libSM.so.6 => /usr/lib/libSM.so.6 (0x00007faa3acd5000)
   libICE.so.6 => /usr/lib/libICE.so.6 (0x00007faa3acb8000)
   libxkbcommon-x11.so.0 => /usr/lib/libxkbcommon-x11.so.0 (0x00007faa3acae000)
   libxkbcommon.so.0 => /usr/lib/libxkbcommon.so.0 (0x00007faa3ac6d000)
   libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x00007faa3ab44000)
   libm.so.6 => /usr/lib/libm.so.6 (0x00007faa3a9fd000)
   libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007faa3a9e3000)
   libGL.so.1 => /usr/lib/libGL.so.1 (0x00007faa3a95d000)
   libpng16.so.16 => /usr/lib/libpng16.so.16 (0x00007faa3a923000)
   libz.so.1 => /usr/lib/libz.so.1 (0x00007faa3a909000)
   libharfbuzz.so.0 => /usr/lib/libharfbuzz.so.0 (0x00007faa3a83a000)
   libmd4c.so.0 => /usr/lib/libmd4c.so.0 (0x00007faa3a822000)
   libsystemd.so.0 => /usr/lib/libsystemd.so.0 (0x00007faa3a777000)
   libdouble-conversion.so.3 => /usr/lib/libdouble-conversion.so.3 (0x00007faa3a760000)
   libicui18n.so.67 => /usr/lib/libicui18n.so.67 (0x00007faa3a460000)
   libicuuc.so.67 => /usr/lib/libicuuc.so.67 (0x00007faa3a279000)
   libdl.so.2 => /usr/lib/libdl.so.2 (0x00007faa3a273000)
   libpcre2-16.so.0 => /usr/lib/libpcre2-16.so.0 (0x00007faa3a1e6000)
   libzstd.so.1 => /usr/lib/libzstd.so.1 (0x00007faa3a114000)
   /usr/lib64/ld-linux-x86-64.so.2 (0x00007faa3c1d8000)
   libexpat.so.1 => /usr/lib/libexpat.so.1 (0x00007faa3a0e4000)
   libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x00007faa3a0d1000)
   libdbus-1.so.3 => /usr/lib/libdbus-1.so.3 (0x00007faa3a07c000)
   libxcb-util.so.1 => /usr/lib/libxcb-util.so.1 (0x00007faa3a072000)
   libXau.so.6 => /usr/lib/libXau.so.6 (0x00007faa3a06d000)
   libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x00007faa3a065000)
   libuuid.so.1 => /usr/lib/libuuid.so.1 (0x00007faa3a05c000)
   libpcre.so.1 => /usr/lib/libpcre.so.1 (0x00007faa39fea000)
   libGLdispatch.so.0 => /usr/lib/libGLdispatch.so.0 (0x00007faa39f31000)
   libGLX.so.0 => /usr/lib/libGLX.so.0 (0x00007faa39efe000)
   libgraphite2.so.3 => /usr/lib/libgraphite2.so.3 (0x00007faa39ed9000)
   librt.so.1 => /usr/lib/librt.so.1 (0x00007faa39ece000)
   liblzma.so.5 => /usr/lib/liblzma.so.5 (0x00007faa39ea6000)
   liblz4.so.1 => /usr/lib/liblz4.so.1 (0x00007faa39e84000)
   libgcrypt.so.20 => /usr/lib/libgcrypt.so.20 (0x00007faa39d61000)
   libicudata.so.67 => /usr/lib/libicudata.so.67 (0x00007faa3824a000)
   libgpg-error.so.0 => /usr/lib/libgpg-error.so.0 (0x00007faa38223000)

任何幫助是極大的讚賞。

vlc 是一個 Qt 5 應用程序。根據ArchWiki,要在其中執行任何 Qt 應用程序,wayland您需要安裝qt5-wayland和使用QT_QPA_PLATFORM=wayland環境變數。

引用自:https://unix.stackexchange.com/questions/598099