Raspberry PI: A case study in deploying Qt apps to generic Linux devices
This is an awfully dry post; dry due to the sheer logistic nature of it. This functionality exists and is quite straight forwards to stumble upon. This blog exists in order to draw your attention to it and hopefully minimize the stumble time.
You have a device:
1) Running an ssh server
2) With gdbserver
You also have:
1) A functional tool chain for the target (Code Sourcery is the traditional goto)
2) A Qt build for your target
3) A Linux box you are deploying from (My convenience, instructions should be readily repurposeable for Mac based developers)
4) Qt Creator (Qt Creator 2.4.0 (as shipped with the QtSDK) was used at the time of filming/documenting this process)
Qt Creator has various merits which basically speak for themselves.
Convenient remote visual debugging/profiling
Convenient (single click) deployment
You grow accustomed to this functionality if you target any of the officially/unofficially supported targets tightly integrated into Creator in its various distributions. (Official SDK, Necessitas, Meego SDK). It would be lovely if it were more commonly perceived as a generic end to end solution for deployment to generic Linux targets, and it is readily achievable if you avoid a couple of snags.
Menu -> Tools -> Options
Build & Run -> Qt Versions
Add your Raspberry PI Qt build: /opt/dev/qt-qpa-5-rasp-pi/bin/qmake
Creator indicates "Qt version 5.0.0 for Desktop", this can be safely ignored.
Build & Run -> Tool Chains
Add your cross compiler: /opt/toolchains/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
in my case. Adjust the ABI in the unlikely event it is incorrect.
Linux Devices -> Device Configurations
Add configuration with correct ssh details, deploy a public key and establish this works.
Per project configuration
1) Open an existing Qt application (example suffices)
2) Select a desktop build
Once this is done:
Projects -> Targets -> Build
Specify your target's Qt version
Specify the toolchain from the drop down below
Projects -> Targets -> Run
Method: Deploy to Remote Linux Host
Device Configuration: Select your "Linux Device" added in the Device Configurations step above
Run Configuration: foo (on Remote Device)
Arguments: -platform eglfs
This should suffice, you should now be able to deploy, run and debug applications on the Raspberry PI (or any other similarly capable Linux based target)
A screen grab demonstrating the logistics is available here
A video where I talk through the steps is also available for those willing to weather my accent
1) If you select a QtQuick UI project from the project wizard you will not be able to deploy to the target (will be grayed out). If you select a Qt Quick application you will get a QDeclarativeView based viewer/launch pad. If you want to dabble with Qt 5 (who doesn't) at present, one has to ride to war with one's own QQuickView based runtime/viewer (read: pony)
2) Qt must already be deployed on the target. We clearly handle this for our own devices, but when you are winging it as documented here, Qt has to have been (manually) installed to the configured prefix. (Needless to say, it is best to sanity check the Qt install prior to attempting IDE based deployment).
Subscribe to our newsletter
Try Qt 6.6 Now!
Download the latest release here: www.qt.io/download.
Qt 6.6. is a feature release with focus on improving UX capabilities including responsive UI technology and the Qt Graph module.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.