-
Couldn't load subscription status.
- Fork 2
Qt X Compiling
Development of Qt based applications for Embedded Linux systems often needs to be done on a host machine with a different architecture. The following document outlines the configuration steps required in order to prepare the host machine for cross-compiling.
Document contents:
- Setting up Yocto SDK with Qt5 support
- Qt Development Environment Prerequisites
- Using Yocto SDK without QtCreator
- Using Yocto SDK with QtCreator:
- SDK install path is
/opt/fsl-imx-xwayland/4.14-sumo
- Linux Debian/Ubuntu desktop
- Install build-essential:
sudo apt-get install build-essential
- Install QtCreator:
sudo apt-get install qtcreator
- Yocto SDK with Qt5 support
- Make sure that the SDK is installed:
[[ -f /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux ]] && echo "Installed" || echo "Not Installed"
- Make sure that the Qt5 support is enabled:
[[ -f /opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake ]] && echo "enabled" || echo "off"
- open a terminal window and source the cross compiling environment setup:
. /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
- make the Qt5 SDK examples available for the developer:
sudo chown ${USER}:${GROUPS} -R /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/share/qt5/examples
- go to
opengl/hellogl2project directory:
cd /opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux/usr/share/qt5/examples/opengl/hellogl2
- issue the following sequence:
qmake -config release make -j 8
- issue
filecommand and make sure that the produced binary is a valid ARM64 executable:
file hellogl2 | grep -q aarch64 && echo "good" || echo "bad"
- if the file is
good, copy this binary file to thetargetdevice and run it. - if the file is
bad, re-issue the entire procedure.
The following example shows how to setup QtCreator with Yocto Project SDK built using Sumo distribution for a Linux x86_64 host:
-
open a terminal application and source the cross compiling environment setup with:
. /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
-
in the same terminal window start QtCreator:
qtcreator
-
open the
Tools,Options...menu and select theKitssection -
use the following line as qmake location in
Qt versionstab:/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
-
use the following line as C compiler path and select ABI
arm-linux-generic-elf-64bitin theCompilerstab:/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
-
use the following line as C++ compiler path and select ABI
arm-linux-generic-elf-64bitin theCompilerstab:/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
-
use the following line as debugger path in
Debuggerstab:/opt/fsl-imx-xwayland/4.14-sumo/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
-
open the
Devicessection -
in the
Devicestab create a new device of typeGeneric Linux Device, specify IP address and authentication details:

- return to the
Kitssection - create a new kit with name
X-compile ARM 64bitselecting the configurations we just created
use the following line as sysroot path:/opt/fsl-imx-xwayland/4.14-sumo/sysroots/aarch64-poky-linux
- click
Applyand exit Qt Creator
ℹ️ Make sure that the how to configure and use the SDK inside QtCreator
- open a terminal window and source the cross compiling environment setup:
. /opt/fsl-imx-xwayland/4.14-sumo/environment-setup-aarch64-poky-linux
- start
QtCreatorin the same terminal window:
qtcreator
- create a new example project using the
Qt Widgets Applicationtemplate - name the project
hello-qt - select the
X-compile ARM 64bitkit we just created and finish - edit the
hello-qt.proadding:
# install target.path=/home/root/ INSTALLS += target
- build the project