Qt/Embedded
Instructions to install and use QtEmbedded & Qt virtual frame buffer for Armadeus
Contents
Introduction
This page will summarize the process to build, install and use Qt Embedded (previously known as Qtopia).
You will also find instructions to setup a Host development environment for simulating applications before deploying them on the target (Qt virtual frame buffer). The Builroot tree must be installed before the installation of Qt.
Installation
From November 20th 2007, Qt Embedded is now fully integrated in Armadeus Buildroot (old procedure is kept here). So to install it you have to:
[armadeus]$ make menuconfig
[*] Package Selection for the target ---> [*] Graphic libraries and applications (graphic/text) ---> *** other GUIs *** [*] Qt ---> --- Qt [ ] Compile with debug support Library type (Shared library) ---> [*] Approve free license [ ] Compatibility with Qt3 [*] Gui Module Pixel depths ---> Fonts ---> freetype2 support (no freetype2 support) ---> [*] Enable GIF support [ ] Enable libmng support JPEG support (System libjpeg) ---> PNG support (No PNG support) ---> TIFF support (No TIFF support) ---> zlib support (Qt zlib) ---> (arm) The embedded platform we are making Qt for [ ] SQL Module ---> Graphics drivers ---> Mouse drivers ---> Keyboard drivers ---> [ ] Phonon Module [*] XML Module [ ] XML Patterns Module [ ] SVG Module -*- Network Module [ ] WebKit Module [ ] STL support [ ] Enable OpenSSL support [*] Script Module [ ] Script Tools Module
(don't forget Pixel depths submenu options (at least 8 and 16))
- If you want touchscreen support:
Mouse drivers ---> ... [*] tslib
then:
[armadeus]$ make
1 hour and ~1 GBytes later (depending on your system and the configuration you choosed) your will have the beast. You can then reflash your rootfs.
Touchscreen handling
- Configure your touchscreen by loading the corresponding driver (depends on your APF) and calibrating it (at first use)
- Then, before launching Qt app, do
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventXX (replace XX with the right number)
Mouse handling
USB Mouse
Qt configuration
- If you manually build Qt, you have to add the USB mouse driver option in the configuration:
$ configure -qt-mouse-pc .......
- If you let Buildroot build Qt, select the USB mouse option in the configuration menu:
[*] Graphic libraries and applications (graphic/text) ---> *** other GUIs *** [*] Qt ---> --- Qt ... Graphics drivers ---> Mouse drivers ---> [*] pc [ ] bus [ ] linuxtp [ ] yopy [ ] vr41xx [ ] tslib [ ] qvfb Keyboard drivers ---> ...
- Then build & install Qt or let Buildroot build.
Linux configuration
To use USB mouse, there are some drivers to install in Linux.
- First open the Linux configuration menu:
[armadeus]$ make linux26-menuconfig
- Select the Mouse interface and PS/2 Mouse drivers in the menu:
Device drivers ---> ... Input device support ---> ... *** Userland interfaces *** <*> Mouse interface [*] Provide legacy /dev/psaux device (1024) Horizontal screen resolution (768) Vertical screen resolution ... *** Input Device Drivers *** [ ] Keyboards ---> [*] Mice ---> --- Mice <M> PS/2 mouse [*] ALPS PS/2 mouse protocol extension [*] Logitech PS/2++ mouse protocol extension [*] Synaptics PS/2 mouse protocol extension [*] IBM Trackpoint PS/2 mouse protocol extension [ ] Elantech PS/2 protocol extension [ ] eGalax TouchKit PS/2 protocol extension ...
- Then clean your Linux installation and rebuild it:
[armadeus]$ make linux26-clean [armadeus]$ make linux26 [armadeus]$ make
Embedded system configuration
- First flash your new kernel and rootfs and boot the system.
- When you connect the USB mouse to the system, a device is created in /dev/input/mouseXX. The touchscreen devices are also created as /dev/input/eventXX.
- To know which device is the USB mouse one, you have to check in:
# cat /sys/class/input/mouseXX/device/name
- Then you can tell Qt which driver to connect to the device to make it work:
- If you want the USB mouse only:
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX"
- For multiple pointer inputs, for example if you want to use an USB mouse along with a touchscreen, list all the possible pointers as follow:
# export QWS_MOUSE_PROTO="MouseMan:/dev/input/mouseXX Tslib:/dev/input/eventXX"
![]() |
Note: For a dynamic detection of an USB mouse, you can use the automatic driver like this:
# export QWS_MOUSE_PROTO="Tslib:/dev/input/eventXX Auto" |
- Then you can launch an application and use your USB mouse with it.
More infos are provided here: [1]
Test
If you want to test it, compile and put some examples in your TFTP directory:
$ make shell_env $ source armadeus_env.sh $ cd $ARMADEUS_QT_DIR/examples/widgets/ $ $ARMADEUS_QT_DIR/bin/qmake widgets.pro $ make ... $ cp digitalclock/digitalclock /tftpboot $ cp calculator/calculator /tftpboot
and then launch it on your APF (supposed you have a running & calibrated touchscreen):
# cd /usr/bin/ # tftp -g -r calculator 192.168.0.xx (Host IP) # chmod a+x calculator # export QWS_MOUSE_PROTO="Tslib:/dev/input/event0" # # ./calculator -qws
Demo
A client/server (with GUI) demo is available under: software/demos/ApfDacClientServer/. It could be a good starting point to show you how to create standalone Qt applications (will probably require some modifications in src/build.sh depending on your Host Qt installation).
![](/wiki/images/9/96/Qtdemo.png)
Usage
By default Qt libraries are installed in /usr/lib/ directory of your target rootfs.
How to cross-compile an application using Qt Embedded
The first thing you need to do is to define a specific "qmake specs directory" for armadeus. Here for example:
$ mkdir $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
and install the two following files into this new directory: qmake.conf & qplatformdefs.h. qmake.conf may be customized if necessary.
Then, you must define two typical environment variables :
QTDIR which defines the Qt installation path
& QMAKESPEC which defines the path to the configuration files of the qmake tool
Here two typical lines of a Qtopia application building script
$ export QTDIR=/usr/local/Trolltech/QtEmbedded-4.5.3 $ export QMAKESPEC= $APPLICATION_ROOT_DIR/mkspecs/linux-arm-g++
Adapt the QTDIR path to your own installation path and compile your code now, using theses commands:
# build the makefile with the qmake command (See Trolltech documentation for details about qmake): $QTDIR/bin/qmake -spec my.pro # and now compile the beast... : $ make
Good luck....
Phonon installation with Qt Embedded
Prerequisites
In order to use Phonon with Qt, first you need to install some other libraries. You may even need to cross-compile them, depending on the platform you want to run Qt on.
For x86 platform
- You only have to install GStreamer and some plugins with the following command :
$ sudo apt-get install libgstreamer0.10-0 $ sudo apt-get install libgstreamer0.10-dev $ sudo apt-get install libgstreamer-plugins-base0.10-0 $ sudo apt-get install libgstreamer-plugins-base0.10-dev
![]() |
Note: These packages are available for Linux Ubuntu ; but for other distributions, the names may vary. |
- To use some audio, image or video format like mp3, mpeg2, png or ogg:
- First you must install on your system the needed libraries for the particular format you want (like libmpeg2, libpng, libmad...)
- Then you can install these gstreamer plugins:
$ sudo apt-get install gstreamer0.10-plugins-good $ sudo apt-get install gstreamer0.10-plugins-ugly
There also are other plugin packages which you can find the list at : GStreamer
For embedded platform
If you want to build Qt with Phonon for embedded platform, you'll need to cross-compile the following libraries for the same platform:
- libxml2 >= 2.7.7
- libcheck >= 0.9.8
- liboil >= 0.3.2
- gstreamer >= 0.10.0
- gst-plugins-base >= 0.10.0
There are some required libraries that you can compile and install with Buildroot:
- glib >= 2.16
- Optional:
- libpng
- tiff
- jpeg
- ...
For additional audio and video formats, you have to cross-compile the corresponding libraries and then the following gstreamer's plugins :
- gst-plugins-good >= 0.10.0
- gst-plugins-ugly >= 0.10.0
Cross-compiling libraries
- First thing to do is to set the PKG_CONFIG_PATH environment variable to the directories containing your embedded libraries' pkgconfig files.
- To see what environment variable you can modify to impact the library cross-compiling, enter the command :
$ ./configure --help
Then create a file to define all required environment variables for the cross-compiling. For instance for glib2:
$ export CC=arm-linux-gcc $ export CXX=arm-linux-g++ $ export CFLAGS="-I/usr/local/libxml2/include/libxml2" $ export LDFLAGS=-L/usr/local/libxml2/lib
And then, to create your environment, type :
$ source ENVIRONMENT_FILE
- Finally you can configure your library like this:
$ ./configure --build=x86-linux --host=YOUR_EMBEDDED_PLATFORM --prefix==YOUR_INSTALLATION_PATH
Then build and install the library.
Build Qt
For x86 platform
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's x86 libraries and headers.
All you need to do then is to configure Qt with the phonon option and its backend :
$ ./configure -embedded x86 -debug -no-cups -no-nis -depths 16,18,24 -no-qt3support -qvfb -phonon -phonon-backend -prefix YOUR_INSTALLATION_PATH -confirm-license
Then build and install Qt and you will be able to use Phonon on your x86 platform.
For embedded platform
The PKG_CONFIG_PATH and pkgconfig files must be correctly set to point toward gstreamer's and glib's embedded libraries and headers.
Then you can configure Qt with glib, phonon and its backend and by adding the pkgconfig option :
$ ./configure -embedded YOUR_EMBEDDED_PLATFORM -xplatform YOUR_PLATFORM_MKSPECS -depths 16,18 -no-cups -no-nis -no-qt3support -phonon -phonon-backend -glib -prefix YOUR_INSTALLATION_PATH -force-pkg-config
![]() |
Note: You may need to give the cross-compiler the paths toward gstreamer's and glib's libraries and headers as configuration options. |
Possible problems encountered
During Qt Embedded or prerequisited cross-compiling, you may get the following errors :
- Impossible constraint in 'asm':
It means you include the wrong headers needed by the library you compile in CFLAGS or CXXFLAGS. Do not include -I/usr/include or non-cross-compiled headers.
- Cannot run test program:
Your best shot is to look in configure.ac (or configure.in) and see if there's a "cache variable" for that test. If so, you can set that variable in your environment, to the expected answer for your target, before running configure, and it should bypass the actual test. If there's no cache variable, you'll need to modify configure.ac (or configure.in) to set the variable manually, and rebuild configure.
- Do not forget to set your PKG_CONFIG_PATH variable to point toward the directory containing your embedded library pkgconfig files. By default, the x86 pkgconfig files are checked and so, errors occur.
- When installing libraries : arm-linux-g++: command not found
You have to directly export the PATH toward your cross-compiler in the file libtool to get through this error.
- In gst-plugins-base, delete manually the compilation of icles in the file tests/Makefile. The lines to delete are l.377 and l.382.
Work in progress / to do list
- Customization of the Qt libs to have a custom Qt/E library well designed for Armadeus usage.
Licenses
Since Qt 4.5.2 new licensing schemes are available: http://www.qtsoftware.com/products/licensing/licensing#qt-gnu-lgpl-v