QT wayland Failed to create display (No such file or directory)

Bird Joey picture Bird Joey · Apr 16, 2018 · Viewed 8.5k times · Source

I am trying create a qt5 application on yocto using qtwayland. When I run my application, the 'Apllication Output' displays this error

"Failed to create display (No such file or directory) Application finished with exit code 1." .

However, the bin file actually has successfully been deployed and I can run it on my board by opening the file manually. I can't debug on my board,either. How can I figure it out, thank you.

Answer

bobbaluba picture bobbaluba · Apr 17, 2018

I assume you are trying to create a Qt client application and run it on a wayland server?

On Wayland, Failed to create display (No such file or directory) means that a Wayland client couldn't connect to the compositor/display server.

So you should verify that your compositor is running. Which one are you using?

The environment variable, XDG_RUNTIME_DIR, also needs to be set both when the compositor is started and when your client is started.

If clients start when you run them on the device, it might be that the default platform for your qt installation is eglfs, not Wayland. In order to run the applications on Wayland, start it like this:

./myapp -platform wayland

or set

export QT_QPA_PLATFORM=wayland

Note that if you are running a Qt-based compositor, then the compositor should probably still be run with the eglfs backend