0

PC with the Ubuntu on the Virtual Box is used as a host. Raspberry Pi is used as a target device.

Is it possible remotely debug (using SSH and the possibilities of the QT Creator) a program with a GUI (Graphical User Interface) loaded on the Respberry Pi using the QT Creator?

3
  • stackoverflow.com/questions/36398798/… proposed as a related question doesn't meet your request ? Commented Jun 9 at 9:25
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Commented Jun 9 at 9:28
  • @bruno The question was whether it is possible to remotely debug applications with GUI in QT Creator and how it will happen? This is the information I could not find. I know that it is possible to remotely debug console applications. Commented Jun 9 at 10:00

1 Answer 1

1

Yes. It is possible. I don't remember exactly how (I haven't done it for a long time).

I'm not sure I wrote it all down correctly. I haven't worked with Pi for a long time.

Something like this:
First:


  1. Development & Cross-Compilation: You develop the code on the host (Ubuntu in VirtualBox). Qt Creator is configured to use a cross-compiler (e.g., g++-arm-linux-gnueabihf) and Qt libraries compiled for the ARM architecture (your Raspberry Pi).

  2. Deployment: Qt Creator automatically copies the compiled executable and necessary libraries (including Qt) to the Raspberry Pi via SSH when starting debugging/the application. This is configured using "Devices" and "Kits" in Qt Creator.

  3. Execution on Target: The executable runs on the Raspberry Pi itself.

  4. Debugger (GDB): Qt Creator on the host launches a GDB server (gdbserver) on the Raspberry Pi via SSH. This server attaches to your running application. The main GDB debugger on the host (Ubuntu) communicates with gdbserver over the network.

  5. Remote Debugging: You see the source code on the host, set breakpoints, inspect variables, and step through code. The host GDB controls the program's execution on the Pi via gdbserver and receives information (variable values, call stack, etc.).


Second (How to See the GUI):

  1. X11 Forwarding over SSH:
  • Setup:

    • Host (Ubuntu): An X server must be running (it usually is by default in a graphical environment). Ensure Qt Creator's SSH device settings allow X11 Forwarding (often an option like -X or -Y in the SSH extra options).
  • Pi: Must have X11 client libraries installed (xauth, usually present).

  1. VNC / RDP to Raspberry Pi

  2. Physical Monitor on Pi


Third:

  1. Configure a "Device": Go to Tools -> Options -> Devices. Add a new "Generic Linux" device. Specify the Pi's IP, username, password/key. Enable X11 Forwarding (usually a checkbox "Forward X11 connection" or parameter -X in SSH extra options).

  2. Configure Compiler: Specify the path to the ARM cross-compiler (e.g., /usr/bin/arm-linux-gnueabihf-g++).

  3. Configure Qt Version: Specify the path to the Qt libraries compiled for ARM (copied or built for the Pi).

  4. Configure a Kit: Create a new Kit. Select:

    • Device: Your newly created device (Raspberry Pi).

    • Compiler: Your ARM compiler.

    • Qt Version: Your ARM Qt.

    • Debugger: Qt Creator usually auto-finds gdb-multiarch or similar on the host. gdbserver on the Pi is used automatically.

  5. Open your project, select the created Kit, set breakpoints, and start debugging (F5).


    Upd.

    I don`t remember how to configure Linux on VBox ;( But I think it is not a problem. It was simple.

Sign up to request clarification or add additional context in comments.

5 Comments

If I use a physical monitor on the PI and interact with the GUI using a mouse and keyboard, will debugging (set breakpoints, inspect variables, and step through code) via the gdbserver in QT Creator still be available?
As far as I remember there were no problems with this.
you can use VNC or X11Forwarding, btw. There are many manuals about VNC on Pi
Thank you very much for the your explanations.
NP. I hope I was able to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.