Difference between revisions of "Qt/Embedded"
(→Mouse handling) |
|||
Line 67: | Line 67: | ||
==Mouse handling== | ==Mouse handling== | ||
+ | |||
+ | ===USB Mouse=== | ||
==Test== | ==Test== |
Revision as of 09:29, 25 October 2010
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
[*] 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.
Mouse handling
USB Mouse
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).
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 variable 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