Table of Contents

How to compile and install Qt to an ARM platform

Qt for Ubuntu ARM Core

These instructions were tested on a Ubuntu 12.04 LTS system

Prerequisites

First of all you need to install a cross-compiler tool that is compatible with Ubuntu Core ARM:

apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf

Other tools like autogen, libtool and others are considered to be installed on a development host.

Compile Qt sources

Download qt sources from 'ftp://ftp.qt-project.org/qt/source/'. To avoid problems connected with the latest Qt 5.x version we'll use the latest from 4.x series: 4.8.1

wget ftp://ftp.qt-project.org/qt/source/qt-everywhere-opensource-src-4.8.1.tar.gz

Untar it in the home directory:

tar xf qt-everywhere-opensource-src-4.8.1.tar.gz

Now we need to specify a proper configuration that is suitable for our target system. Let's presume that we want to work only on a target without X-system installed, with a touchscreen for input and omit Java, SQL and WebKit support. You can still enable these packets, it only affects the build time. Qt can be a X-server itself if it's run with a key '-qws'.

First, let's specify the cross-environment configuration. For this modify the file 'mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf' and make it as suggested:

#
# qmake configuration for building with arm-linux-gnueabihf-g++
#

include(../../common/linux.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++-unix.conf)
include(../../common/qws.conf)

TSLIB_INCDIR = /usr/local/include
TSLIB_LIBDIR = /usr/local/lib

#Compiler Flags to take advantage of the ARM architecture
QMAKE_CC                = arm-linux-gnueabihf-gcc
QMAKE_CXX               = arm-linux-gnueabihf-g++
QMAKE_LINK              = arm-linux-gnueabihf-g++
QMAKE_LINK_SHLIB        = arm-linux-gnueabihf-g++

# modifications to linux.conf
QMAKE_AR = arm-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-linux-gnueabihf-objcopy
QMAKE_STRIP = arm-linux-gnueabihf-strip

QMAKE_INCDIR += $$TSLIB_INCDIR
QMAKE_LIBDIR += $$TSLIB_LIBDIR
QMAKE_LIBS   += -lts

load(qt_config)

Please pay attention that we include the Include- and Library- paths to the build as TSLIB_INCDIR and TSLIB_LIBDIR.

Next, run the configure script:

./configure -prefix /opt/qte4.8.1 -embedded arm -platform qws/linux-x86-g++ -xplatform qws/linux-arm-gnueabi-g++ -depths 16,24,32 -no-mmx -no-3dnow -no-sse -no-sse2 -no-glib -no-cups -no-largefile -no-accessibility -no-openssl -no-gtkstyle -fast -qt-mouse-tslib -nomake demos -nomake examples -no-svg -no-phonon -no-qt3support -no-svg -qt-gfx-linuxfb -no-javascript-jit -confirm-license -opensource -no-webkit

For the installation path we chose '/opt/qte4.8.1' but you can choose the one you like.

Next, run make and make install:

make && make install

So, finally you are able to compile an application for an ARM target running on a Ubuntu Core file system. To compile the application go to a folder with a *.pro file and run there qmake, like:

/opt/qte4.8.1/bin/qmake

Then usual make

make

You will have a dynamically linked binary intended to run on a ARM system. However, as we chose the build with shared libraries, at first you need to install same libraries and fonts to the target. For this you can pack the whole folder '/opt/qte4.8.1', upload it to the target and then unpack it in the same destination '/opt', so both the host and the target had the same paths to the libraries and fonts. After this you are able to run applications cross-compiled at a x86 linux system.

Qt application with touchscreen support

For Tslib installation instructions refer to the page tslib

export QWS_MOUSE_PROTO=tslib:/dev/input/event0
export TSLIB_CALIBFILE=/usr/local/etc/pointercal
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/lib/ts

To run an application with touchsreen input you can export all variables as described above, or simply run the application by issuing the command:

QWS_MOUSE_PROTO=tslib:/dev/input/event0 ./your-app -qws