SSH [SOLVED]: How to remotely debug graphic application with QtCreator?

SSH [SOLVED]: How to remotely debug graphic application with QtCreator?

Home Forums SSH SSH [SOLVED]: How to remotely debug graphic application with QtCreator?

Tagged: , , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #36068

    Anonymous

    QuestionQuestion

    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.

    #36069

    Anonymous

    Accepted AnswerAnswer

    After some research and help from QtCreator community I found
    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.

    Source: https://stackoverflow.com/questions/47838027/how-to-remotely-debug-graphic-application-with-qtcreator
    Author: kyb
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.