Wednesday, 19 February 2014

Installing and Building QT5.2.1 with Visual Studio 2010

Pre-requisites

Download and install MSVC Studio 2010 (it's free)
Download and install ActivePerl free

Download


Download the qt source code zip file.  The tar.gz file apparently has different line terminations in the files, and may not work.

Unpack


Unpack in the directory you want the QT installation to end up in - there is no "make install" step.

Configure


Everything I read says that you need to run configure.exe, but it has not been built, so needs building.  This is achieved by creating the .gitignore file, and setting the QTSRC environment variable.

Start an MSVC terminal (which ensures the compiler is set up in the path).

set QTSRC=c:\data\qt512
cd c:\data\qt512

echo > .gitignore

configure -static -release -opensource -confirm-license -opengl desktop -make libs -nomake tests -nomake examples -no-compile-examples -accessibility

Warning: Using static linking will disable the use of plugins.  Make sure you compile ALL needed modules into the library.

Gotchas / Errors

cannot build  / configure.exe does not exist

If you see an error saying that configure.exe does not exist (note the double slashes), make sure you've installed ActivePerl - the configure program is configured to check for visual studio files, but not for perl!  Also, make sure that the QTSRC environment variable has been set, and the .gitignore file has been created.

Generating Makefiles ... Cannot read : Access is denied

Generating Makefiles...
Cannot read <X:/qt/dir>: Access is denied.
Error processing project file <X:\qt\dir>
Qmake failed, return code 3

This looks to be caused by incorrect directory separators .... investigating ....




Sunday, 26 January 2014

Asus X200CA Touchpad Configuration on Ubuntu 13.10

Background

Just installed Ubuntu Studio 13.10 on the Asus X200CA, and found the touchpad to be quite frustrating, as the buttons are part of the sensitive touchpad area, and when you try to click, you end up moving the cursor.

The Fix

Not to worry, however, as the touchpad is fully configurable with the synclient command.

The touch pad appears to be 3130 wide, and 1697 tall.
By default, the buttons are at the bottom, between 1470 and 1697.

Because the touchpad and buttons overlap, sliding your finger when pressing the button, moves the mouse pointer.

You can re-define the bottom edge for the movement area to 1469 (just above the mouse button area) as follows:

$ synclient AreaBottomEdge=1469
As soon as this command is entered, the mouse becomes useable!!

Making the Fix Permanent

By default, the the configuration allocates the touchpad in % rather than co-ordinates, so edit the file /usr/share/X11/xorg.conf.d/50-synaptics.conf as root:

$ sudo vi /usr/share/X11/xorg.conf.d/50-synaptics.conf

Section "InputClass"
        Identifier "Default clickpad buttons"
        MatchDriver "synaptics"
        Option "SoftButtonAreas" "50% 0 82% 0 0 0 0 0"

        Option "AreaBottomEdge" "82%"
EndSection
 

For Reference


$ synclient -l

Parameter settings:
    LeftEdge                = 130
    RightEdge               = 3130
    TopEdge                 = 96
    BottomEdge              = 1697
    FingerLow               = 1
    FingerHigh              = 1
    MaxTapTime              = 180
    MaxTapMove              = 163
    MaxDoubleTapTime        = 180
    SingleTapTimeout        = 180
    ClickTime               = 100
    EmulateMidButtonTime    = 0
    EmulateTwoFingerMinZ    = 282
    EmulateTwoFingerMinW    = 7
    VertScrollDelta         = 74
    HorizScrollDelta        = 74
    VertEdgeScroll          = 0
    HorizEdgeScroll         = 0
    CornerCoasting          = 0
    VertTwoFingerScroll     = 0
    HorizTwoFingerScroll    = 0
    MinSpeed                = 1
    MaxSpeed                = 1.75
    AccelFactor             = 0.0537634
    TouchpadOff             = 1
    LockedDrags             = 0
    LockedDragTimeout       = 5000
    RTCornerButton          = 2
    RBCornerButton          = 3
    LTCornerButton          = 0
    LBCornerButton          = 0
    TapButton1              = 1
    TapButton2              = 3
    TapButton3              = 2
    ClickFinger1            = 1
    ClickFinger2            = 3
    ClickFinger3            = 0
    CircularScrolling       = 1
    CircScrollDelta         = 0.1
    CircScrollTrigger       = 0
    PalmDetect              = 0
    PalmMinWidth            = 10
    PalmMinZ                = 200
    CoastingSpeed           = 20
    CoastingFriction        = 50
    PressureMotionMinZ      = 30
    PressureMotionMaxZ      = 160
    PressureMotionMinFactor = 1
    PressureMotionMaxFactor = 1
    ResolutionDetect        = 1
    GrabEventDevice         = 1
    TapAndDragGesture       = 1
    AreaLeftEdge            = 0
    AreaRightEdge           = 0
    AreaTopEdge             = 0
    AreaBottomEdge          = 1469
    HorizHysteresis         = 18
    VertHysteresis          = 18
    ClickPad                = 1
    RightButtonAreaLeft     = 1630
    RightButtonAreaRight    = 0
    RightButtonAreaTop      = 1470
    RightButtonAreaBottom   = 0
    MiddleButtonAreaLeft    = 0
    MiddleButtonAreaRight   = 0
    MiddleButtonAreaTop     = 0
    MiddleButtonAreaBottom  = 0


$ synclient AreaBottomEdge 1469

Installing Ubuntu Studio 13.10 on An Asus X200CA

Bought an X200CA from Tesco - this came complete with Windows 8 installed.

Downloaded Ubuntu Studio 13.10:
  • Installed onto a USB Fob
  • Inserted Fob into PC.

Reconfigured the PC to enable booting from the fob:
  • Booted the PC, and Held F2
  • Security | Secure Boot Control = Disable
  • Boot | Fast Boot = Disable
  • F10, Save and Reboot, Held F2
  • Boot | Launch CSM = Enable
  • Launch PXE OpROM = Enable
  • F10, Save and Reboot, Held Escape

Selected USB Fob from boot menu (The USB fob, not the UEFI: USB Fob)

Followed the Ubuntu Install.
  • Selected Replace Windows 8 with Ubuntu Studio when asked
  • Selected English (UK) and English (UK, extended WinKeys) when asked
  • Reboot, Held Escape
  • Selected the hard disk (P0) from the boot menu
Total time for install: 20 minutes

Monday, 16 December 2013

Cross-Compiling QT5 Windows Applications on Ubuntu 13.10

Introduction

I've built a QT application which runs on both Linux and Windows using QT4.8, but found that the accessibility features on QT4.8 are lacking on Windows (for example, a simple text-entry dialogue box will read the contents, but not show them up on a braille display, using Jaws 14).
I opted to make the move to QT5, and I wanted to ensure that:
  • the accessibility features were enabled
  • the windows applications could be statically linked as far as possible
  • the qt-creator application would enable me to produce both Linux and Windows versions of my program

Setting up the Environment

PATH=/opt/bin:$PATH

MINGW32 and Ubuntu Tools

In order to be able to build QT5 and applications, and a Windows release of QT5 and the cross-compilation applications, a number of Ubuntu packages are required.  These can be installed with the apt-get command:

sudo apt-get install autoconf automake bash bison bzip2 cmake flex gettext git g++ intltool libffi-dev libtool libltdl-dev libssl-dev libxml-parser-perl make openssl patch perl pkg-config scons sed unzip wget xz-utils

QT5 for Linux (Dynamic Linking)

I've downloaded QT5 from the git repository, and built in a separate directory as advised, but have had significant trouble, so I've ended up untarring multiple instances of the source, and building in-situ.

See at the end of this blog entry the sorts of problems I had, which were resolved by downloading a tarball, and building in-situ.

Download tarball

cd /opt/src 

wget http://download.qt-project.org/development_releases/qt/5.2/5.2.0-beta1/single/qt-everywhere-opensource-src-5.2.0-beta1.tar.gz

Unpack

tar xf qt-everywhere-opensource-src-5.2.0-beta1.tar.gz

mv qt-everywhere-opensoure-src-5.2.0-beta1 qt5.2.0-beta1-linux

Patch

Specific to the beta release5.2.0-beta1 that I chose:

localtime_r

There is a problem with localtime_r, so some alternative code needs to be included. The bugfix adds additional code for cross-compiling with mingw32, which is what we are doing.  It requires the variable Q_CC_MINGW to be defined.

cd /opt/src/qt5.2.0-beta1-win32/qtdeclarative/src/qml/jsruntime

wget https://codereview.qt-project.org/cat/67781%2C3%2Csrc/qml/jsruntime/qv4dateobject.cpp

Build in situ

cd /opt/src/qt5.2.0-beta1-linux
./configure --prefix=/opt -opensource -confirm-license \
  -shared -developer-build -debug \
  -nomake examples -no-compile-examples \
  -accessibility | tee config.log 2>&1
 

make -j 4 | tee compile.log 2>&1

make install | tee install.log 2>&1


QT Creator 3 for Linux


Download tarball

wget http://sourceforge.net/projects/qtcreator.mirror/files/Qt%20Creator%203.0.0/qt-creator-opensource-src-3.0.0.zip/download

Unpack

Build in situ



cd qt-creator-3.0.0


make install into /opt

make install INSTALL_ROOT=/opt | tee install.log 2>&1

QT5 for Windows (Static Linking)


Use same tarball as QT5 for Linux
Unpack

Build in situ
Defining Q_CC_MINGW

./configure -static -release -opensource -confirm-license \
      -make libs -nomake tests -nomake examples \
      -no-compile-examples \
      -accessibility \
      -no-sse -no-sse2 -no-sse3 -no-ssse3 -no-sse4.1 -no-sse4.2 \
      -no-avx -no-avx2 -no-neon -no-mips_dsp -no-mips_dspr2 \
      -no-gif \
      -optimized-qmake -reduce-relocations -no-pch \
      --xplatform=win32-g++ \
      -device-option CROSS_COMPILE=/usr/bin/i686-w64-mingw32- \
      --prefix=/opt/i686-w64-mingw32 > qtconfig.log 





make install into /opt/i686-w64-mingw32

Cross Compiling 101 

In order to cross-compile in general, all you need to do is set an environment variable: ${CROSS_COMPILE} to i686-pc-mingw32- and any time you need to call a compiler (e.g. gcc), use ${CROSS_COMPILE}gcc - this way, if the environment variable is set, the cross-compiler is used, and if it is not set, the native compiler is used.

A note about qmake

Qmake is a builder of makefiles (which in turn are used to build your qt application). Qmake takes an argument, which tells it what the target application is (e.g. a windows 32 program).. Qmake also converts the GUIs you've drawn into cpp source code for compilation.

There are some paths / libraries / definitions hard-coded into qmake, so if you use the default system-installed qmake, which is usually installed in /usr/bin, the files it creates will not build windows applications, even if you point it at the correct configuration file, as they will try to link your windows object files with linux libraries.

This is why we make a short-cut in /opt/bin called i686-pc-mingw32-qmake. So you can use ${CROSS_COMPILE}qmake in your scripts / programs.

QT Cross-Compiling 101

OK, so lets assume that you've been writing a QT application for Linux using QtCreator, and you've got all of your source code files, and your project xxx.pro file.

All you need to do is invoke the correct qmake, tell it what your source is, and what your target is, and sit back!

PATH=/opt/bin:$PATH
cd output-build-directory
${CROSS_COMPILE}qmake -spec win32-g++ path-to-project/xxx.pro

Qmake Gotchas

  • Make sure you use the correct qmake program.
  • The Mingw32 windows libraries are built as static, but as long as you use the correct qmake, this should be transparent to you.

Bugs / Problems / Gotchas

General

  1. The configure script needs a double hyphen for the prefix and xplatform options, not a single hyphen as indicated in all of the documentation. 

Cross-Compiling qtactiveqt/src/tools/idc

When cross-compiling the IDC on the Linux platform for the Win32 target, the Makefile is built to call up the Linux g++ compiler, and then asked to build a file which includes the windows.h header, which is clearly wrong.

My workaround was to replace the idc Makefile with a file containing the lines:

all:

install:

Downloading from git: 

My first attempt at building was from the git repository, but I changed to using the tarball because I was hampered by a number of errors.
  1. Git stable releases.  I found that the -developer-build option did not copy the private headers across on installation, and I could not get the QT_PRIVATE_HEADERS parameter for qmake to work, so when I tried to build qt-creator, it always failed.
  2. The private headers seems to be going through a change at the moment, and qt-creator expects them to be in a module called XXXX, but that module does not exist in the QT5 file set.

Saturday, 23 November 2013

Settin up CSIPSimple and Voiptalk on Android

To set up CSIPSimple for Voiptalk, all you need to do is create an account with the following settings in Expert Mode!

Make sure that you replace the bits in bold with details from your account.

And watch for the colon in the Registration URI, it's definitely not a dot!

If you don't de-select the Allow Contact Rewrite, the application double-registers with VoipTalk, and confuses the system, particularly when you check online to see if you have connected or not.

Account Name: Descriptive Account Name
Account ID: Your Name <sip:00000000@voiptalk.org>
Registration URI: sip:voiptalk.org:5060
Realm: *
Username: 00000000
Data (password): ********
Proxy URI: sip:nat.voiptalk.org:5065
Allow Contact Rewrite: Unticked


Wednesday, 6 November 2013

Gure Sekretua

Just set up a new website: Gure Sekretua.  The site shows our apartment in France, which is available for holiday rentals.  It is in the Basque spa town of Cambo-Les-Bains in the south west of France.

Gure Sekretua is basque for "our secret".  What we didn't realise when we bought the property was that it used to be owned by chocolate makers, and rumour has it that our living room used to be used to make the chocolate, an the "slab" is now underneath our patio!!!


Tuesday, 29 October 2013

A Good Place for a Massage

An excellent place for a head massage, or reflexology session is Head Over Heels, in St. Neots, Cambridgeshire.

A relaxing hour in a comfortable environment, with soothing music (if you want!).

All of the details are online here.


Connecting Silvercrest SBF75 Scales to An Android Phone using OpenScales and Google Fit

Overview This guide includes the steps to connect a Silvercrest SBF75 set of scales to Google Fit on an Android Phone using the OpenScales a...