I wrote a tool to automate the creation and maintenance of Qt cross-build environments built from packages in Debian Stretch.
It allows to:
- Do cross-architecture development with Qt Creator, including remote debugging on the target architecture
- Compile using native compilers and cross-compilers, to avoid running the compilers inside an emulator making the build slower
- Leverage all of Debian as development environment, using existing Debian packages for cross-build-dependencies
# Creates an armhf environment under the current directory $ sudo cbqt ./armhf --create --verbose 2017-11-30 14:09:23,715 INFO armhf: Creating /home/enrico/lavori/truelite/system/cross/armhf … 2017-11-30 14:14:49,887 INFO armhf: Configuring cross-build environment # Get information about an existing chroot. # Note: the output is machine-parsable yaml $ cbqt ./armhf --info name: armhf path: ./armhf arch: armhf arch_triplet: arm-linux-gnueabihf exists: true configured: true issues:  # Create a qmake wrapper for this environment $ sudo ./cbqt ./armhf --qmake -o /usr/local/bin/qmake-armhf # Install the build-depends you need # Note: :arch is added automatically to package names if no arch is explicitly # specified $ sudo ./cbqt ./armhf --install libqt5svg5-dev libmosquittopp-dev qtwebengine5-dev
To build a package, use the qmake wrapper generated with
cbqt --qmake instead
of the normal qmake:
$ qmake-armhf -makefile $ make arm-linux-gnueabihf-g++ … -I../armhf/usr/include/arm-linux-gnueabihf/… -I../armhf/usr/lib/arm-linux-gnueabihf/qt5/mkspecs/arm-linux-gnueabihf -o browser.o browser.cpp … /home/enrico/…/armhf/usr/bin/moc … … arm-linux-gnueabihf-g++ … -Wl,-rpath-link,/home/enrico/…/armhf/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/enrico/…/armhf/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/home/enrico/…/armhf/usr/lib/ -o program browser.o … -L/home/enrico/…/armhf/usr/lib/arm-linux-gnueabihf …
Building in Qt Creator
Configure a new Kit in Qt Creator:
Build & Run, then
armhf(or anything you like)
- Qt version: choose the one autodetected from
Compilers, add a GCC C compiler with path
arm-linux-gnueabihf-gcc, and a GCC C++ compiler with path
- Choose the newly created compilers in the kit
- Dismiss the dialog with "OK": the new kit is ready
Now you can choose the default kit to build and run locally, and the
kit for remote cross-development.
Where to get it
This has been done as part of my work with Truelite.