Discussion:
[Qt-creator] How to make QtCreator to connect to a remote device (generic linux) with X forwarding enabled `ssh -X`?
Иван Кувалдин
2017-12-18 09:56:45 UTC
Permalink
Hello.


I develop a cross-platform Qt application with GUI. It works fine on host system in both x32 and x64 variants. Next is to deploy the application on a remote i386 host. It works fine there too. But when I run the app on the remote host through QtCreator, it fails to connect to a display, because it does not exist. The solution is to access to remote host with `-X` option. Definitely. This way it opens window(s) on a local (development) machine.

How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
I believe there is a hidden configuration option in some file, and no need to recompile.
Thanks in advance.


Related Questions:
0. https://forum.qt.io/topic/86047/how-to-make-qtcreator-to-connect-to-a-remote-device-generic-linux-with-x-forwarding-enabled-ssh-x
1. https://stackoverflow.com/questions/47838027/how-to-remotely-debug-graphic-application-with-qtcreator
--
With best regards Ivan Kuvaldin
С уважением Иван Кувалдин.
Christian Kandeler
2017-12-18 10:10:48 UTC
Permalink
On Mon, 18 Dec 2017 11:56:45 +0200
Post by Иван Кувалдин
I develop a cross-platform Qt application with GUI. It works fine on host system in both x32 and x64 variants. Next is to deploy the application on a remote i386 host. It works fine there too. But when I run the app on the remote host through QtCreator, it fails to connect to a display, because it does not exist. The solution is to access to remote host with `-X` option. Definitely. This way it opens window(s) on a local (development) machine.
How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
I don't think that works yet. Please create a task at bugreports.qt.io.


Christian
Kari Oikarinen
2017-12-18 10:19:13 UTC
Permalink
Post by Иван Кувалдин
Hello.
I develop a cross-platform Qt application with GUI. It works fine on host system in both x32 and x64 variants. Next is to deploy the application on a remote i386 host. It works fine there too. But when I run the app on the remote host through QtCreator, it fails to connect to a display, because it does not exist. The solution is to access to remote host with `-X` option. Definitely. This way it opens window(s) on a local (development) machine.
How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
I believe there is a hidden configuration option in some file, and no need to recompile.
Thanks in advance.
Have you set the environment variable DISPLAY to ":0" (or whatever is
correct) on your run environment?

It can be done in Projects > (Your kit) > Run > Run Environment.
--
Kari
Kari Oikarinen
2017-12-18 10:21:53 UTC
Permalink
Post by Kari Oikarinen
Post by Иван Кувалдин
Hello.
I develop a cross-platform Qt application with GUI. It works fine on
host system in both x32 and x64 variants. Next is to deploy the
application on a remote i386 host. It works fine there too. But when I
run the app on the remote host through QtCreator, it fails to connect
to a display, because it does not exist. The solution is to access to
remote host with `-X` option. Definitely. This way it opens window(s)
on a local (development) machine.
How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
I believe there is a hidden configuration option in some file, and no need to recompile.
Thanks in advance.
Have you set the environment variable DISPLAY to ":0" (or whatever is
correct) on your run environment?
It can be done in Projects > (Your kit) > Run > Run Environment.
Never mind, I didn't think this through. That would allow you to solve
the issue of not finding a display on the remote device. But the window
would still open on the remote device, not local device as with
`ssh -X`.
--
Kari
Иван Кувалдин
2017-12-18 11:36:49 UTC
Permalink
Thank you, Kari Oikarinen.

This works. Application does not fail with message "Cannot find display" But opens window on a remote display (it is connected physically). Now I connect to remote machine via VNC and such operation seems to be convenient enough. And the main advantage it is fast to configure.
--
Best regards
Ivan Kuvaldin
Post by Kari Oikarinen
Have you set the environment variable DISPLAY to ":0" (or whatever is
correct) on your run environment?
It can be done in Projects > (Your kit) > Run > Run Environment.
--
Kari
Konstantin Tokarev
2017-12-18 10:24:41 UTC
Permalink
Post by Иван Кувалдин
Hello.
I develop a cross-platform Qt application with GUI. It works fine on host system in both x32 and x64 variants. Next is to deploy the application on a remote i386 host. It works fine there too. But when I run the app on the remote host through QtCreator, it fails to connect to a display, because it does not exist. The solution is to access to remote host with `-X` option. Definitely. This way it opens window(s) on a local (development) machine.
How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
I believe there is a hidden configuration option in some file, and no need to recompile.
Thanks in advance.
Note that Qt Creator does not use system ssh client for running remote processes,
but uses internal SSH client library built on top of Botan. So it's not possible to pass
arbitrary arguments of openssh client to some magic place and get its behavior.

Advice with setting DISPLAY variable seems to be closer to what this feature was
originally meant to do: run application on remote device in the same way as it would be
run there normally. X11 forwarding runs application remotely but using your local X server
to display it.
Post by Иван Кувалдин
 0. https://forum.qt.io/topic/86047/how-to-make-qtcreator-to-connect-to-a-remote-device-generic-linux-with-x-forwarding-enabled-ssh-x
 1. https://stackoverflow.com/questions/47838027/how-to-remotely-debug-graphic-application-with-qtcreator
--
With best regards Ivan Kuvaldin
С уважением Иван Кувалдин.
_______________________________________________
Qt-creator mailing list
http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Regards,
Konstantin
Иван Кувалдин
2017-12-18 11:48:12 UTC
Permalink
Ура! Thank you, guys for support and ideas.

Now I can make the app running on a remote machine open its graphics on a local development machine.
Steps:

1. Open ssh session with X forwarding enabled

ssh -X ***@host

2. Get know forwarded display identity:

echo $DISPLAY

Will return something like `localhost:11.0`

3.Set environment variable DISPLAY for your run configuration in QtCreator to that value like `localhost:11.0`

4. Enjoy.
--
Best regards
Ivan Kuvaldin
Post by Konstantin Tokarev
 Hello.
 I develop a cross-platform Qt application with GUI. It works fine on host system in both x32 and x64 variants. Next is to deploy the application on a remote i386 host. It works fine there too. But when I run the app on the remote host through QtCreator, it fails to connect to a display, because it does not exist. The solution is to access to remote host with `-X` option. Definitely. This way it opens window(s) on a local (development) machine.
 How to explain QtCreator->Tools->Devices module to connect via `ssh -X`?!
 I believe there is a hidden configuration option in some file, and no need to recompile.
 Thanks in advance.
Note that Qt Creator does not use system ssh client for running remote processes,
but uses internal SSH client library built on top of Botan. So it's not possible to pass
arbitrary arguments of openssh client to some magic place and get its behavior.
Advice with setting DISPLAY variable seems to be closer to what this feature was
originally meant to do: run application on remote device in the same way as it would be
run there normally. X11 forwarding runs application remotely but using your local X server
to display it.
  0. https://forum.qt.io/topic/86047/how-to-make-qtcreator-to-connect-to-a-remote-device-generic-linux-with-x-forwarding-enabled-ssh-x
  1. https://stackoverflow.com/questions/47838027/how-to-remotely-debug-graphic-application-with-qtcreator
 --
 With best regards Ivan Kuvaldin
 С уважением Иван Кувалдин.
 _______________________________________________
 Qt-creator mailing list
 http://lists.qt-project.org/mailman/listinfo/qt-creator
--
Regards,
Konstantin
Loading...