Embedding Qt
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

Embedding Qt

on

  • 3,667 views

A workshop in Qt for embedded Linux.

A workshop in Qt for embedded Linux.

Statistics

Views

Total Views
3,667
Views on SlideShare
3,658
Embed Views
9

Actions

Likes
0
Downloads
75
Comments
0

2 Embeds 9

http://www.slideshare.net 8
http://www.health.medicbd.com 1

Accessibility

Categories

Upload Details

Uploaded via as OpenOffice

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Embedding Qt Presentation Transcript

  • 1. Embedding Qt A workshop in running Qt on embedded Linux targets
  • 2. Johan Thelin
    • Books, articles, whitepapers, tutorials
    • 3. Training (embedded Linux, etc)
    • 4. Various embedded Qt-based products
    • 5. Qt mentoring
    • 6. Networking (human to human)
    • 7. Founder and moderator at QtCentre
    • 8. Looking for Qt jobs related to Formula 1!
  • 9. Two minutes of Qt
    • Developed since 1991
    • 10. Licensing controversy 1998
    • 11. GPL since 2005 (X11 2000, OS X 2003)
    • 12. LGPL on all platforms since 2008
    • 13. Trolltech was bought by Nokia 2008, renamed to Qt Software Qt Development Frameworks.
    • 14. We call them Qt, and the developers are trolls.
  • 15. Two minutes of Qt
    • Desktop: Windows, OS X and X11
    • 16. Goal: native applications from one source
      • GLIB integration
      • 17. Styling, etc
    • Embedded: Windows CE, Symbian S60, Linux
    • 18. 100+ million devices out there!
  • 19. The Qt Community
    • An open development model
    • 20. Developer blogs:
      • labs.trolltech.com
      • 21. planetqt.org
    • Forums, wikis, IRC channels:
      • qtcentre.org – forum, wiki, news
      • 22. qtnode.net – #qt on freenode, wiki
      • 23. Much more...
  • 24. Workshop
    • Compiling compiling compiling compiling
    • 25. Compiling
    • 26. Compiling compiling compiling
    • 27. Compiling compiling compiling compiling
    • 28. Compiling compiling compiling
    • 29. Compiling compiling
    • 30. Compiling compiling compiling
    • 31. Compiling compiling compiling compiling
    • 32. Compiling compiling compiling
  • 33. Workshop
    • Background – a common development setup
    • 34. Getting the source
    • 35. Configuring and building for X11
    • 36. Working with multiple installs of Qt and QMake
    • 37. Configuring and building for QVFb
    • 38. Embedded Linux 101
    • 39. Configuring Qt for Embedded Linux
    • 40. Deploying Qt on an embedded Linux target
    • 41. Testing the Development Setup
  • 42. The Development Setup
    • The setup consists of three installations of Qt
      • Qt for X11 – runs on host, used for tools.
      • 43. Qt for QVFb – runs on host with emulated devices
      • 44. Qt for target – runs on target, the real deal.
    • QVFb – Qt Virtual Framebuffer lets you
      • Prototype
      • 45. Emulate for simplified debugging
      • 46. Great for screenshots for manuals and designers
  • 47. Getting the Sources
    • Sources are found at qt.nokia.com/downloads
  • 48. Getting the Sources
    • Or you grab a snapshot from qt.gitorious.org
  • 49. Getting the Sources
    • I have a USB stick with tar.gz-archives for today
    • 50. Use Embedding Qt/*
  • 51. $ ./configure --help Usage: configure [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>] [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support] [-platform] [-D <string>] [-I <string>] [-L <string>] [-help] [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>] [-no-make <part>] [-R <string>] [-l <string>] [-no-rpath] [-rpath] [-continue] [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [-no-iconv] [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [-no-xmlpatterns] [-xmlpatterns] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [-no-webkit] [-webkit] [-no-scripttools] [-scripttools] [additional platform specific options (see below)] Configuring Qt for X11
    • And then there are the undocumented switches...
  • 52. $ ./configure --help Usage: configure [-h] [ -prefix <dir> ] [-prefix-install] [-bindir <dir>] [-libdir <dir>] [-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-datadir <dir>] [-translationdir <dir>] [-sysconfdir <dir>] [-examplesdir <dir>] [-demosdir <dir>] [-buildkey <key>] [-release] [-debug] [-debug-and-release] [-developer-build] [-shared] [-static] [-no-fast] [-fast] [-no-largefile] [-largefile] [-no-exceptions] [-exceptions] [-no-accessibility] [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>] [-plugin-sql-<driver>] [-system-sqlite] [ -no-qt3support ] [-qt3support] [-platform] [-D <string>] [-I <string>] [-L <string>] [-help] [-qt-zlib] [-system-zlib] [ -no-gif ] [-qt-gif] [ -no-libtiff ] [-qt-libtiff] [-system-libtiff] [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng] [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>] [ -no-make <part> ] [-R <string>] [-l <string>] [-no-rpath] [-rpath] [-continue] [-verbose] [-v] [-silent] [-no-nis] [-nis] [-no-cups] [-cups] [ -no-iconv ] [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa] [-no-optimized-qmake] [-optimized-qmake] [ -no-xmlpatterns ] [-xmlpatterns] [-no-phonon] [-phonon] [-no-phonon-backend] [-phonon-backend] [-no-openssl] [-openssl] [-openssl-linked] [-no-gtkstyle] [-gtkstyle] [-no-svg] [-svg] [ -no-webkit ] [-webkit] [-no-scripttools] [-scripttools] [additional platform specific options (see below)] Configuring Qt for X11
    • -prefix path -no-qt3support -nomake demos -nomake examples
  • 53. Which edition of Qt do you want to use ? Type 'c' if you want to use the Commercial Edition. Type 'o' if you want to use the Open Source Edition. o This is the Qt/X11 Open Source Edition. You are licensed to use this software under the terms of the Lesser GNU General Public License (LGPL) versions 2.1. You are also licensed to use this software under the terms of the GNU General Public License (GPL) versions 3. Type '3' to view the GNU General Public License version 3. Type 'L' to view the Lesser GNU General Public License version 2.1. Type 'yes' to accept this license offer. Type 'no' to decline this license offer. Do you accept the terms of either license? yes Creating qmake. Please wait... Configuring Qt for X11 Let this run through, then run make .
  • 54. Multiple Qt Installs and QMake
    • QMake builds Makefiles (and projects, etcetera)
      • Build a project file: qmake -project
      • 55. Build a Makefile from a project file: qmake
    • For this, QMake knows about
      • The compiler to use
      • 56. Paths and libraries to use
    • QMake is built when configuring Qt, so each Qt installation has a different QMake.
  • 57. Multiple Qt Installs and QMake Change qmake: make dist clean && qmake-nn qmake-x11 qmake-target qmake-qvfb Makefile + Executable project.pro cpp h ui qrc
  • 58. Building the QVFb
    • The QVFb tool is not built automatically when building Qt for X11.
    cd tools/qvfb make make install
  • 59. Configuring Qt for QVFb
    • Problem: The sources are extracted to qt-embedded-... . This is the same directory as will be used by the target sources.
    • 60. Solution: Rename to qt-qvfb!
  • 61. Configuring Qt for QVFb $ ./configure --help Usage: ... [additional platform specific options (see below)] ... Qt for Embedded Linux only: -xplatform target ... The target platform when cross-compiling. -no-feature-<feature> Do not compile in <feature>. -feature-<feature> .. Compile in <feature>. The available features are described in src/corelib/global/qfeatures.txt -embedded <arch> .... This will enable the embedded build, you must have a proper license for this switch to work. Example values for <arch>: arm mips x86 generic -armfpa ............. Target platform is uses the ARM-FPA floating point format. -no-armfpa .......... Target platform does not use the ARM-FPA floating point format. The floating point format is usually autodetected by configure. Use this to override the detected value. -little-endian ...... Target platform is little endian (LSB first). -big-endian ......... Target platform is big endian (MSB first). -host-little-endian . Host platform is little endian (LSB first). -host-big-endian .... Host platform is big endian (MSB first). You only need to specify the endianness when cross-compiling, otherwise the host endianness will be used. -no-freetype ........ Do not compile in Freetype2 support. -qt-freetype ........ Use the libfreetype bundled with Qt. * -system-freetype .... Use libfreetype from the operating system. See http://www.freetype.org/ -qconfig local ...... Use src/corelib/global/qconfig-local.h rather than the default (full). -depths <list> ...... Comma-separated list of supported bit-per-pixel depths, from: 1, 4, 8, 12, 15, 16, 18, 24, 32 and 'all'. -qt-decoration-<style> ....Enable a decoration <style> in the QtGui library, by default all available decorations are on. Possible values for <style>: [ styled windows default ] -plugin-decoration-<style> Enable decoration <style> as a plugin to be linked to at run time. Possible values for <style>: [ default styled windows ] -no-decoration-<style> ....Disable decoration <style> entirely. Possible values for <style>: [ styled windows default ] -no-opengl .......... Do not support OpenGL. -opengl <api> ....... Enable OpenGL ES support With no parameter, this will attempt to auto-detect OpenGL ES 1.x or 2.x. Use es1, es1cl or es2 for <api> to override auto-detection. NOTE: A QGLScreen driver for the hardware is required to support OpenGL ES on Qt for Embedded Linux. -qt-gfx-<driver> ... Enable a graphics <driver> in the QtGui library. Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ] -plugin-gfx-<driver> Enable graphics <driver> as a plugin to be linked to at run time. Possible values for <driver>: [ ahi directfb hybrid linuxfb powervr qvfb transformed vnc ] -no-gfx-<driver> ... Disable graphics <driver> entirely. Possible values for <driver>: [ linuxfb transformed qvfb vnc multiscreen ] -qt-kbd-<driver> ... Enable a keyboard <driver> in the QtGui library. Possible values for <driver>: [ tty usb sl5000 yopy vr41xx qvfb ] -plugin-kbd-<driver> Enable keyboard <driver> as a plugin to be linked to at runtime. Possible values for <driver>: [ linuxis sl5000 usb vr41xx yopy ] -no-kbd-<driver> ... Disable keyboard <driver> entirely. Possible values for <driver>: [ tty usb sl5000 yopy vr41xx qvfb ] -qt-mouse-<driver> ... Enable a mouse <driver> in the QtGui library. Possible values for <driver>: [ pc bus linuxtp yopy vr41xx tslib qvfb ] -plugin-mouse-<driver> Enable mouse <driver> as a plugin to be linked to at runtime. Possible values for <driver>: [ bus linuxis linuxtp pc tslib vr41xx yopy ] -no-mouse-<driver> ... Disable mouse <driver> entirely. Possible values for <driver>: [ pc bus linuxtp yopy vr41xx tslib qvfb ] -iwmmxt ............ Compile using the iWMMXt instruction set (available on some XScale CPUs). -no-glib ........... Do not compile Glib support. + -glib .............. Compile Glib support.
  • 62. Configuring Qt for QVFb -prefix path -no-... -nomake examples -nomake demos -qt-freetype -qt-zlib -no-gif -qt-libjpeg -qt-libpng -depths 8,16 -qt-kbd-qvfb -qt-mouse-qvfb -qt-gfx-qvfb Use the same tricks as with Qt for X11 Use Qt's versions of 3 rd party libraries Depths limits you to what your target has -qt-*-qvfb builds with drivers for the virtual target There are more options – now configure and make
  • 63. Embedded Linux 101
    • Linux kernel
      • Can be pre-configured for the specific board to reduce boot time
      • 64. Can contain all drivers (avoid loading modules)
      • 65. Can contain parts or the full file system.
    • Same or smaller C lib
      • glibc works – uclibc, newlib, etc are smaller
    • Fewer and smaller utilities
      • busybox replaces most tools
      • 66. Avoid all extras (usually not shipping with emacs)
  • 67. Embedded Linux 101
    • Different architecture means that you need to cross compile.
    • 68. The entire system is usually built into one or a few binary images.
      • Kernel + initial file system
      • 69. Additional file systems
    • Use the available infrastructure!
      • buildroot, scratchbox, openembedded, etc
  • 70. Qt for Embedded Linux Dependencies
    • Graphics needs a framebuffer
      • Can acceleration, e.g. PowerVR (TI OMAP), DirectFB, etcetera.
    • Touch based input needs tslib
      • tslib.berlios.org
    • You can provide custom Qt back-ends for graphics, mouse, keyboard.
  • 71. Configuring Qt for Embedded Linux
    • No hardware here today, but lets target an imaginary ARM board.
    • 72. Possible real targets for the curious:
      • An old PC (or a newer one...)
      • 73. BeagleBoard
      • 74. AT91SAM9263-EK
      • 75. Toradex Colibri
  • 76. Configuring Qt for Embedded Linux Use the same setup as for your QVFb Prepare for an embedded target and a cross compilation -prefix path -no-... -nomake examples -nomake demos -qt-freetype ... -depths 8,16 -embedded arch -xplatform mkspec
  • 77. Configuring Qt for Embedded Linux
    • The arch names your target architecture
      • x86, x86_64, ia64, arm, powerpc, mips, sh, sh4a
      • 78. Gives you architecture specific implementations, e.g. qatomic_i386.h
  • 79. Configuring Qt for Embedded Linux
    • The mkspec describes your build environment
    ... #define QT_SOCKET_BIND ::bind #define QT_FILENO fileno #define QT_CLOSE ::close #define QT_READ ::read #define QT_WRITE ::write #define QT_ACCESS ::access #define QT_GETCWD ::getcwd #define QT_CHDIR ::chdir #define QT_MKDIR ::mkdir #define QT_RMDIR ::rmdir #define QT_OPEN_LARGEFILE O_LARGEFILE #define QT_OPEN_RDONLY O_RDONLY #define QT_OPEN_WRONLY O_WRONLY #define QT_OPEN_RDWR O_RDWR #define QT_OPEN_CREAT O_CREAT #define QT_OPEN_TRUNC O_TRUNC #define QT_OPEN_APPEND O_APPEND #define QT_SIGNAL_RETTYPE void #define QT_SIGNAL_ARGS int #define QT_SIGNAL_IGNORE SIG_IGN #if defined(__GLIBC__) && (__GLIBC__ >= 2) #define QT_SOCKLEN_T socklen_t ... ... QMAKE_CC = arm-linux-gcc QMAKE_CXX = arm-linux-g++ QMAKE_LINK = arm-linux-g++ QMAKE_LINK_SHLIB = arm-linux-g++ # modifications to linux.conf QMAKE_AR = arm-linux-ar cqs QMAKE_OBJCOPY = arm-linux-objcopy QMAKE_STRIP = arm-linux-strip ... qmake.conf qplatformdefs.h
  • 80. Deploying Qt for Embedded Linux
    • What do you need to deploy?
      • Your binary
      • 81. Qt library
      • 82. Qt plug-ins
      • 83. Fonts
      • 84. Environment variables
      • 85. Command line arguments
  • 86. Deploying Qt for Embedded Linux
    • Qt library
      • Place either according to -prefix , or in LD_LIBRARY_PATH
    • Qt plug-ins
      • Place according to -prefix , or add a qt.conf file, or call QApplication::addLibraryPath to add paths
    • Fonts
      • Place either according to -prefix , or point at using QT_QWS_FONTDIR
  • 87. Deploying Qt for Embedded Linux
    • Environment variables
      • QWS_MOUSE_PROTO
      • 88. QWS_KEYBOARD
      • 89. QWS_DISPLAY
    • Command line arguments
      • -qws
  • 90. Testing the Environment
    • In the Qt for QVFb source tree, cd to examples/widgets/wiggly
    • 91. Run qmake-qvfb * (specify full path) && make
    • 92. Start QVFb and pick a skin
    • 93. Start ./ wiggly -qws
    • 94. Enjoy!
    • 95. For the brave and curious, try running
    • 96. make distclean && qmake-x11 && make
    • 97. ./wiggly
    * I like to create soft links to the different qmakes and name them qmake-x11, qmake-qvfb, etcetera
  • 98. Thank you for your attention! www.thelins.se