Sunday, July 31, 2011

Compiling Qt Embedded 4.7.3

The version of Qt and tslib used in this article are:

tslib 2011.07.01 snapshot

Assume that the working directory is


and all the required cross tool chain setting are already done. Be sure that you are using the same version of tool chain you have used for your ARM kernel. Otherwise tslib utilities won't work properly. If you don't have the following packages, get them now:

$ sudo apt-get install autoconf
$ sudo apt-get install libtool


Before you compile Qt embedded you may want compile tslib first. Fortunately it is quite straightforward. Get the most recent version of tslib via git

$ git clone

Configure it

$ cd tslib
$ ./
$ ./configure --prefix=$HOME/tslib_arm --host=arm-none-linux-gnueabi

Compile and install it

$ make
$ make install

Then you can find the resulting directories like:

At this point, you can test this on your device. Copy the resulting directories bin, etc, and lib with its subdirectory ts to the corresponding directories of your device, e.g.,


The etc directory contains the configuration file, ts.conf. You need to edit the file and uncomment the line to load at least one input raw module, such as

module_raw input

And you set the following environment variables:

export TSLIB_TSDEVICE=/dev/input/event1
export TSLIB_CALIBFILE=/usr/local/etc/pointercal
export TSLIB_CONFFILE=/usr/local/etc/ts.conf
export TSLIB_PLUGINDIR=/usr/local/lib/ts
export TSLIB_FBDEVICE=/dev/fb0

You may also have to add the lib (/usr/local/lib) directory to your LD_LIBRARY_PATH :

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH

You want to put the above in your default profile (/etc/profile). Each device name varies depending on your kernel. For the detailed explanation about the variables, you can refer README file comes with tslib source.

Now you can run some executable files comes with the tslib, such as


For the plugins (/usr/local/lib/ts), you can safely delete files you don't need. Usually you need:

for your plugins.

Qt embedded

Download the qt embedded source and expand it on your working directory, e.g.,


Before do anything, edit qmake.conf for your toolchain
and add the following lines:

QMAKE_INCDIR = /home/user/tslib_arm/include
QMAKE_LIBDIR = /home/user/tslib_arm/lib

The last line is important although it is not mentioned elsewhere.
Now you can run configure with basic parameters:

./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ \
-qt-kbd-linuxinput -qt-mouse-tslib -qt-gfx-linuxfb \
-little-endian -prefix-install -depths 16,18,24 -optimized-qmake

You can add some additional parameters for your convenience:

-release -opensource -confirm-license

And you can also opt out unused components:

-no-webkit -no-cups -no-largefile -no-openssl -no-mmx -no-sse -no-sse2

For the explanation of each parameter you can find by running:

./configure -embedded -help

After the configure, you may want to edit ./src/corelib/Makefile and add librt link option:

set LFLAGS = -lrt ......

Now, you are ready to go

$ make
$ sudo make install

It will take more than 30minutes to finish. After deploying Qt to your device, you may have to copy additional libraries from your tool chain system such as:

(from arm-none-linux-gnueabi/libc/lib)
libdl*, libptread*, librt*
(from arm-none-linux-gnueabi/libc/usr/lib)*

Qt also requires some environmental variables to run. Add following line to your profile

export QTDIR=/usr/local/QtEmbedded-4.7.3-arm
export PATH=$QTDIR/bin:$PATH
export LD_LIBRARY_PATH=$QTDIR/lib:/usr/local/lib:$LD_LIBRARY_PATH
export QWS_MOUSE_PROTO="TSLIB:/dev/input/event1"
export QWS_KEYBOARD=TTY:/dev/tty1

Be sure to give -qws option for the first qt application you want to run.

If you have a warning like

Could not read calibration: "/etc/pointercal"

when you run qt application, then probably your calibration file is located elsewhere (/usr/local/etc) as in this example. So you have to set an environmental variable

export POINTERCAL_FILE=/usr/local/etc/pointercal

to override the default hard coded calibration file location.

additional information

Qt embedded uses /tmp as its temporary data storage. To change this, use

#define QT_PRIVATE_QWS 1
#define QT_QWS_TEMP_DIR "/usr/local/tmp

when you compile Qt.

No comments:

Post a Comment