Building Qt with tslib

I’ve been trying to get my LCD7 to calibrate correctly when running a Qt application, but I have not had any luck. I’ve tried several approaches and refereced the following links:
http://embedfun.blogspot.ch/2011/07/compiling-qt-embedded-for-arm.html
https://groups.google.com/forum/?fromgroups#!category-topic/beagleboard/beaglebone/Hj1nB_xTcWA

Here is what I’ve done so far:

  1. Downloaded tslib and compiled. No issues here. I verified that ts_calibrate is an ARM executable.

  2. Downloaded Qt 4.8.4 and modified the mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf file and added the following lines:
    QMAKE_INCDIR = /home/brent/tslib_arm/include
    QMAKE_LIBDIR = /home/brent/tslib_arm/lib
    QMAKE_LFLAGS = -lts

  3. Tried building Qt:
    root@ubuntu:~/Downloads/qt-everywhere-opensource-src-4.8.4# ./configure -embedded arm -xplatform qws/linux-arm-gnueabi-g++ -qt-kbd-linuxinput -qt-mouse-tslib -qt-gfx-linuxfb -little-endian -prefix-install -depths 16,18,24 -optimized-qmake -release -opensource -confirm-license

but get an error: The tslib functionality test failed! You might need to modify the include and library search paths by editing QMAKE_INCDIR and QMAKE_LIBDIR in /home/brent/Downloads/qt-everywhere-opensource-src-4.8.4/mkspecs/qws/linux-arm-gnueabi-g++.

So I am unable to build Qt with the -qt-mouse-tslib argument. If I try to run my Qt application without this built into Qt, the touchscreen is terrible. It’s like it’s configured to only work in a 2"x2" square in the middle of the screen.

Exporting the QWS_MOUSE_PROTO actually makes the touchscreen not work at all. Can someone please help me out here?

Hi Brent,

I have the LCD7 and have been able to successfully get qt/tslib compiled/installed and calibrating etc - I built everything on a host Ubuntu 12.04.1 LTS. It took a lot of fiddling/trial and error (I have no previous experience with qt…), so I documented my steps as follows (compare with your own; see how you go) - check the paths I use, especially /home/bone/… etc. as this is specific to my user name:

  1. Download Qt from ‘http://qt-project.org/downloads’ the latest stable release of the Qt Libraries for Embedded Linux (e.g. http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz).

a. mkdir ~/qt

b. cd ~/qt

c. wget http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.3.tar.gz

d. tar -xvzf qt-everywhere-opensource-src-4.8.3.tar.gz

e. Install Necessary Packages:

i. sudo apt-get install libgmp3-dev

ii. sudo apt-get install libmpfr

iii. sudo apt-get install zlib1g-dev

iv. sudo apt-get install libncurses5-dev

f. cd qt-everywhere-opensource-src-4.8.3

g. gedit mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf and change all of the ‘arm-none’ to ‘arm-angstrom’ to match the compiler executables…

h. Including ‘tslib’:

i. Install Necessary Packages:

  1. sudo apt-get install autoconf

  2. sudo apt-get install libtool

ii. cd ~

iii. git clone https://github.com/kergoth/tslib.git

iv. cd tslib

v. Don’t Forget: . ~/.oe/environment-angstromv2012.05

vi. ./autogen.sh

vii. ./configure --prefix=$HOME/tslib_beaglebone --host=arm-angstrom-linux-gnueabi

viii. make

ix. make install

x. Output files can be found in ~/tslib_beaglebone/

  1. Copy the ‘/lib’ directory to ‘/usr/lib’ on the beaglebone.

  2. Copy the ‘/bin’ directory to the ‘/usr/bin’ on the beaglebone.

  3. Copy ‘/etc/ts.conf’ to ‘/etc’ on the beaglebone.

  4. Uncomment line 2 in ts.conf, i.e. ‘module_raw input’

  5. Call the following from the Beaglebone command line (or make a script):

a. export QWS_MOUSE_PROTO=tslib:/dev/input/event0

b. export TSLIB_CALIBFILE=/etc/pointercal

c. export TSLIB_CONFFILE=/etc/ts.conf

d. export TSLIB_PLUGINDIR=/usr/lib/ts

  1. Run ‘ts_calibrate’ and complete the calibration. Call ‘cat /etc/pointercal’ to verify the calibration file has been written.

xi. Add the following lines to / qt-everywhere-opensource-src-4.8.3/ mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf :

  1. QMAKE_INCDIR += /home/bone/tslib/src

  2. QMAKE_LIBDIR += /home/bone/tslib_beaglebone/lib

  1. Configure and build Qt: LAST USED COMMAND: ./configure -v -opensource -confirm-license -xplatform qws/linux-arm-gnueabi-g++ -embedded arm -little-endian -prefix /opt/qt-arm -no-cups -no-accessibility -reduce-relocations -no-nas-sound -no-sm -no-nis -qt-libjpeg -qt-libpng -qt-zlib -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-pch -no-dbus -no-glib -no-phonon -no-phonon-backend -no-webkit -no-multimedia -no-audio-backend -no-qt3support -nomake docs -nomake translations -exceptions -no-fast -qt-mouse-tslib

  2. make

  3. make install

  4. copy all .so files from ‘/opt/qt-arm/lib/’ on the host ubuntu machine to the same location on the beaglebone:

a. From Ubuntu:

i. cd /opt/qt-arm/lib

ii. tar -cpvzf qt_arm_lib.tar.gz *

b. From the beaglebone:

i. mkdir /opt

ii. mkdir /opt/qt-arm

iii. mkdir /opt/qt-arm/lib

iv. cd /opt/qt-arm/lib

v. scp bone@10.192.0.115:/opt/qt-arm/lib/qt_arm_lib.tar.gz ./

vi. tar -xvf qt_arm_lib.tar.gz

vii. export LD_LIBRARY_PATH=/opt/qt-arm/lib:$LD_LIBRARY_PATH

  1. Install Packages (not sure if absolutely necessary):

a. opkg install libgles-omap3

b. opkg install libstdc++6

c. opkg install libpng12-0

  1. Test out an example (on the beaglebone):

a. cd ~

b. mkdir qttest

c. cd qttest

d. scp bone@10.192.0.115:/opt/qt-arm/examples/animation/stickman/stickman ./

e. ./stickman -qws

Good luck!

Andrew.

Andrew,

Thank you for the detailed instructions. This is exactly what I have been looking for! However, I am still having trouble building Qt. I have a feeling it’s my arm-angstrom-linux-gnueabi compiler… Here is what I’m getting:

mmx auto-detection… ()
/home/brent/Downloads/qt-everywhere-opensource-src-4.8.4/config.tests/unix/compile.test: 71: /home/brent/Downloads/qt-everywhere-opensource-src-4.8.4/config.tests/unix/compile.test: cannot create /home/brent/Downloads/qt-everywhere-opensource-src-4.8.4/config.tests/unix/mmx/.qmake.cache: Permission denied
arm-angstrom-linux-gnueabi-g++ -c -pipe -mmmx -O2 -Wall -W -I…/…/…/mkspecs/qws/linux-arm-gnueabi-g++ -I. -I…/…/…/…/tslib/src -o mmx.o mmx.cpp
cc1plus: error: unrecognized command line option “-mmmx”
make: *** [mmx.o] Error 1
mmx disabled.

tslib auto-detection… ()
arm-angstrom-linux-gnueabi-g++ -c -pipe -O2 -Wall -W -I…/…/…/mkspecs/qws/linux-arm-gnueabi-g++ -I. -I…/…/…/…/tslib/src -o tslib.o tslib.cpp
arm-angstrom-linux-gnueabi-g++ -Wl,-O1 -o tslib tslib.o -L/home/brent/tslib_beaglebone/lib -lts
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/…/…/…/…/arm-angstrom-linux-gnueabi/bin/ld: skipping incompatible /home/brent/tslib_beaglebone/lib/libts.so when searching for -lts
/usr/local/angstrom/arm/lib/gcc/arm-angstrom-linux-gnueabi/4.3.3/…/…/…/…/arm-angstrom-linux-gnueabi/bin/ld: cannot find -lts
collect2: ld returned 1 exit status
make: *** [tslib] Error 1
tslib disabled.
The tslib functionality test failed!
You might need to modify the include and library search paths by editing
QMAKE_INCDIR and QMAKE_LIBDIR in
/home/brent/Downloads/qt-everywhere-opensource-src-4.8.4/mkspecs/qws/linux-arm-gnueabi-g++.

This is my qmake.conf file:

Andrew,
Thank you for the detailed instructions. This is exactly what I have been looking for! However, I am still having trouble building Qt. I have a feeling it's my
arm-angstrom-linux-gnueabi compiler... Here is what I'm getting:

If you are using the Angstrom tools, why not just build Qt using Angstrom??
There are recipes available for Qt (desktop using X11) and Qte (embedded)

It would save you all of these headaches.

Good point Gary,

I’m slowly getting my head around using recipes, this is my first project using oe/bitbake etc. - It is probably best to rely on experienced recipe makers to get things right rather than taking the brute force/trial and error/forum scavenging approach as I have been.

I still tend to favour doing everything manually once, and only automating things once I have my head around what’s happening at each step. Not particularly efficient, but more educational.

Brent, I do recall having some trouble like this getting ts lib to build into qt - and I think I may have failed to include the bit of info (my qmake.conf file) that fixed it. It is possibly the QMAKE_LFLAGS line that will help, I’m not 100% sure, but give it a go. (For some reason it wouldn’t find …-strip event though it was clearly in the $PATH, so I gave it the full path) qmake.conf:

Hi Seth,

The command ‘. ~/.oe/environment-angstromv2012.05’ assumes you have downloaded and run the setup_scripts, at least to the point of having called ‘./oebb.sh config beaglebone/’ (I originally used ‘http://cwraig.id.au/?p=507’ as a reference to get things off the ground on my Ubuntu machine. - I’d recommend going all the way to the point of having build a systemd image before trying to build anything else - this takes a long time to run… )

Once this config command has been completed you should find that the file ‘~/.oe/environment-angstromv2012.05’ now exists. A call of ‘. ~/.oe/environment-angstromv2012.05’ should successfully set up a lot of important environment variables, such as the path to the beaglebone gcc compiler, which I think is actually built from scratch in the config step. Have a look at ‘~/.oe/environment-angstromv2012.05’ once it’s there to see all the stuff it does.

Then the rest of the qt/tslib process ‘should’ complete properly…

Cheers,
Andrew.