Monday, March 10, 2014

Qt 5.2.1 Beaglebone Binaries

Overview

So, how did I create these binaries....well I thought it would be fun to see how long it would take the Beaglebone to compile Qt. Here is a brief description of my setup.

I powered the Beaglebone with a 5v power supply and booted a Debian rootfs using TFTP and NFS (a future post will explain how to configure this) so I could utilize the large HD of my Linux host. After compiling and installing Qt, the total root filesystem usage is around 3 Gb. The actual compile took about 21 hours, which includes compiling all examples and plugins.

Configuration

I created a simple shell script to modify the Qt source, with the Beaglebone configuration, and run the Qt configuration script:
#!/bin/sh
# Create beaglebone hard float configuration file
cd qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/devices/
cp -r linux-beagleboard-g++ linux-beaglebone-g++
sed 's/softfp/hard/' <linux-beagleboard-g++/qmake.conf >linux-beaglebone-g++/qmake.conf
# Run configuration
cd ../../../
./configure -v -opensource -confirm-license -prefix /usr/local/qt-5.2 -no-largefile -no-accessibility -qt-zlib -no-gif -qt-libpng -qt-libjpeg -no-nis -no-cups -device linux-beaglebone-g++


This produced the following summary:
   Configure summary
Build type:    linux-g++ (arm, CPU features:)
Platform notes:
            - Also available for Linux: linux-kcc linux-icc linux-cxx
        
qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV QT_CFLAGS_DBUS = -I/usr/include/dbus-1.0 -I/usr/lib/arm-linux-gnueabihf/dbus-1.0/include   QT_LIBS_DBUS = -ldbus-1   QT_CFLAGS_GLIB = -pthread -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include   QT_LIBS_GLIB = -pthread -lgthread-2.0 -lrt -lglib-2.0   QT_CFLAGS_PULSEAUDIO = -D_REENTRANT -I/usr/include/glib-2.0 -I/usr/lib/arm-linux-gnueabihf/glib-2.0/include   QT_LIBS_PULSEAUDIO = -lpulse-mainloop-glib -lpulse -lglib-2.0   DEFINES += QT_NO_LIBUDEV QMAKE_CFLAGS_XCB =   QMAKE_LIBS_XCB = -lxcb   QMAKE_CFLAGS_DIRECTFB = -D_REENTRANT -I/usr/include/directfb   QMAKE_LIBS_DIRECTFB = -ldirectfb -lfusion -ldirect -lpthread   sql-drivers =  sql-plugins =  sqlite qmake switches ......... 
Build options:
  Configuration .......... alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent dbus directfb evdev eventfd full-config getaddrinfo getifaddrs glib iconv inotify ipv6ifname large-config linuxfb medium-config minimal-config mremap neon no-gif no-harfbuzz opengl openssl pcre png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports reduce_relocations release rpath shared small-config system-freetype xcb xcb-qt xkbcommon-qt xlib zlib 
  Build parts ............ libs tools examples
  Mode ................... release
  Using C++11 ............ yes
  Using PCH .............. yes
  Target compiler supports:
    iWMMXt/Neon .......... no/yes
Qt modules and options:
  Qt D-Bus ............... yes (loading dbus-1 at runtime)
  Qt Concurrent .......... yes
  Qt GUI ................. yes
  Qt Widgets ............. yes
  JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
  QML debugging .......... yes
  Use system proxies ..... no
Support enabled for:
  Accessibility .......... no
  ALSA ................... yes
  CUPS ................... no
  FontConfig ............. no
  FreeType ............... system
  Iconv .................. yes
  ICU .................... no
  Image formats: 
    GIF .................. no
    JPEG ................. yes (plugin, using bundled copy)
    PNG .................. yes (in QtGui, using bundled copy)
  Glib ................... yes
  GTK theme .............. no
  Large File ............. no
  mtdev .................. no
  Networking: 
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (loading libraries at run-time)
  NIS .................... no
  OpenGL ................. desktop
  OpenVG ................. no
  PCRE ................... yes (bundled copy)
  pkg-config ............. yes 
  PulseAudio ............. yes
  QPA backends: 
    DirectFB ............. yes
    EGLFS ................ no
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. yes (bundled copy)
      MIT-SHM ............ yes
      Xcb-Xlib ........... no
      Xcursor ............ yes (loaded at runtime)
      Xfixes ............. yes (loaded at runtime)
      Xi ................. yes (loaded at runtime)
      Xi2 ................ no
      Xinerama ........... yes (loaded at runtime)
      Xrandr ............. yes (loaded at runtime)
      Xrender ............ no
      XKB ................ yes
      XShape ............. yes
      XSync .............. yes
      XVideo ............. yes
  Session management ..... yes
  SQL drivers: 
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
  udev ................... no
  xkbcommon .............. yes (bundled copy)
  zlib ................... yes (bundled copy)
NOTE: libxkbcommon 0.2.0 (or higher) not found on the system, will use 
the bundled version from 3rd party directory.
NOTE: Qt is using double for qreal on this system. This is binary incompatible against Qt 5.1.
Configure with '-qreal float' to create a build that is binary compatible with 5.1.

If you've tried cross compiling Qt, from my other posts, you will notice a lot more modules are enabled in this build.

I've tested a few examples and they all work, but I have not tested everything (haven't been able to test touch screen stuff yet). The examples default to using X11, if you want to use the linuxfb, add '-platform linuxfb' to the command line options. For example:
> analogclock -platform linuxfb

Here are two versions of binaries, one that includes examples (78 Mb) and one that does not (36 Mb).

MD5SUM:
9395fc70f576e58b68df7d732a002abb  qt-5.2-no-examples.tgz
f698f038166c4b2f65cec40056e23db2  qt-5.2.tgz

Extract to /usr/local, as the tarball contains the qt-5.2 folder in it.

If you want to try your hand at compiling applications on the Beaglebone, these packages have a native qmake included. Don't forget to add /usr/local/qt-5.2/bin to your path.

Have fun!

13 comments:

  1. first of all thanks for your tutorials.
    ı run the first tutorial on the ubuntu 12.04 console version on linuxfb on BBB. but ı can not run this compiled version on it. every time ı am taking this error:
    error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory
    also ı tried on ubuntu 13 and debian versions. result is same. but at the ubuntu 12.04lste desktop version ı can run the some examples. how can ı run these on the console version.

    ReplyDelete
  2. I will do some investigating. I compiled and ran these binaries on the Beaglebone Debian beta (build date March 4th) Kernel 3.8.13-bone41.

    When I issue 'ldd /usr/local/qt-5.2/examples/opengl/cube', I show libGL.so.1 as being located in the /usr/lib/arm-linux-gnueabihf/ folder.

    I don't know if OpenGL is working yet on Kernel 3.8.....FYI

    ReplyDelete
  3. Thanks,
    Also ı tried install lsb-graphics and libgl1-mesa-glx packeges. then ı take this message:

    This application failed to start because it could not find or load the Qt platform plugin "xcb".

    Available platform plugins are: directfbegl, directfb, linuxfb, minimal, offscreen, xcb.

    Reinstalling the application may fix this problem.
    Aborted

    ReplyDelete
  4. Verify that your application was compiled with the Qt path set to /usr/local/qt-5.2.

    I think you can pass a command line option to point to the correct path, but I have not tested that.

    You can also try other platform plugins by adding a command line option "-platform linuxfb" or similar.

    ReplyDelete
  5. Hi,
    Thanks for your tutorials! I spent so many weeks with Qt while I found your tutorials.
    Now Qt is working on my BBB with Ubuntu (13.10). First there was a little problem with the text, but this is a known issue in 5.2.0 under linuxfb. Fixed in 5.2.1.
    I have a 4.3" LCD from 4D SYSTEMS. The touch screen is also working just I had to use a plugin:

    ./xyz -platform linuxfb -plugin evdevtouch

    There isn't mouse cursor on the screen but it works!

    ReplyDelete
    Replies
    1. Hi Norbert, I have 4.3" LCD from 4D SYSTEMS too with debian and LXDE, and all work fine; resistive touch work too, but not properly calibrated: must I use this plugin?
      How can I install it? when I run "./xyz -platform linuxfb -plugin evdevtouch" I get "-bash: ./xyz: No such file or directory"...
      Thanks in advance

      Delete
  6. Hello
    Thank you for the wonderful lessons on how to compile Qt for BBB.
    Thanks to them, gathered qt-5.2.1.

    Tell us more what to do with the files from the archive
    I copied the folder qt-5.2 from the archive into the directory "/ usr/local/qt-5.2" (host machine Ubunta 12.04).

    When connecting qmake in QtCreator, an error message appears:
    «The qmake executable /usr/local/qt-5.2/bin/qmake could not added:
    Cannot start ‘/usr/local/qt-5.2/bin/qmake’: Exec format error»

    Why qmake file from the archive size 2.7M (qmake file in my assembly 18.7M)?

    Sorry for the bad text, I use a translator

    ReplyDelete
  7. Hi, are you able to expand on your initial tutorial on how to get openGL to work? My program requires elgfs, but everytime i try to compile, I get the following message.

    opengles2.cpp:45:25: fatal error: GLES2/gl2.h: No such file or directory
    #include
    ^
    compilation terminated.
    make: *** [opengles2.o] Error 1
    OpenGL ES 2.x disabled.
    The OpenGL ES 2.0 functionality test failed!
    You might need to modify the include and library search paths by editing
    QMAKE_INCDIR_OPENGL_ES2, QMAKE_LIBDIR_OPENGL_ES2 and QMAKE_LIBS_OPENGL_ES2 in
    /home/billy/Desktop/qt-everywhere-opensource-src-5.2.1/qtbase/mkspecs/devices/linux-beaglebone-g++.

    ReplyDelete
  8. @Norbert - That is good news! I was going to get there eventually :)

    @Viktor - The binary files go on the Beaglebone. If you want to run qmake on your host, you need to use the cross compile method from my previous posts.

    @Billy - OpenGL does not work with Kernel 3.8 because you need to have hardware acceleration. The hw accel driver does not load with Kernel 3.8, only newer kernels

    ReplyDelete
  9. hi Louse,
    in your configure mysql driver not included. how can ı add mysql driver without re configure all staff.
    thanks for your help..

    ReplyDelete
  10. Hi Louis,
    thank you very much for your tutorial (including three of January).
    I want cross compile Qt for develop with QtCreator and run my application on BB with debian (X11 from http://elinux.org/Beagleboard:BeagleBoneBlack_Debian).
    Your bare-metal library works perfectly, both with example that with my test application (if compiled on BB!).

    Now I'm trying to cross-compile Qt on my pc with that configuration:

    ../qt-everywhere-opensource-src-5.2.1/configure -v
    -sysroot /home/user/qt-5.2-target/debian-7.5
    -opensource -confirm-license
    -prefix /usr/local/qt-deb-5.2.1
    -no-largefile -no-accessibility
    -qt-zlib -no-gif -qt-libpng -qt-libjpeg -no-nis -no-cups
    -xplatform linux-linaro-gnueabihf-g++
    -device linux-beaglebone-g++
    -device-option CROSS_COMPILE=/usr/local/linaro/bin/arm-linux-gnueabihf-

    If I cut -sysroot ... option I've no problem in compilation, but application can work only with linuxfb platform, not under X.
    with .sysroot (obviously the copy of my uSD file-system) configure give me that report:

    Build parts ............ libs examples
    Mode ................... release
    Using C++11 ............ yes
    Using PCH .............. yes
    Target compiler supports:
    iWMMXt/Neon .......... no/yes

    Qt modules and options:
    Qt D-Bus ............... no
    Qt Concurrent .......... yes
    Qt GUI ................. yes
    Qt Widgets ............. yes
    JavaScriptCore JIT ..... yes (To be decided by JavaScriptCore)
    QML debugging .......... yes
    Use system proxies ..... no

    Support enabled for:
    Accessibility .......... no
    ALSA ................... yes
    CUPS ................... no
    FontConfig ............. yes
    FreeType ............... system
    Iconv .................. yes
    ICU .................... no
    Image formats:
    GIF .................. no
    JPEG ................. yes (plugin, using bundled copy)
    PNG .................. yes (in QtGui, using bundled copy)
    Glib ................... no
    GTK theme .............. no
    Large File ............. no
    mtdev .................. no
    Networking:
    getaddrinfo .......... yes
    getifaddrs ........... yes
    IPv6 ifname .......... yes
    OpenSSL .............. yes (loading libraries at run-time)
    NIS .................... no
    OpenGL ................. desktop
    OpenVG ................. no
    PCRE ................... yes (bundled copy)
    pkg-config ............. yes
    PulseAudio ............. no
    QPA backends:
    DirectFB ............. yes
    EGLFS ................ no
    KMS .................. no
    LinuxFB .............. yes
    XCB .................. yes (system library)
    MIT-SHM ............ yes
    Xcb-Xlib ........... yes
    Xcursor ............ yes (loaded at runtime)
    Xfixes ............. yes (loaded at runtime)
    Xi ................. no
    Xi2 ................ yes
    Xinerama ........... yes (loaded at runtime)
    Xrandr ............. yes (loaded at runtime)
    Xrender ............ yes
    XKB ................ no
    XShape ............. yes
    XSync .............. yes
    XVideo ............. yes
    Session management ..... yes
    SQL drivers:
    DB2 .................. no
    InterBase ............ no
    MySQL ................ no
    OCI .................. no
    ODBC ................. no
    PostgreSQL ........... no
    SQLite 2 ............. no
    SQLite ............... yes (plugin, using bundled copy)
    TDS .................. no
    udev ................... no
    xkbcommon .............. yes (bundled copy)
    zlib ................... yes (bundled copy)

    but during "make" I get this error:

    /usr/local/linaro/bin/../lib/gcc/arm-linux-gnueabihf/4.7.3/../../../../arm-linux-gnueabihf/bin/ld: /home/user/qt-5.2-target/debian-7.5/usr/lib/arm-linux-gnueabihf/libm.a(mpa.o): relocation R_ARM_THM_MOVW_ABS_NC against `a local symbol' can not be used when making a shared object; recompile with -fPIC
    What have I to "recompile with -fPIC" ?
    I can't figure how proceed!

    I'm sure to be closer to my goal, but...

    Thank you in advance!

    ReplyDelete
  11. Thanks for the great work Louis!

    I'm having an issue getting started on this. I'm sure this is something dumb that I'm doing wrong. I'm trying to build on a Rev C with debian distro and 3.8.14-bone54.1 kernel. I have cross built using your instructions. The applications will build and run but the display is and input is not correct. I think you already know about this.

    I also downloaded your binaries and they ran perfectly on my BBB setup. But, I would like to try building on the BBB. I have tried 5.2.0 and 5.3.0 source but I'm getting the same issue with both.

    I get this out put when I run ./configure
    Creating qmake...
    make: Nothing to be done for `first'.
    Running configuration tests...
    Failed to process makespec for platform 'devices/linux-beaglebone-g++'
    Project ERROR: CROSS_COMPILE needs to be set via -device-option CROSS_COMPILE=
    Could not read qmake configuration file /home/debian/qt-everywhere-opensource-src-5.2.0/qtbase/mkspecs/devices/linux-beaglebone-g++/qmake.conf.
    Error processing project file: /dev/null

    I have verified that the qmake.conf file exists and is readable. And, I don't understand why it would complain about a cross compiler when I'm building on the BBB.

    Any help greatly appreciated.

    ReplyDelete
  12. Rick,

    I have been working on PCB designs for the last month or two, so I am a little rusty on the Qt side of things. Check to BBB build environment, look for compilers and other tools. It may be having trouble compiling qmake.

    Louis

    ReplyDelete