Developers' Notes

Here's info about how to compile Eazylink Client from sources for both Intel x86 and Arm platforms.The sections below describe the individual steps. For some platforms Qt5 is also necessary to be compiled from sources to achieve statically linked executable for EazyLink2.

 



 

Linux, Intel 32 and 64 bit (static compilation, abandoned)

  • Get the QT v5.4.2 sources from qt.io:
  • build for static compilation
    • ./configure -static -fontconfig -no-c++11 -no-qml-debug -no-openssl -gtkstyle -no-cups -no-use-gold-linker -nomake examples -prefix $HOME/QtStatic
  • Use Qt Creator, and setup of Kit for static compilation
  • Use Ermine to combine all libraries, so there's one executable for all Linux platforms

(K)ubuntu 15.04 Linux, Intel 32 and 64 bit, debian packages

Currently (Sept 2015) Ubuntu 15.04 and later support Qt5.4.x libraries. Kaosx already is using Qt v5.5 (however, is another package format - to be done, maybe) . Latest Debian 8 do not.  Support native Eazylink2 package for Ubuntu in Intel, since this Linux defines a good support point.

Running build environment: Ubuntu 15.04 desktop.

These build notes are based on this excellent tutorial: https://bhavyanshu.me/how-to-make-debian-packages-for-qt-c-based-applications/11/10/2014/.

Initial instalation of compilers, debian build tools and Qt5 developer packages

Install the following packages:

  • sudo apt-get update; sudo apt-get dist-upgrade    {update system to latest packages, system-wide}

  • sudo apt-get install git

  • sudo apt-get install build-essential dh-make pdebuild pbuilder

  • sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake qt5-default libqt5serialport5-dev libqt5serialport5

Establish the following for the Debian Package Builder environment:

In your .bashrc file (Located in Home folder), simply add the following lines for proper email and name:

DEBEMAIL="Email@address.com"
DEBFULLNAME="Your full name here"
export DEBEMAIL DEBFULLNAME

. ~/.bashrc

Ensure qmake is using Qt5 and that eazylink2 sources compiles succesfully:

> qmake -version

QMake version 3.0
Using Qt version 5.4.1 in /usr/lib/i386-linux-gnu

> git clone https://bitbucket.org/cambridge/eazylink2.git

Generate Makefile:

> qmake eazylink2.pro

then make. A successfull compilation produces bin/eazylink2. Now, we're ready to setup the Debian package compile environment.

Establish pbuilder environment for Ubuntu Vivid Vervet

Now first create a .pbuilderrc file. In that add the following

BASETGZ=$HOME/pbuilder/base.tgz
BUILDPLACE=$HOME/pbuilder/build/
BUILDRESULT=$HOME/pbuilder/result/
DEBEMAIL='Your Name <your@emaild.id>'
BUILDUSERNAME=home user login name
AUTO_DEBSIGN=yes
APTCACHEHARDLINK=no
COMPONENTS="main restricted universe multiverse"
DEBBUILDOPTS="-sa"

Creating a clean chroot environment
sudo pbuilder --create --distribution vivid --mirror "http://archive.ubuntu.com/ubuntu"

Import / create GPG keys for debian source / binary package signing

Debian package signing requires GPG keys, import, if you already them:

gpg --import ~/mygpgkey_pub.asc
gpg --allow-secret-key-import --import mygpgkey-secret.asc

or follow this guide to create them:

https://bhavyanshu.me/a-quick-guide-on-how-to-use-gnu-privacy-guard-gpg-to-generate-keys-and-distribute-them/11/27/2014/

Establish Debian source code folder structure

The source code is checked out from the Git repository, git clone https://bitbucket.org/cambridge/eazylink2.git.

Copy the checkout folder to a new, temporary place and remove the .git repo management contents:

cp fR eazylink2 /home/xxx/temp/eazylink2-1.0.0
cd /home/xxx/temp
rm -fR eazylink2/.git
mv eazylink2 eazylink2-1.0.0
tar czf eazylink2_1.0.0.orig.tar.gz eazylink2-1.0.0/

Create signed source package and build .deb installer package

cd eazylink2-1.0.0

debuild -i -I -S -sa  {build the source package + signing with gpg key}

pdebuild --debbuildopts -sa {build the installer package via the chroot environment, .deb output in /home/xxx/pbuilder/result}

 

Re-compiling from debian source package (download from SF)

If Eazylink2 was not available for a specific platform as a binary .deb installer package, generate a binary package from source debian package (download from Z88 SF Eazylink2 Client area *.deb.src.tar.gz) using the steps below. Eazylink2 requires Qt v5.4.1 or later to run.

In order to build the Eazylink2 source package, qt5 (5.4.1 or later) development packages and debian package build tools must be installed on your system. The eazylink2 source package is not part of a repository, it is necessary to manually establish the build package dependencies (we cannot use apt-get build-dep).

To rebuild this Debian Eazylink2 source package "manually" do as follows:

  • Install Basic compilers and debian package build tools:
    • sudo apt-get install build-essential fakeroot dpkg-dev devscripts dh-make
  • Install Qt5 dev packages:
    • sudo apt-get install qtbase5-dev qtbase5-dev-tools qt5-qmake qt5-default libqt5serialport5-dev
  • Prepare source package for compilation:
    • dpkg-source -x eazylink2_1.0.0-1.dsc
  • Build the binary .deb package:
    • cd eazylink2-1.0.0
      dpkg-buildpackage -rfakeroot -us -uc -b

      .deb package will be available in parent folder.
  • Install the compiled package:
    • sudo dpkg -i eazylink2_1.0.0-1_<arch>.deb

 

Linux, Raspberry Pi & Pi2 (Debian Wheezy)

  • Update to latest Rasbian packages
  • Get 5.4.2 source from qt.io
  • Attach a USB pen drive or USB HDD with lots of space (30Gb+)
  • de-compress source on external drive (not SD card!)
  • Before configuring QT5 compilation, install these development packages:
    • sudo apt-get update
       sudo apt-get dist-upgrade
       sudo apt-get install libfontconfig1-dev libdbus-1-dev libfreetype6-dev libudev-dev libicu-dev \
        libsqlite3-dev libxslt1-dev libssl-dev libasound2-dev libavcodec-dev libavformat-dev libswscale-dev \
        libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev gstreamer-tools gstreamer0.10-plugins-good \
        gstreamer0.10-plugins-bad libraspberrypi-dev libpulse-dev libx11-dev libglib2.0-dev libcups2-dev \
        freetds-dev libsqlite0-dev libpq-dev libiodbc2-dev libmysqlclient-dev firebird-dev libpng12-dev \
        libjpeg62-dev libgst-dev libxext-dev libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 \
        libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 \
        libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev \
        libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxi-dev \
        libdrm-dev flex ruby gperf bison libts-dev libraspberrypi-dev libgegl-dev libegl1-mesa-dev libgles2-mesa \
      libgles2-mesa-dev libraspberrypi0 libva-egl1 libegl1-mesa libegl1-mesa-drivers gegl sudo apt-get clean
  • Configure compilation for static libraries, no examples, no qt webkit (EazyLink2 is a pure Qt5 Widget application), hardware graphics OpenGL ES2, install folder is /usr/local/qt5 :
    • ./configure -v -opensource -confirm-license -prefix /usr/local/qt5 -release -static \
      -xcb -opengl es2 -optimized-qmake -reduce-exports -fontconfig -no-qml-debug -no-openssl \
      -no-cups -skip qtwebkit -nomake examples
  • The succesfull output of the configuration is:
    • Configure summary
      Build type:    linux-g++ (arm, CPU features: none detected)
      Platform notes:
                  - Also available for Linux: linux-kcc linux-icc linux-cxx
      qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV CONFIG += use_libmysqlclient_r 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   QMAKE_INCDIR_OPENGL_ES2 =  QMAKE_LIBDIR_OPENGL_ES2 =  QMAKE_LIBS_OPENGL_ES2 =  "-lGLESv2" QMAKE_CFLAGS_FONTCONFIG = -I/usr/include/freetype2   QMAKE_LIBS_FONTCONFIG = -lfontconfig -lfreetype   QMAKE_INCDIR_LIBUDEV =   QMAKE_LIBS_LIBUDEV = -ludev   QMAKE_X11_PREFIX = /usr DEFINES += QT_NO_XKB QMAKE_XKB_CONFIG_ROOT = /usr/share/X11/xkb QMAKE_INCDIR_EGL = /usr/include/libdrm   QMAKE_LIBS_EGL = -lEGL   QMAKE_CFLAGS_EGL =   QMAKE_CFLAGS_XCB =   QMAKE_LIBS_XCB = -lxcb-sync -lxcb-xfixes -lxcb-render -lxcb-randr -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-icccm -lxcb-shape -lxcb   sql-drivers =  sql-plugins =  mysql odbc psql sqlite sqlite2 tds qmake switches .........
      Build options:
        Configuration .......... accessibility accessibility-atspi-bridge alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent dbus egl eglfs egl_x11 evdev eventfd fontconfig full-config getaddrinfo getifaddrs gif glib harfbuzz iconv icu inotify ipv6ifname jpeg large-config largefile libudev linuxfb medium-config minimal-config mremap nis opengl opengles2 pcre png posix_fallocate precompile_header pulseaudio qpa qpa reduce_exports release rpath small-config static system-freetype system-jpeg system-png system-zlib xcb xcb-glx xcb-plugin xcb-render xcb-xlib xinput2 xkbcommon-qt xlib xrender
        Build parts ............ libs tools
        Mode ................... release
        Using C++11 ............ yes
        Using gold linker....... no
        Using PCH .............. yes
        Target compiler supports:
          Neon ................. no
      Qt modules and options:
        Qt D-Bus ............... yes (loading dbus-1 at runtime)
        Qt Concurrent .......... yes
        Qt GUI ................. yes
        Qt Widgets ............. yes
        Large File ............. yes
        QML debugging .......... no
        Use system proxies ..... no
      Support enabled for:
        Accessibility .......... yes
        ALSA ................... yes
        CUPS ................... no
        Evdev .................. yes
        FontConfig ............. yes
        FreeType ............... yes (system library)
        Glib ................... yes
        GTK theme .............. no
        HarfBuzz ............... yes (bundled copy)
        Iconv .................. yes
        ICU .................... yes
        Image formats:
          GIF .................. yes (in QtGui, using bundled copy)
          JPEG ................. yes (in QtGui, using system library)
          PNG .................. yes (in QtGui, using system library)
        journald ............... no
        mtdev .................. no
        Networking:
          getaddrinfo .......... yes
          getifaddrs ........... yes
          IPv6 ifname .......... yes
          OpenSSL .............. no
        NIS .................... yes
        OpenGL / OpenVG:
          EGL .................. yes
          OpenGL ............... yes (OpenGL ES 2.0+)
          OpenVG ............... no
        PCRE ................... yes (bundled copy)
        pkg-config ............. yes
        PulseAudio ............. yes
        QPA backends:
          DirectFB ............. no
          EGLFS ................ yes
          KMS .................. no
          LinuxFB .............. yes
          XCB .................. yes (system library)
            EGL on X ........... yes
            GLX ................ yes
            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 ................ yes (plugin)
          OCI .................. no
          ODBC ................. yes (plugin)
          PostgreSQL ........... yes (plugin)
          SQLite 2 ............. yes (plugin)
          SQLite ............... yes (plugin, using bundled copy)
          TDS .................. yes (plugin)
        udev ................... yes
        xkbcommon .............. yes (bundled copy, XKB config root: /usr/share/X11/xkb)
        zlib ................... yes (system library)
      
      WARNING: Using static linking will disable the use of dynamically
      loaded plugins. Make sure to import all needed static plugins,
      or compile needed modules into the library.
      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.
      Qt is now configured for building. Just run 'make'.
      Once everything is built, you must run 'make install'.
      Qt will be installed into /usr/local/qt5
      Prior to reconfiguration, make sure you remove any leftovers from
      the previous build.
  • Time to compile Qt5. If you're remotely connected to the Pi2 via SSH, use nohup, so compilation is not aborted when disconnecting the SSH connection. Otherwise use normal make.
    • Normal make (working on physically connected console): make -j3 (use 3 processors of the Pi2)
    • make using nohup: nohup make -j3 &
      • follow the compilation progress with: tail -f nohup.out
    • if the Pi2 crashes with multiple thread, reduce to a single: just make command...
  • sudo make install (to /usr/local/qt5).
  • For using the installed version of Qt, it is convenient to have a setup file, e.g. ~/setup_qt.sh, which can be source'd if necessary. It should contain at least the following lines for setting up path variables:

     export LD_LIBRARY_PATH=/usr/local/qt5/lib
     export PATH=/usr/local/qt5/bin:$PATH
  • cd <eazylink-sources>
  • qmake -config release eazylink2.pro
    • This command will generate a Makefile (it is important that the PATH and LD_LIBRARY_PATH environment variables has been set)
  • make
    • This will compile eazylink2 as an self-sufficient exectuable containing all qt library dependencies. This binary can be executed on any Rasperry Pi (1 + 2).