Qt & Qwt Build Instructions (Qt 5.4.2, Qwt 6.1.2)

This wiki page summarizes the build steps for Qt 5.4.2 and Qwt 6.1.2 libraries as used in the Zynq Base TRD 2015.4.   Zynq Base TRD versions 2015.2 or older use Qt 4.7.3 and Qwt 6.0.1. Please refer to this wiki page for build instructions.


Table of Contents

Prerequisites


This tutorial requires the ARM GNU tools, which are part of the Xilinx Software Development Kit (SDK), to be installed on your host system. Specify the ARM cross-compiler by setting the CROSS_COMPILE environment variable and adding the cross-compiler to your PATH. Refer to the Zynq Tools wiki page for more information on how to set up the tool chain and known issues.

Note: These instructions currently require a Linux host for building.

bash> export CROSS_COMPILE=arm-xilinx-linux-gnueabi-
bash> export PATH=/path/to/cross/compiler/bin:$PATH


For simplicity we define two environment variables in this tutorial:

  • ZYNQ_QT_BUILD refers to the Qt build area
  • ZYNQ_QT_INSTALL refers to the Qt install area


bash> export ZYNQ_QT_BUILD=/path/to/qt/build
bash> export ZYNQ_QT_INSTALL=/path/to/qt/install
bash> export PATH=$ZYNQ_QT_INSTALL/bin:$PATH


Cross-Compile Qt5

Qt is a C++ framework for GUI application development. With the release of Qt 5.0, Qt no longer contains its own window system implementation. The Qt Platform Abstraction (QPA) provides multiple platform plugins that are potentially usable on Embedded Linux systems: EGLFS, LinuxFB, DirectFB, Wayland. In this tutorial we configure Qt to use the LinuxFB plugin which is well suited for embedded devices without GPU running Linux. For more information on Qt for embedded Linux see here .

Download the Qt Source Archive


Download the Qt sources and extract the archive to your Qt build area.

bash> cd $ZYNQ_QT_BUILD bash> tar xzfv qt-everywhere-opensource-src-5.4.2.tar.gz bash> cd qt-everywhere-opensource-src-5.4.2



Prepare a mkspec

Before we can do the configuration for the target system, we need to create a mkspec that tells qmake which tool chain it should reference when it creates the Makefiles. In this example we provide a mkspec for the ARM Xilinx Linux GNU tools. The mkspec consists of two files:

  • qmake.conf – This is a list of qmake variable assignments that tells qmake which compiler to use

  • qplatformdefs.h – This is a header file with various platform-specific #includes and #defines. In our case we just reference the qplatformdefs.h file from a generic Linux mkspec

Download the files from the links below and create a new mkspec in the QtBase module.

bash> mkdir -p qtbase/mkspecs/arm-xilinx-linux-gnueabi-g++ bash> mv /path/to/downloaded/qmake_5.4.2.conf qtbase/mkspecs/arm-xilinx-linux-gnueabi-g++/qmake.conf bash> mv /path/to/downloaded/qplatformdefs_5.4.2.h qtbase/mkspecs/arm-xilinx-linux-gnueabi-g++/qplatformdefs.h


Configure the Target Build

We are now ready to configure Qt with the packages/modules required for the Base TRD based on the tool chain specified in our mkspec.

bash> ./configure -xplatform arm-xilinx-linux-gnueabi-g++ \ -opensource \ -confirm-license \ -nomake examples \ -skip qtquickcontrols \ -skip qtwebkit \ -skip qtwebchannel \ -skip qtactiveqt \ -skip qtandroidextras \ -skip qtdeclarative \ -skip qtimageformats \ -skip qtmacextras \ -skip qtserialport \ -skip qtx11extras \ -skip qtxmlpatterns \ -skip qtconnectivity \ -skip qtdoc \ -skip qtenginio \ -skip qtgraphicaleffects \ -skip qtlocation \ -skip qtmultimedia \ -skip qtquick1 \ -skip qtsensors \ -skip qttools \ -skip qttranslations \ -skip qtwayland \ -skip qtwebchannel \ -skip qtwebengine \ -skip qtwebkit-examples \ -skip qtwebsockets \ -skip qtwinextras \ -verbose \ -no-gif \ -no-libjpeg \ -no-mtdev \ -no-sql-db2 \ -no-sql-ibase \ -no-sql-mysql \ -no-xcb \ -qt-freetype \ -no-fontconfig \ -no-harfbuzz \ -no-xinput2 \ -no-xcb-xlib \ -no-pulseaudio \ -no-alsa \ -no-gtkstyle \ -no-nis \ -no-cups \ -no-iconv \ -no-icu \ -no-eglfs \ -no-openssl \ -prefix $ZYNQ_QT_INSTALL

Here is some information on some of the options that appear:

  • xplatform <mkspec files to use> – Cross compile for the target platform using the environment specified in the mkspec files

  • prefix <path> – The path to install the cross-compiled Qt to

For more information on specific Qt modules refer to this page

Build and Install

Run make to build the cross-compiled target version of Qt.

bash> make

Once the build has completed it is time to install Qt. You may need to su to root to do this part depending upon what prefix you configured the build with.


bash> su - #if you need root access to be able to install bash> make install


Cross-Compile Qwt

Qwt - Qt Widgets for Technical Applications - contains GUI Components and utility classes which are primarily useful for programs with a technical background. Beside a 2D plot widget it provides scales, sliders, dials, compasses, thermometers, wheels and knobs to control or display values, arrays, or ranges of type double.

Download the Qwt Source Archive

Download the Qwt sources and extract the archive to your Qt build area.

bash> cd $ZYNQ_QT_BUILD bash> tar xjfv qwt-6.1.2.tar.bz2 bash> cd qwt-6.1.2

Note: Make sure you configure, compile and install the qwt libraries in the same shell as the Qt installation as some Qt environment variables are reused for this build.

Configure the Build using qmake

Projects are described by the contents of project files (.pro). Files that end with the suffix .pri are included by the project files and contain definitions that are common for several project files. The information within these is used by qmake to generate a Makefile containing all the commands that are needed to build each project. Download the config file from below and replace the existing one.

bash> mv /path/to/downloaded/qwtconfig_6.1.2.pri qwtconfig.pri bash> qmake qwt.pro


Build and Install

Run make to build the cross-compiled target version of Qwt.

bash> make

Once the build has completed it is time to install Qwt. You may need to su to root to do this part depending upon what prefix you configured the build with.


bash> su - #if you need root access to be able to install bash> make install


Licensing

All files provided by Xilinx may be used under the terms of the GNU Lesser General Public License (LGPL) version 2.1. Please refer to the Qt5 Licensing page and Qwt License for details.



© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy