QT "Could not find the Qt platform plugin "xcb" "

QT "Could not find the Qt platform plugin "xcb" "

出于学术原因,我安装了 QT-everywhere 5.15 open-source,但我 运行 一个程序都失败了。

首先,我用make编译了必要的源文件并安装了QT Creator,然后我为其中的运行ning程序选择了qmake。当我尝试 运行 示例程序时,我遇到了这个错误:

qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in "/usr/lib/x86-64-linux-gnu"
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.
The program has unexpectedly finished.
The process was ended forcefully.

然后我查看 /usr/lib/x86-64-linux-gnu 以找到 xcb 插件并设置 LD_LIBRARY_PATH=/usr/lib/x86-64-linux-gnu,但同样的错误再次出现。

我应该怎么做才能解决这个问题?

1.安装要求:

sudo apt install make g++ pkg-config libgl1-mesa-dev libxcb*-dev libfontconfig1-dev libxkbcommon-x11-dev python libgtk-3-dev
  • python 对于 QtQuick 是可选的。
  • libgtk-3-dev 如果您想要 QtWidgets 的 GTK 本机主题,则可选。

2。配置:

./configure -opensource -confirm-license -nomake tests -nomake examples -prefix /path/to/install/dir

3。编译:

make -j $(nproc)

make install