I develop a cross-platform Qt application. And now I need/want to run it on a remote host with GUI form loading.
I know 2 ways to do that:
- open application on a remote display (may be virtual) with console attached to QtCreator via
ssh
- run with remote X session, like it done with
ssh -X
or-Y
.
When I run an application through QtCreator on the remote device it says
QXcbConnection: Could not connect to display
When I connect to remote host with ssh -Y
and run my app, it says
QXcbConnection: Could not connect to display localhost:10.0
Aborted
On my local host and on remote host via VNC the application works fine.
ssh -Y user@host xclock
also works fine - opens it's form on my local display.
Host system is Ubuntu 16.04 LTS x64, target system Ubuntu 16.04 LTS x86 32bit. Qt version 5.9.1
Please help me to make it work. In worst case I agree to see debug console in and gdb
attached to QtCreator, but the GUI could still be placed on a remote display.
Update: Here is related question on form.qt.io.
After some research and help from QtCreator community I found
The way is simple:
ssh -X user@host
. And get know theDISPLAY
variable. For example withecho $DISPLAY
. It should look likelocalhost:10.0
.DISPLAY
in QtCreator -> Projects -> YourConfiguration -> Run -> RunEnvironment to known value from (1).Note: closing ssh session will make forwarded display inaccessible and invalid.