Important: Please read the Qt Code of Conduct -

[Solved]Compile Qt with tslib

  • Hello I want to compile Qt 5.2 with tslib for raspberry pi.

    I get tslib from git and configured:
    sudo ./configure --host=arm-linux --prefix=/home/dominik/opt/tslib/build/ --enable-static --enable-shared

    then make && sudo make install
    All went ok.

    From many tutorials I know that I have to add the generated include and lib folder to qmake so I edit qtbase/mkspecs/devices/linux-rasp-pi-g++/qmake.conf and add:
    @QMAKE_INCDIR += /home/dominik/opt/tslib/build/include
    QMAKE_LIBDIR += /home/dominik/opt/tslib/build/lib@

    then I configure in qtbase:
    @./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-relocations -reduce-exports -release -make libs -prefix /usr/local/qt5pi -tslib@

    I added tslib, so Qt knows to add tslib support. Sadly this gives this error message:
    @<srcbase> = /home/dominik/opt/qt5/qtbase
    <outbase> = /home/dominik/opt/qt5/qtbase
    Creating qmake...
    make: Nothing to be done for `first'.
    Running configuration tests...
    Note: PKG_CONFIG_LIBDIR automatically set to /mnt/rasp-pi-rootfs/usr/lib/pkgconfig:/mnt/rasp-pi-rootfs/usr/share/pkgconfig:/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf/pkgconfig
    Note: PKG_CONFIG_SYSROOT_DIR automatically set to /mnt/rasp-pi-rootfs
    The tslib functionality test failed!

    Why can't I configure qt??? Do I need to do more things?
    The guide I used is: ""

    Please help!

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You should run configure with -verbose.

    This way you should see the exact error you are encountering

  • This is the error in verbose mode:

    @/home/dominik/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -c -pipe -marm -mfpu=vfp -mtune=arm1176jzf-s -march=armv6zk -mabi=aapcs-linux -mfloat-abi=hard --sysroot=/mnt/rasp-pi-rootfs -O2 -Wall -W -fPIE -I../../../mkspecs/devices/linux-rasp-pi-g++ -I. -o tslib.o tslib.cpp
    tslib.cpp:42:19: fatal error: tslib.h: No such file or directory
    compilation terminated.
    make: *** [tslib.o] Error 1
    tslib disabled.
    The tslib functionality test failed!

    Ok he don't find the tslib.h, but it is in the folder which I give to qmake:
    @dominik@Linux-Dominik ~/opt/qt5/qtbase $ ls /home/dominik/opt/tslib/build/include

    I don't get it...

  • Lifetime Qt Champion

    Then you should rather add

    @-L /home/dominik/opt/tslib/build/lib -I /home/dominik/opt/tslib/build/include@

    To your configure command

  • Hmm, okay, sorry I thought that it is enough when I write this to qmake.conf.

    Now this error occurs:
    @/home/dominik/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -Wl,-rpath-link,/mnt/rasp-pi-rootfs/opt/vc/lib -Wl,-rpath-link,/mnt/rasp-pi-rootfs/usr/lib/arm-linux-gnueabihf -Wl,-rpath-link,/mnt/rasp-pi-rootfs/lib/arm-linux-gnueabihf --sysroot=/mnt/rasp-pi-rootfs -Wl,-O1 -o tslib tslib.o --sysroot=/mnt/rasp-pi-rootfs -L/home/dominik/opt/tslib/build/lib -lts
    /home/dominik/opt/tslib/build/lib/ file not recognized: File format not recognized
    collect2: error: ld returned 1 exit status
    make: *** [tslib] Error 1
    tslib disabled.
    The tslib functionality test failed!

  • Lifetime Qt Champion

    Then tslib is probably not built for ARM


    @file /home/dominik/opt/tslib/build/lib/ @

    To see what kind of file it is

  • It's a symbolic link to this file and the output is this:

    @dominik@Linux-Dominik ~/opt/qt5/qtbase $ file /home/dominik/opt/tslib/build/lib/
    /home/dominik/opt/tslib/build/lib/ ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=0x775054f586db43f31d8b8dd1b7ae2738b20e8923, not stripped

    I see that the architecture is wrong... I will try to rebuild this. At the configure command of tslib is there also a cross compile parameter? Or should the --host=arm-linux be enough?

  • Lifetime Qt Champion

    You might also need to tell the configuration script that your are using arm-linux-gcc (adapt the name to your cross-compiler)

  • Ok thank you! Now it works! I have used this statement for compiling tslib:

    @./configure CC=/home/dominik/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc CXX=/home/dominik/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-g++ -host=arm-none-linux-gnueabi target=arm-none-linux-gnueabi -enable-static=yes -enable-shared=yes -prefix=/home/dominik/opt/tslib/build/@

  • Lifetime Qt Champion

    You're welcome !

    Now that you have tslib working, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

  • Sir
    please provided me a complete steps to compile tslib with Qt5 already Qt5 is running on my host and raspberry pi machine. now i want to compile tslib for my egalax touchscreen please post the steps to compile it.

Log in to reply