therecipe/qt:linux version: 94a0fe87cf38a584bca5485e38379b0d8435775fRunning go test -race returns:
Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/tmp/go-build447386026/b286/platforms" ...
loaded library "/opt/Qt/5.12.0/gcc_64/plugins/platforms/libqxcb.so"
qt.qpa.xcb: could not connect to display
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Looks like it's related to LD_LIBRARY_PATH?
Hey
Looks like it's related to LD_LIBRARY_PATH?
Yeah, usually these kind of issues can be solved by just setting LD_LIBRARY_PATH to the right path.
But from the error message it looks like that everything was found, it just couldn't be initialized.
Could not load the Qt platform plugin "xcb" in "" even though it was found.
This can happen if you use the docker images for example, because they don't have all the X11 stuff installed that is needed to get the "xcb" plugin working.
But you should be able to get it working with some other plugin, with something like
QT_QPA_PLATFORM=minimal go test -v -race
or
QT_QPA_PLATFORM=offscreen go test -v -race
also if you use qtminimal first, then you can save yourself some time
qtminimal && QT_QPA_PLATFORM=minimal go test -v -race -tags=minimal
and if you want to get the "xcb" plugin working then you would need to run something like this
https://github.com/therecipe/qt/blob/master/internal/vagrant/pre.sh#L14-L20
but I'm not sure if it works out of the box with the docker images
Hey
Looks like it's related to LD_LIBRARY_PATH?
Yeah, usually these kind of issues can be solved by just setting LD_LIBRARY_PATH to the right path.
But from the error message it looks like that everything was found, it just couldn't be initialized.Could not load the Qt platform plugin "xcb" in "" even though it was found.
This can happen if you use the docker images for example, because they don't have all the X11 stuff installed that is needed to get the "xcb" plugin working.
But you should be able to get it working with some other plugin, with something like
QT_QPA_PLATFORM=minimal go test -v -race
or
QT_QPA_PLATFORM=offscreen go test -v -racealso if you use qtminimal first, then you can save yourself some time
qtminimal && QT_QPA_PLATFORM=minimal go test -v -race -tags=minimaland if you want to get the "xcb" plugin working then you would need to run something like this
https://github.com/therecipe/qt/blob/master/internal/vagrant/pre.sh#L14-L20
but I'm not sure if it works out of the box with the docker images
Thanks for that enlightening answer. I had a similar problem and was able to solve it with the definition of
QT_QPA_PLATFORM=offscreen
for a service I developed that works with jpgs and therefore needs QGuiApplication but principally is a console applications to be started as systemd service in a non-X environment.
Thanks!
thank you very much! I encountered the same problem after compiling and installing qt. I cannot find the libqxcd.so file in the platforms folder. After compiling and installing qtbase, the problem was solved and it worked! Yeah!
@therecipe , @krafel I am trying to run this repo, but I got the same warning, How to fix this? please. shall I change enviromnet variables as you did previousely?
QT_QPA_PLATFORM=offscreen
```
WARNING: Got keys from plugin meta data ("xcb")
WARNING: QFactoryLoader::QFactoryLoader() checking directory path "/home/resources/anaconda3/bin/platforms" ...
WARNING: loaded library "/home/resources/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so"
WARNING: could not connect to display
WARNING: Could not load the Qt platform plugin "xcb" in "" even though it was found.
WARNING: 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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
```
Yeah. This is all greek. I just want my desktop to work and none of this tells me what to do to fix this error.
@therecipe , @krafel I am trying to run this repo, but I got the same warning, How to fix this? please. shall I change enviromnet variables as you did previousely?
QT_QPA_PLATFORM=offscreen
WARNING: Got keys from plugin meta data ("xcb") WARNING: QFactoryLoader::QFactoryLoader() checking directory path "/home/resources/anaconda3/bin/platforms" ... WARNING: loaded library "/home/resources/anaconda3/lib/python3.7/site-packages/PyQt5/Qt/plugins/platforms/libqxcb.so" WARNING: could not connect to display WARNING: Could not load the Qt platform plugin "xcb" in "" even though it was found. WARNING: 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, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb. Aborted (core dumped)
Yes, I'd set the QT_QPA_PLATFORM=offscreen env variable or just prepend it to the command you wanna execute:
QT_QPA_PLATFORM=offscreen
Most helpful comment
Thanks for that enlightening answer. I had a similar problem and was able to solve it with the definition of
QT_QPA_PLATFORM=offscreenfor a service I developed that works with jpgs and therefore needs QGuiApplication but principally is a console applications to be started as systemd service in a non-X environment.
Thanks!