Cross-compiling Qt5 Applications for Beaglebonewith Visual Studio
This tutorial shows how to cross-compile a simple Qt5 application for the Beaglebone Black board running Debian using Visual Studio and VisualGDB.
Before you begin, ensure you you can connect to your Beaglebone via SSH and are using an SD card image compatible with one of our toolchains.
- Start Visual Studio and open VisualGDB Linux project Wizard:
- On the first page select “Create a new project -> Application -> Qt -> Qt5-based application”:
- Select a cross-toolchain you would like to use (VisualGDB can download it automatically if you haven’t installed it yet) and pick your Beaglebone connection in the “Deployment computer” field:
- Press “Finish” to generate the project. VisualGDB will automatically install the Qt packages on the Beaglebone and will then suggest synchronizing the toolchain sysroot in order to support cross-compiling Qt applications:
- Ensure synchronization completes without errors (warnings due to unreadable private SSL keys are normal) and close the synchronization window:
- Once the project is created, build it by pressing Ctrl-Shift-B:
- Now you can start debugging the project by pressing F5. Note that if you are using an IoT SD card image (that does not include an X server), the application will fail to start:
- To fix this, connect to the target via SSH and install the “xserver-xorg” package:
- Now you can start debugging again. This time the project will launch successfully and its GUI running on Beaglebone will be automatically displayed on the Windows side via SSH X11 forwarding:
- You can also configure VisualGDB to display the X11 GUI directly via the Beaglebone’s HDMI output:
Note that for this option to work, the same user that is used for SSH connection needs to be logged on to the Beaglebone.