How to make QtCreator to connect to a remote device (generic linux) with X forwarding enabled `ssh -X`?

  • 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 seems to work fine there too, but the app 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?!
    Thanks in advance.

  • Lifetime Qt Champion


    From a quick look at Qt Creator source code, I don't think it's possible currently. However, you should double check with the folks on the Qt Creator mailing list. You'll find there Qt Creator's developers/maintainers.

  • Thank you, @SGaist, I followed you advise and community helped to find a solution.

    The way is simple:

    1. Open ssh session to remote host with X forwarding enabled ssh -X user@host. And get know the DISPLAY variable. For example with echo $DISPLAY. It should look like localhost:10.0.
    2. Set environment variable DISPLAY in QtCreator -> Projects -> YourConfiguration -> Run -> RunEnvironment to known value from (1).
    3. Run and enjoy remote debug with GUI on local machine.

    Note: closing ssh session will make forwarded display inaccessible and invalid.