-
Notifications
You must be signed in to change notification settings - Fork 2
Qt X Compiling
vraevsky edited this page Aug 10, 2019
·
36 revisions
It is a quite common case when developing Qt based applications for an Embedded Linux system is carried out on a host machine with a different architecture. In order to prepare the host machine for X-compiling some manual configuration steps required.
This is a brief manual that shows:
- how to include Qt5 support in Yocto ARM64 standard SDK
See: Prepare SDK Image - how to use the SDK with
QtCreator
- how to use the SDK w/out
QtCreator
- Linux Debian/Ubuntu desktop
- Tested desktop:
uname -r; cat /etc/debian_version # Outupt 4.19.0-5-amd64 10.0
- build-essential
- Install it this way:
sudo apt-get install build-essential
- QtCreator
- Install it this way:
sudo apt-get install qtcreator
The following is an example on how to setup a Yocto Project standard SDK built using Sumo distribution for a Linux x86_64 host in Qt Creator 4.8.2:
- open a terminal application and source the cross compiling environment setup with:
. <sdk-install-path>/environment-setup-aarch64-poky-linux
qtcreator &
- open the
Tools
,Options...
menu and select theKits
section - use
<sdk-install-path>/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake
as qmake location inQt versions
tab: - use
<sdk-install-path>/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gcc
as C compiler path and select ABIarm-linux-generic-elf-64bit
in theCompilers
tab: - use
<sdk-install-path>/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-g++
as C++ compiler path and select ABIarm-linux-generic-elf-64bit
in theCompilers
tab: - use
<sdk-install-path>/sysroots/x86_64-pokysdk-linux/usr/bin/aarch64-poky-linux/aarch64-poky-linux-gdb
as debugger path inDebuggers
tab: - open the
Devices
section - in the
Devices
tab create a new device of typeGeneric Linux Device
, specify IP address and authentication details: - return to the
Kits
section - create a new kit with name
X-compile ARM 64bit
selecting the configurations we just created use<sdk-install-path>/sysroots/aarch64-poky-linux
as sysroot path: - press
Apply
and exit Qt Creator
- open a terminal application and source the cross compiling environment setup with:
. <sdk-install-path>/environment-setup-aarch64-poky-linux
- start Qt Creator from the current command line:
qtcreator
- create a new example project using the
Qt Widgets Application
template - name the project
hello-qt
- select the
X-compile ARM 64bit
kit we just created and finish - edit the
hello-qt.pro
adding:
# install target.path=/home/root/ INSTALLS += target
- Build the project
- Run
- the
hello-qt
application should now start on the target embedded Linux device. Success!
- open a terminal application and source the cross compiling environment setup with:
. <sdk-install-path>/environment-setup-aarch64-poky-linux
- make the Qt5 SDK examples available for the developer:
sudo chown ${USER}:${USER} -R <sdk-install-path>/sysroots/aarch64-poky-linux/usr/share/qt5/examples
- goto the
opengl/hellogl2
project directory:
cd <sdk-install-path>/sysroots/aarch64-poky-linux/usr/share/qt5/examples/opengl/hellogl2
- issue this sequence:
qmake -config release
make -j 8
- issue
file
command and make sure that the produced binary is an ARM64 executable file:
file hellogl2 | grep -q aarch64 && echo "good" || echo "bad"
- if it is a
good
, then copy this binary file to thetarget
device and run it.