Qt 4.6 on mini2440 – A Definitive Guide

Having Qt on your device is a awesome way to ensure that you and many other developers can enjoy developing applications and having fun in addition to doing rapid application development whenever required. The wealth of support provided by the Qt framework – right from OpenGL to WebKit tempts a embedded developer for sure. So I decided its time for a change. Lets dump the overkiiling Android and take shelter under Qt’s canvas for my device. I kept on roaming the intricately laid out web of information on having Qt 4.6.2 run successfully on my mini2440. But owing to the strange 12.1″ LCD that I have attached to it I was more-or-less stuck on the Touchscreen calibration part. So Now after hits and trials and many cups of tea, I am assembling a guide. I intend to make if definitive but only the willful enough to dare can tell.

What You Need

Qt 4.6.2 

GNU ARM Toolchain

Step 1

Setup the toolchain and modify the PATH variable accordingly. Untar qt-everywhere-opensource-src-4.6.2.tar.gz wherever you like. Mine is /usr/local/qt

Step 2

Replace the whole text in mkspecs/qws/linux-arm-g++/qmake.conf by the following:

#
# qmake configuration for building with arm-linux-g++
#

include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)

# modifications to g++.conf
QMAKE_CC                = arm-none-linux-gnueabi-gcc -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_CXX               = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK              = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts
QMAKE_LINK_SHLIB        = arm-none-linux-gnueabi-g++ -msoft-float -D_GCC_FLOAT_NOT_NEEDED -march=armv4t -mtune=arm920t -O0 -lts

# modifications to linux.conf
QMAKE_AR                = arm-none-linux-gnueabi-ar cqs
QMAKE_OBJCOPY           = arm-none-linux-gnueabi-objcopy
QMAKE_STRIP             = arm-none-linux-gnueabi-strip
QMAKE_RANLIB            = arm-none-linux-gnueabi-ranlib

load(qt_config)

Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc etc.

Step 3

Now turn off compiler optimization by making changes in /mkspecs/common/g++.conf Just change the following line to this :

QMAKE_CFLAGS_RELEASE  += -O0

Step 4

Now we have to configure Qt the way we want it by doing ./configure but we need to specify some options according to our requirements.

./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix \
/usr/local/qt -little-endian -webkit -no-qt3support -no-cups -no-largefile \
-optimized-qmake -no-openssl -nomake tools -qt-mouse-tslib -qt-kbd-linuxinput

Now, this configuration is what I needed, for example for my network enabled device I needed a webkit based application so I provided -webkit option. You can drop in or add whatever you want. Some handy options that you may (or may not require) are :

Enable touchscreen library support : -qt-mouse-tslib

Enable USB keyboard support : -qt-kbd-linuxinput

The above options affect the QtGui library so you need to replace only QtGui.so.x.x file on your root filesystem if you are planning to make changes.

Step 5

So more or less you are done. Its time to do some creative stuff (blah!) just do

make

Wait for a couple of hours or so and find your cross compiled freshly baked libraries in /usr/local/qt/lib/

Setting up Qt 4.6 libs on mini2440

So now, its time to put the libs on your mini machine! You may choose to create a separate filesystem using busybox too. Elaborate tutorials on that are available on the web. Just Google it up. What I will do is, modify the rootfs that came with my mini and remove all unnecessary stuff from it. Create a dir /usr/local/qt on your mini2440's stock root filesystem and copy the complete lib directory from step 5 to that location using a USB stick/SD Card or something. Remember to do a df on the mini beforehand to see the free NAND you have got. In case the memory is low, delete some stock data - the small video file, mp3 file and some sample images that are present on it.Also remove unnecessary applications viz konqueror and old qt 2.2.0 libraries from the system.

Environment Variables

To make the mini understand the new Qt libs, we'll add some variables

On your mini2440, edit /etc/inint.d/rcS and add the following line to it

source /etc/qt46profile

Now create the /etc/qt46profile file and the following text to it :

export LD_LIBRARY_PATH=/usr/local/qt/lib
export QTDIR=/usr/local/qt
export QWS_MOUSE_PROTO=IntelliMouse:/dev/input/event0
export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190

Remember that these variables may change according to your qt libs location and mouse/touchscreen drivers. Go to /dev/input/ and see which file is responsible for which device. For eg. if tslib is configured on your device then the QWS_MOUSE_PROTO  variable will have the value something like

QWS_MOUSE_PROTO=Tslib:/dev/input/event1

So, you are done at last and have your system ready with Qt 4.6.2 libs. Try running a simple application (viz a Analog Clock from the cross-compiled qt examples at /usr/local/qt/examples/widgets/analogclock/analogclock by giving the -qws option on the mini2440 shell as

./analogclock -qws

Thats it! Do tell me if you are able to reach here. In the next two posts I shall be discussing about rapidly developing a GUI application for your mini using Qt Creator and compiling and configuring Tslib for mini2440.

About these ads

92 comments

  1. Hi,
    Thanks for this tutorial. I need help with Touchscreen.
    I compiled Qt and tslib successfully.
    Typing “cat /dev/input/ts” works as mentioned (weird chars when touched).
    ts_calibrate and ts_test work fine too (touch screen is working fine).

    If I use “export QWS_MOUSE_PROTO=tslib:/dev/input/ts” it shows “Segmentation fault”. When I replace this line by just “export QWS_MOUSE_PROTO=” (without “driver:options”) my “Hello World” shows perfectly, but no touch screen.

    Compiling Qt with “-no-freetype” generates the same result: “Segmentation fault”.

    I can’t find a way to work touch with my app.

    Any suggestion?
    Thank you.
    Afonso.

  2. Thanks for this useful post (I managed to cross-compile mine couple of days ago using some other sites, and now I need to put my lib on my Mini2440), but I have a question: Since your toolchain is arm-none-linux-gnueabi-gcc”, why use “mkspecs/qws/linux-arm-g++/qmake.conf” but not “mkspecs/qws/linux-arm-gnueabi-g++/qmake.conf” ? Because I cross-compiled mine using that .conf, and it was fine. I’m curious about the difference. I faced a thumb error and fixed that (read it was a bug for 4.7, drank lotsa tea as well), too using “-embedded armv4tl” instead of “-embedded arm.” I guess 4.7 is problematic somehow…

    1. Hi, sorry for a late response. As its an eabi, so I assume the conf will be specific to that one too. However, its all the same as Qt on such a device is almost the same as qt on a PC and as you have tested, both the confs are working fine. Oh, and yeah, 4.7 was giving me lots of trouble on mini2440 but I got it working somehow on mini6410 :)

  3. Thank you for your guide! I’m just barely starting to get a handle on how to code for this…

    I’m trying to shoehorn my newly cross-compiled library files into the mini2440, but it looks like I’ve got 347.2 MB in the /usr/local/qt/lib folder, and a grand total of 256640 1K blocks in total on my mini2440.

    Have I followed the instructions poorly or missed something else of consequence?

    Any reply appreciated, thanks in advance.

    1. The only thing which can affect the size of libs is the ./configure step. I suggest you remove the -webkit and opengl options in this step before moving further and the check the sizes. My libs (will all options enabled except OpenGL) come out to be around 85 MB which can happily stay on a 256MB NAND. I think there has been a mistake somewhere during configuration only

      1. Hello Suchakra,
        First of all thanks for writing such a helpful guide.It helped me a lot in my project on mini 2440.

        Can you please share the screenshot of the libraries in /usr/local/qt/lib so that i can know what is missing.

        Thanks again.

  4. thanks suchakra for this helpful post.
    I have given one touch screen support in my qt embedded application, now i want to attach second touch screen(which will have different content than first touch screen)with my Qt application. so i am planning to use two different application each with QWSServer or using single QT application with Qt’s mulit driver protocol.
    but for this i will have to tell the each application about input event and frame buffer but, since tslib uses global variable like FBDEVICE and TSDEVICE so my question is how individual application will come to know which input event and frame buffer it should connect ?

    1. Wow! At last someone with an innovative touch :)

      I must tell you that I am totally unaware of how to make it happen – but you may try changing the environment variables on the fly for directing output to a different screen. Not sure if it will help but I hope it does. Try http://developer.qt.nokia.com/forums for more help. Please share your results/experiences. I’m indeed excited to see something like this working. Best of luck & keep hacking! Also, I hope that the hardware you are using has enough juice for such a task.

  5. Hi suchakra,

    I have been trying to get Qt working and have followed different guides, but am still encountering a problem. Also, I’m not a Linux pro user, but have dabbled a little. When I attempt Step 4, I get this 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
    /usr/local/qt/mkspecs/qws/linux-arm-g++.

    Am I missing something from an earlier step?

    Thanks,
    Kevin

    1. This error is generally present when the tslib header and library is not found when Qt is being configured. You may need to manually add the following to /usr/local/qt/mkspecs/qws/linux-arm-g++/qmake.conf :

      QMAKE_INCDIR += /usr/local/tslib/include
      QMAKE_LIBDIR += /usr/local/tslib/lib

      (considering that both the above directories exist with the required libs and the headers)

      Afterwards don’t forget to pass the -qt-mouse-tslib option to the ./configure step. Hope it helps

      1. First of all, I want to thank you for this very helpful guide!!!
        With your prefered qt version 4.6.2 everything works well.

        But I would like to run qt quick (qml) and need a newer qt version.
        So I tried qt 4.8.0 rc1 and faced the same error as Kevin (The tslib functionality test failed! …) . I changed the qmake.conf as you have mentioned above, but the error is still there. :-(

        Is there something else what I can do/try?
        Do you have experience with qml on the mini2440?

        Thanks in advance,

        Michael

      2. I solved it myself. :-)
        ( The “tslib functionality test failed!”-problem )
        Maybe it’s a solution for other too, maybe not.
        My problem was, that I tried to configure + compile QT with sudo on an Ubuntu system.
        After chown -r UserABC /usr/local/qt I configured an compiled QT 4.8.0 rc1 as UserABC well.
        (Don’t forget to do make confclean before!)
        But I haven’t tested it on the mini2440 board yet …
        I hope your doing well! Best regards.

  6. I’m having problems trying to run the configure command.
    He is generating an error, here.

    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/fabio/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++.

    Have one idea about this ?

    1. Hi,

      Sorry for the late reply. I have been quite busy :(

      Anyways, please open the qmakeconf file at /home/fabio/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++ and add the following lines. Make sure you have the cross compiled tsllib libs present there on the mini2440

      QMAKE_INCDIR += /usr/local/tslib/include
      QMAKE_LIBDIR += /usr/local/tslib/lib

      I hope it helps..

  7. Hi!

    Nice post!! :)
    I managed to complie tslib and qt4.7.4 under Ubuntu 11.10 32bit with arm-linux-gcc 4.3.2.
    Now I transfered the complied Qt/lib files and the demos and tslib to my mini2440 board. I follow your instructions and that tutorial too : http://mini2440vietnam.blogspot.com/2011/04/upgrade-qt462-in-mini2440.html

    But when I try to modify the rcS file I get this error in console on my host pc:

    VFS: Mounted root (yaffs filesystem) on device 31:3.
    Freeing init memory: 108K

    cannot run ‘/etc/init.d/rcS’: Permission denied

    Please press Enter to activate this console.
    can’t open /dev/tty2: No such file or directory

    can’t open /dev/tty3: No such file or directory

    can’t open /dev/tty4: No such file or directory

    can’t open /dev/tty2: No such file or directory

    can’t open /dev/tty4: No such file or directory

    can’t open /dev/tty3: No such file or directory
    …… etc

    I tried to do this command after the modification : chmod -x rcS

    but the result is the same…

    What do you think? Where did I mistake?

    Thank you!!!

  8. Hi Friend,

    I need some help from u.. am new for qt with arm architecture,, i am using your tutorial only for installing qt embedded in my host Ubuntu 11.10..

    In step 2 :
    ——————-
    Remember that the PATH variable should have the location of arm-none-linux-gnueabi-gcc etc.

    how to set these path variable.. and what is the usage of GNU ARM Toolchain, i have downloaded it form given link..
    —————————

    then,
    i got the following error when install the Qt..

    Note : i already change the both conf file (as per your config given in the site) in mkspecs and linux-arm-g++ folder respectively..

    my Qt_configure command is :

    ./configure -embedded arm -xplatform qws/linux-arm-g++ \
    -prefix /usr/local/qt4.7.4 -little-endian \
    -nomake examples -nomake demos -no-qt3support -no-cups -no-nis -no-largefile -no-openssl \
    -nomake tools -optimized-qmake -accessibility -depths 8,16,18,32 \
    -qt-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libjpeg -qt-libmng \
    -qt-gfx-linuxfb -qt-gfx-vnc -qt-gfx-qvfb -qt-kbd-tty -qt-kbd-linuxinput \
    -webkit -opensource -confirm-license

    after giving make command.. i got the following error
    —————————————————————————-
    make[1]: arm-none-linux-gnueabi-g++: Command not found
    make[1]: *** [.obj/release-shared-emb-arm/qabstractanimation.o] Error 127
    make[1]: Leaving directory `/home/pandian/Temp/qt-everywhere-opensource-src-4.7.4/src/corelib’
    make: *** [sub-corelib-make_default-ordered] Error 2
    —————————————————————————-

    Please help me Dude!.. how can i solve this!…………

    Regards : Nagaraj

    1. Hi,

      The error clearly tells that make has not found your cross-compiler. You need to modify the PATH variable and add the path of your cross-compiler (in this case ‘arm-linux-gcc’) to the system’s current path as follows.

      1. Extract the cross-compiler toolchain to some path (eg /home/yourname/toolchain/)
      2. Add the path of the bin directory containing the compiler and other utils to current PATH variable :

      export PATH=$PATH:/path/to/your/arm-linux-gcc

      You may want to add this line in your .bashrc file to make the changes persistent.

      The GNU ARM toolchain is required to cross-compile, link etc. while developing application for your target (your ARM SBC) from your host (your x86 based PC). I suggest you search a bit more on internet to get detailed info. Also refer to Pro Linux Embedded Systems by Gene Sally or Embedded Linux Primer by Christopher Hallinan.

      1. Hi Friend..

        as per your instruction i have extract the arm-linux-gcc.tar in a new toolchain folder.. the set the PATH variable like this in a .bashrc file as a root user.

        export PATH=$PATH:/toolchain/arm-linux-gcc

        is this path correct or not, sorry friend am new to the linux distro.

        but it’s still show the same error friend – make[1]: arm-none-linux-gnueabi-g++: Command not found

        i googled lot and i tried to install and run the qt gui for arm in my host from last 10 days, still now i dont get the right way to run the qt gui on the EVK. help me dude. i have APF51 EVK from armadeus.. it has arm cortex A8 arch

        what i have previously done in my ubuntu 11.10(x86 host)
        ———————————————————————————————
        1. Installed QtSDK1.2 (Qt_SDK_Lin32_offline_v1_2_en.run)
        2. downladed the qt-everywhere-opensource-src-4.7.4 and extract it into the /usr/local/qt
        3. changed the config file in
        mkspecs/common/g++.conf and
        mkspecs/qws/linux-arm-g++/qconf/qmake.conf as per your article.
        4. and gave the ./configure command as mentioned above. it runs correctly
        5. after that i gave make command , then it shows the error as above

        Is this procedures are correct or not, to install the qt for arm. if anything goes wrong please help me dude..

        Regards : Nagaraj

  9. What you did above is correct. All you need to do is to set the PATH variable properly so that make can find your cross compiler.

    As an example, on my system the toolchain has been extracted to ‘/home/suchakra/toolchain/usr/local/arm/4.3.2/bin’ so the corresponding change in PATH variable should be done as follows :

    export PATH=$PATH:/home/suchakra/toolchain/usr/local/arm/4.3.2/bin

    Once you have saved in bashrc file just source it once to reflect in on the shell as follows :

    source ~/.bashrc

    I suggest you read some more about GNU/Linux from linux-training.be/downloads/ Also, please keep on browsing forums. It will help you in your learning and project.

    1. Hai Friend,,

      after set the path variable, now its installed perfectly…. thank u for your precious help..

      and you forget to tell the procedure’s are correct or not..
      now in my ubuntu host i have qt sdk and qt-arm..

      how can i run a simple helloworld program gui in the target APF51. i already refer some example like how to run qt gui at mini2440 (in your site and thanusri3.wordpress.com site).. but that tutorial cant help me much..

      please give me some sugges how to run qt gui in the apf target…

      Regards Nagaraj

  10. hi Thanks for the info…
    but i hav done everything of the above procedure, but no use.
    i am unable to run the qt application on my arm9 board.

    can u explain to me in step wise…
    as i am a newbie to QT.. got confused wit all d stuff….

    Thanks in Advance

      1. step 1 – tool chain is “arm-2008q3.tar.gz”. is extracted to : /usr/local/arm-2008q3

        step2 – “qt-everywhere-opesource-src-4.6.2.tar.gz” is extracted in my download directory.

        step3 – i have changed the : “qt-everywhere-opesource-src-4.6.2/mkspecs/qws/linux-arm9-g++/qmake.conf” file contents to arm-none-linux-gnueabi-gcc,g++,ar,abjcopy,strip all files changed.

        step4 – in terminal at “qt-everywhere-opesource-src-4.6.2″ directory i have given the command -

        ./configure -opensource -confirm-license -prefix /opt/qt-arm -no-qt3support -embedded arm -little-endian -xplatform qws/linux-arm9-g++ -qtlibinfix E

        (as ur ./configure not worked for me i hav given the above one)

        step 5 – make

        step 6 – sudo make install

        step 7 – wat to do i dont no….

        but wat i did was..

        created a new proejct n also take an old project in my system n i set the qmkae path which is in “/opt/qt-arm”.

        and build

        n copied the files to my device n ./proejctname -qws

        (1st time i got) but its saying so libqtgui.so file no exist.

        (2nd time i got ) wen i copied another project i got “segmentation fault”

        (3rd time) in my system itself when i show qt version qmake file it’s saying “the default mkspec symlink is broken”

      2. helloo can u reply to me plzz..

        sorry a bit of urgency…

        on arm9 board i have to run qt app. all the examples of qt were running fine on board but the projects created by me were not running on the board.

        when i show qmake of cross compiler its saying

        “the default mkspec symlink is broken”

  11. Hi suchakra

    I have done successfully cross-tools chain untar and export the PATH in .bashrc file, but after completion of “step5:make” , you said “lib folder” will be created in “/usr/local/qt/lib” but I dint get “lib folder” in that directory…

    any difference between /usr/local/qt/lib and /usr/local/qt/qt-everywhere-opensource-src-4.6.3/lib …?

    I an new to the qt environment…

    How can I solve this problem?

    I kindly request please replay for this mail as soon as possible sir…
    Its little bit urgent…..

    Thanks in advance…

  12. now everything worked fine…

    The thing is only examples projects under folder “qt-everywhere-opesource-src-4.6.2″ are working fine in my device.

    where as the normal project which is created n built by me were not running in the device.
    wat may b d prob ?

    any help ?

    ################################################
    another doubt is the qmake which is created through toolchain is shown in qt-tools-qtversion then i am gettign the above error as in my previous post is

    –> in my system itself when i show qt version qmake file it’s saying “the default mkspec symlink is broken”
    ################################################

  13. Hi, I’m following the instructions you have posted here. But when I run the ./configure (with all options), the compilation of qmake source files is successful with all obj files, but when linking starts I get these errors, can you be so kind to tell me whats going wrong here?

    Also, I had to separately export paths as below, which are used in qmake’s Makefile, EXCEPT for OE_QMAKE_LDFLAGS. Do you know what LD flags I must use? I feel that it is because of lack of LD flags that I’m getting these errors. Kindly help.

    **************************************OE_xxx_FLAGS************************
    export OE_QMAKE_CC=/home/sandeep/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-gcc$OE_QMAKE_CC
    export OE_QMAKE_CXX=/home/sandeep/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-g++$OE_QMAKE_CXX
    export OE_QMAKE_CFLAGS=”-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -O3″$OE_QMAKE_CFLAGS
    export OE_QMAKE_CXXFLAGS=”-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -O3″$OE_QMAKE_CXXFLAGS

    OE_QMAKE_LDFLAGS ???????????

    ************************************************************************************

    **************************************Errors*****************************************
    (Many errors of cannot execute binary file.)
    2/bin/qmake: cannot execute binary file
    /home/sandeep/Downloads/qt-everywhere-opensource-src-4.6.2/config.tests/unix/compile.test: line 69: /home/sandeep/Downloads/qt-everywhere-opensource-src-4.6.2/bin/qmake: cannot execute binary file
    /home/sandeep/Downloads/qt-everywhere-opensource-src-4.6.2/config.tests/unix/compile.test: line 69: /home/sandeep/Downloads/qt-everywhere-opensource-src-4.6.2/bin/qmake: cannot execute binary file

    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/sandeep/Downloads/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++.

  14. Hi , My HelloWorld Application works on mini 2440. But There is no touch panel function or usb mouse does not work. What can be done for this problem. When ı try to run porgram , Progmram work then command live show a message following:

    ‘ QWSTslibMouseHandlerPrivate: ts_config() failed with error: ‘No such file or di’
    Please check your tslib installation! ‘

    1. Hi Mahmut,

      Good to hear that. First please just check if you had configured your Qt libs with the -qt-mouse-tslib option in the ./configure step. If you have done that, then check if the device file for the touchscreen is created or not. Its usually /dev/input/event1 or /dev/input/event0. Be sure that the dev file is for touchscreen only. Then do

      cat /dev/input/event1

      and start touching the screen randomly. If you can see garbage values, then your touchscreen is working. If this is working then make sure that you have set the QWS_MOUSE_PROTO variable in your /etc/profile by doing -

      export QWS_MOUSE_PROTO=tslib:/dev/input/event1

      I hope the above solves your issues. Read more about tslib from http://tslib.berlios.de/ and about TS and Mouse handling on QT from http://doc.qt.nokia.com/4.7-snapshot/qt-embedded-pointer.html

      1. Thanks suchakra , There is line you talked above is in profile file . But it isn’t work . Content of profile is :

        # Ash profile
        # vim: syntax=sh

        # No core files by default
        ulimit -S -c 0 > /dev/null 2>&1

        USER=”`id -un`”
        LOGNAME=$USER
        PS1=’[\u@\h \W]\# ‘
        PATH=$PATH

        HOSTNAME=`/bin/hostname`

        export USER LOGNAME PS1 PATH

        export LD_LIBRARY_PATH=/usr/local/tslib/lib
        export QTDIR=/usr/local/Qt
        export QWS_MOUSE_PROTO=tslib:/dev/input/event0
        export TSLIB_CALIBFILE=/etc/pointercal
        export TSLIB_CONFFILE=/usr/local/etc/ts.conf
        export TSLIB_CONSOLEDEVICE=none
        export TSLIB_FBDEVICE=/dev/fb0
        export TSLIB_PLUGINDIR=/usr/local/tslib/lib/ts

        By the way miniarm have Qtopia OS . When Qtopia is enabled touch panel works . But When Qtopia is disable and my program starts , touch can not work .

  15. Just try the following -

    cat /dev/input/event0

    and tell if random values are displayed on screen. Also, do -

    source /etc/profile

    once more before starting your application and check if the TS works or not. Its always good to stop qtopia altogether if you are planning to use Qt 4 and above

  16. Yes , cat/dev/input/event0 is working . Random values apper on screen . I don’t understand how to do make source /etc/profile

  17. Hi, suchara ı have a question too :) . I want to plot real time grapt. Whic lib can ı use . I heard aboutu QWT lib . But how to install it to QT CREATOR and build for mini 2440 .

    1. Hi, QWT is a nice library. I have used it before and it can give you real-time graphs for sure with a acceptable response (again it depends on how ‘real-time’ is your application). You may use it in the following manner :

      1. Cross compile qwt library. Refer Stefan’s method (http://www.friendlyarm.net/forum/topic/2549)
      2. Copy the libs as suggested by him to the board and build the examples on the host.
      3. While writing your own application in Qt Creator, include the necessary headers from the qwt directory and give necessary flags during cross compilation in Qt Creator for using the cross compiled library.

      1. I can run a qwt app on desktop . İt is Ok , But ı want to compile app for mini 2440 I get this errors :

        /home/mcelal/untitled/../../../usr/local/qwt-6.0.2-svn/lib//libqwt.so:-1: error: file not recognized: File format not recognized
        :-1: error: collect2: ld returned 1 exit status

        by the way , I can compile any QT app for mini 2440 , There is no problem. But When ı want to use qwt , errors above occur

  18. I suggessed to run qwt on mini 2440 , I build app on Qt Creator . It is ok :) . But now qwt for desktop give error. I can’t see grapt on desktop. How to install both mini arm lib and desktop lib ???

    1. Place both the x86 and ARM libs in different directory (such as /opt/qwt/x86/libs and /opt/qwt/arm/libs) Now modify the .pro files accordingly. For a project to be run on mini2440, add the following in the .pro file

      LIBS += -Wl,-rpath,/opt/qwt/arm/lib

      Similarly change the corresponding .pro file for x86 project too accordingly. I hope it works. If it doesn’t let me know.

  19. Hi Suchakra

    Trying to build this step by step.
    Have a new Ubuntu 10.04 installation.
    extracted the toolchain and set the PATH directly in the .profile file.
    completed the steps 1,2, & 3.
    However when i run the configure command as it is… i get the following.

    ****************************************************
    Creating qmake. Please wait…
    g++ -c -o project.o -pipe -DQMAKE_OPENSOURCE_EDITION -O0 -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Igenerators/mac -Igenerators/symbian -I/usr/local/qt/qt-everywhere-opensource-src-4.6.2/include -I/usr/local/qt/qt-everywhere-opensource-src-4.6.2/include/QtCore -I/usr/local/qt/qt-everywhere-opensource-src-4.6.2/src/corelib/global -I/usr/local/qt/qt-everywhere-opensource-src-4.6.2/src/corelib/xml -DQT_NO_PCRE -DQT_BUILD_QMAKE -DQT_BOOTSTRAPPED -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_NO_COMPONENT -DQT_NO_STL -DQT_NO_COMPRESS -I/usr/local/qt/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-x86-g++ -DHAVE_QCONFIG_CPP -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT project.cpp
    make: g++: Command not found
    make: *** [project.o] Error 127
    kk@kk:/usr/local/qt/qt-everywhere-opensource-src-4.6.2$
    *******************************************************
    I tried the PATH variables and verified that the correct path of the GNU ARM Toolchain is present in the $PATH variable.
    Simply not moving beyond this path.

    Each time i have done this process…. i was getting stuck at this point (from following various guides on the net). I just used to install g++ using apt-get install g++. Now reading your tutorial realised that that was a mistake, but still not proceeding further. Could you please guide where i am going wrong.

    KK

    1. You have not set your PATH variable correctly as the system is still using g++ and not arm-linux-g++. This will compile it for x86 and not ARM. Write the following in your ~/.bashrc file in the end

      export PATH=$PATH:/path/to/toolchain

      where ‘/path/to/toolchain’ is the actual path to your toolchain (the ‘bin’ directory in the toolchain). I hope it helps. Do get back if you need more help.

  20. I want to change /etc/init.d/rcS . I have changed it before to close qtopia. But now ı open rcS file with vi editor. I change sometiing. Then ı type :wq . but there is no effect. How to solve it. Normally it is work

  21. Thanks for the helpful post. I installed everything and tested a sample in the mini2440 board. But When I build for mini2440 in Qt Creator 2.4.1 based on Qt 4.8.0, I faced the error “no such instruction:swpb %bl,%al,[%edx]” .
    Any suggestion?
    Tanks in advance.
    A>G

    1. I am happy that the post helped you. The error is due to wrong compiler options with the latest SDKs. I think its a known issue. Using an old Qt Creator will solve the problem.

  22. Hi Suchakra,

    I am trying to setup my TechNexion TDM3730 board to run QT application and tried several tutorials. I think your post is the clearest I’ve seen so far, however I still can’t run even my HelloWorld Qt application. It looks so basic as when I run a regular C application it’s fine. However, when I try to run a Qt application my response is

    -sh: ./HelloWorld: not found

    1. Make sure that you are execuing the Cross-Compiled (CC) application and the permisssions are set properly. If is still showing same error, the reason is that the Qt dependencies are not being met. For that, check that you have copied the CC libs to the target in appropriate directory (the target prefix directory set by you while you were CCing Qt). If you are sure about all that (you can use arm-readelf to get exact location of RPATH and dependencies), check whether you have set LD_LIBRARY_PATH and QTDIR variables properly. I hope it helps :)

      1. Yes, I’ved copied the entire /usr/local/Qt from host to the target. Is there a particular reason why the QTDIR and LD_LIBRARY_PATH should be pointed by /etc/init.d/rcS and not just add the lines into /etc/profile instead? I mean how can I be sure that rcS is being read?

        Also, how do I know which arm-readelf to use as so far I get command not found.

  23. Right, I chrpath one of the examples and it’s pointing to the qt source directory and not the install directory, what does that mean and how do I properly correct it?

  24. There are different ways in which linux boots on embedded devices. Here init calls /etc/init.d/rcS directly (through directions in /etc/inittab) so whatever initialization you want, you can add them here. Traditionally, rcS is used to run scripts specific to the runlevels, but for an embedded device we don’t usually need runlevels. As an example, if you want to export some env variables, write them in a file (such as /etc/profile) and then source them in rcS (source/etc/rcS)

  25. A closer look of the rpath shows both the qt source directory and the target install directory /usr/local/Qt, so I guess my problem now is how to list the qt dependencies.

    1. Just run arm-linux-readelf -d -h HelloWorld to understand what all dependecies are there along with the elf header info. arm-linux-readelf is a part of toolchain. You are almost there :) Best of luck!

      1. Suchakra,

        I’m using Sourcery_G++_Lite and arm-linux-readelf -d -h returns “command not found”.

        -and ldd returns “not a dynamic executable”, is that significant?

        Btw: I notice the LFLAGS in the part of Makefile below has /sysroot/ as path which does not exist in my system, could it be the culprit considering it is related to dynamic linking? Where is it getting that setting?

        CC = arm-none-linux-gnueabi-gcc
        CXX = arm-none-linux-gnueabi-g++
        DEFINES = -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_SHARED
        CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
        CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
        INCPATH = -I/usr/local/Qt/mkspecs/qws/linux-arm-g++ -I. -I/usr/local/Qt/include/QtCore -I/usr/local/Qt/include/QtNetwork -I/usr/local/Qt/include/QtGui -I/usr/local/Qt/include -I. -I.
        LINK = arm-none-linux-gnueabi-g++
        LFLAGS = -Wl,–dynamic-linker=/sysroot/lib/ld-linux.so.3 -Wl,-O1 -Wl,-rpath,/usr/lib:/usr/local/Qt/lib:/usr/local/Qt/include:/usr/local/Google/protobuf-2.4.1-arm/lib -Wl,-rpath,/usr/local/Qt/lib
        LIBS = $(SUBLIBS) -L/usr/local/Qt/lib -lQtGui -L/usr/local/Qt/lib -lQtNetwork -lQtCore -lpthread
        AR = arm-none-linux-gnueabi-ar cqs
        RANLIB =
        QMAKE = /usr/local/Qt/bin/qmake

        Thanks so much, it does feel I’m almost there but frustrating not to be getting there.

  26. You must be having arm-none-linux-gnueabi-readelf instead of arm-linux-readelf as you are using Sourcery toolchain. (I am assuming you have set the PATH variable correctly)

    Can you tell how you have configured Qt as I have doubts on that?

    Here’s what happens : During ./configure step, qt looks at your qmake.conf in mkspecs/qws/linux-arm-g++ and starts a build. The resulting qmake when run will generate a Makefile having config and variables for proper cross compiling as per your qmake.conf you had specified. Here is a link to part of a Makefile generated by qmake for ARM : http://pastebin.com/h3yZNAT7 I could not see the other modifications mentioned in the post in your CC and CXX variables

    The sysroot path in your makefile and –dynamic-linker option is unexpected. I’d suggest that either check your steps in configuration or use GNU arm toolchain rather than Sourcery. You can also try writing on forums for detailed explanation which I may be missing here.

    1. The readelf indeed was a lot of help. It turns out that some files were in altogether different directory. and I also found that i didnt have this

      QMAKE_RANLIB = arm-none-linux-gnueabi-ranlib

      entry in the qmake.conf.

      Finally, I was able to run my first Hello World with UI on the target !

      Thanks Suchakra!

      1. u-oh, In my first test app, the window declaration is within the main.cpp, when using a mainwindow.ui generated by QtCreator,the result is symbol lookup error – undefined symbol. Could that be related to options missed when I configured qt?

  27. while compiling qt-4.6.2 i m getting error as a;
    /home/prashant/Desktop/PRASHANT_MATERIAL/MINI2440-MATERIALS/mini2440/qt-everywhere-opensource-src-4.6.3/bin/qmake: 1: Syntax error: word unexpected (expecting “)”)
    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/prashant/Desktop/PRASHANT_MATERIAL/MINI2440-MATERIALS/mini2440/qt-everywhere-opensource-src-4.6.3/mkspecs/qws/linux-arm-g++.

    how to resolve this error,i m trying from 2 weeks,but still it is exists

    1. The first is most probably related to qmake.conf Please share your ./configure options. As for the second, if you plan to use tslib (for touchscreen) add the Include and Lib dir path (upon tslib cross compilation) in QMAKE_INCDIR and QMAKE_LIBDIR in the path specified in error to resolve the issue.

      1. I’m facing a similar item 2 issue. However, i need to clarify something because my linux kernel 2.6.37 already installed a working TS and on bootup I see

        input: ADS7846 Touchscreen as .devices/platform/omap2_mcsp1.1/spi 1.0/input/input1

        However, my Qt application does not accept the clicks from my TS. Then when I list my /dev/input folder it reports

        by-path event1 mice touchscreen0
        event0 event2 mouse0 touchscreen1

        How do I properly setup QWS_MOUSE_PROTO in this case?

  28. Vic, first identify which is the device node for your touchscreen. Its quite easy to check – just do ‘cat /dev/input/event1′ and start touching the screen. If you see random letters being displayed, it means that the device node is even1. Repeat the above for other nodes. Once you have identified the TS node, add QWS_MOUSE_PROTO=Tslib:/dev/input/event1 to your env initialization. I hope Tslib is properly set

    1. I get the message -The tslib functionality test failed! when I include the -qt-mouse-tslib option for ./configure. Is that significant?

      1. I tried plugging a mouse then i get two pointers, when i move the mouse both pointers move but one can actually respond to the QT application.

  29. Dear all,

    please anyone help me.

    while compiling qt-everywhere-opensource-src-4.6.2
    i got following Error

    ine 69: /usr/local/qt-everywhere-opensource-src-4.6.2/bin/qmake: cannot
    execute binary file
    /usr/local/qt-everywhere-opensource-src-4.6.2/config.tests/unix/compile.test:
    line 69: /usr/local/qt-everywhere-opensource-src-4.6.2/bin/qmake: cannot
    execute binary file
    The tslib functionality test failed!
    You might need to modify the include and library search paths by editing
    QMAKE_INCDIR and QMAKE_LIBDIR in
    /usr/local/qt-everywhere-opensource-src-4.6.2/mkspecs/qws/linux-arm-g++.
    [root@localhost qt-everywhere-opensource-src-4.6.2]#

    please help me
    thank you

  30. HI

    When running the fluid demo app, or any app, i get the following:

    QWSTslibMouseHandlerPrivate: ts_config() failed with error: ‘No such file or directory’
    Please check your tslib installation!

    I used the correct switches, but cant seem to get it to work. I also tested the input for the touch screen, mine is /dev/input/event0, and it works.

    any help is appreciated, thank you

    Ruben

  31. Hi Suchakra,

    Thanks for this tutorial.I am able to run the default examples on the Desktop as well as on the Mini2440 FriendlyArm board by following your instructions given in this tutorial,i am facing a difficulty in getting the size of the fonts correct on both the environments,the size of the fonts on desktop does not matches with the size of the fonts on the Mini 2440 board with X35 LCD
    (the font size on the Mini2440 board is very small compared to the font size on the desktop),can you please guide me on how to get the size of the font on the Mini2440 board same as the size of the fonts on the desktop.

    I am using Qt creator 5.0.1 GPL SDK on the desktop with UBUNTU 12.10 as OS
    on desktop and Qt 4.6.1 on the Mini2440 with default rootFS system that came alongwith the board,please do let me know what can be the possible problems???

    Regards,
    Girish

    1. export QWS_DISPLAY=LinuxFB:mmWidth=165:mmHeight=200

      i think you can tune the font size using the above…

      Hope it helps you…

  32. hi, Thnkx for the this tutorial. I followed the above given steps. but when I make or gmake i’m getting this error, here is the snippet:
    -L/usr/local/QT/qt-everywhere-opensource-src-4.8.4/lib -lpthread -lm -ldl
    /usr/local/Code_sourcery/bin/../lib/gcc/arm-none-linux-gnueabi/4.7.2/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lts
    collect2: error: ld returned 1 exit status
    make[1]: *** [../../lib/libQtCore.so.4.8.4] Error 1
    make[1]: Leaving directory `/usr/local/QT/qt-everywhere-opensource-src-4.8.4/src/corelib’
    make: *** [sub-corelib-make_default-ordered] Error 2

      1. well i did not wanted the touchscreen libs and I removed the “lts” part, then it started showing me this error: undefined reference to `clock_gettime’. I thought it was for real time clock, then I replace it with “lrt” and guess what . its working :)
        Thnkx anyways for your time.

      2. Hey can you tell me why I’m getting this error:
        undefined reference to QInotifyFuleSystemWatcherEngine::Create()

      3. Well the error was coming because linux-* cannot find the specified name for the toolchains. So I edited src/io.io.pri file and added arm-* and now its working. :)

  33. Hmm, I think it takes the cross compiler automatically when you specify -xplatform qws/linux-arm-g++ in the configure options. see the proper qmake.conf file to check if the compiler was specified there or not. But well, it depends on you. If the hack works and doesn’t break the other build process you should be fine with it.

    1. Hmm, till now I can run console applications and also Qt Gui server, but since now I want to use opengl, I’m trying to reconfigure it. But I’m not able to do so. I’ve installed mesa but may b I’m missing or making a mistake while providing paths for QMAKE_INCDIR_OPENGL, QMAKE_LIBSDIR_OPENGL and QMAKE_LIBS_OPENGL. ANd finally ending up with the error “all open gl functionality test failed” :(
      Please help!

  34. Hi All,

    We are trying to run a Qt application on Xilinx ZC-702 board(running linaro ubuntu desktop).

    We have followed below mentioned steps, but GUI is not firing..
    1) qt-everywhere-opensource-src-4.7.3.tar.gz(Extract It)
    2) qmake.conf: either replace the qmake.conf in /home/user/qt-everywhere-opensource-src-4.7.3/mkspecs/qws/linux-arm-gnueabi-g++/qmake.onf
    Replace: arm-none-linux-gnueabi-gcc by arm-linux-gnueabihf-gcc

    3) Set the path:
    export CROSS_COMPILE=arm-linux-gnueabihf-
    export PATH=/usr/bin:$PATH
    export ZYNQ_QT_BUILD=/home/user/qt-everywhere-opensource-src-4.7.3
    export ZYNQ_QT_INSTALL=/usr/local/Trolltech
    export PATH=$ZYNQ_QT_INSTALL/bin:$PATH

    4) ./configure -embedded armv7l -xplatform qws/linux-arm-gnueabi-g++ -little-endian -opensource -host-little-endian -confirm-license -prefix $ZYNQ_QT_INSTALL -qt-zlib -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-openssl -no-nis -no-cups -iconv -no-pch -no-dbus -qt-freetype -no-opengl -qt-gfx-linuxfb -qt-gfx-vnc -qt-gfx-qvfb

    5) make
    make -install
    copied the libraries to the target board.

    6) ./appname -qws -display QVFb:0
    error: driver cannot connect
    Aborted

    ./appname -qws LinuxFb:mmwidth=1024:mmheight=768
    this dsnt give any error but, its not launching the GUI but printing the log messages in terminal.

    can you tell What steps are missing here?

    1. Did you set the QWS_DISPLAY etc environment variables properly? if yes, what values did you give? I see that in your second trial, you try to give the details for display device. Also, what is your display device? is its a touchscreen etc? Try doing something like this

      export QWS_DISPLAY=LinuxFB:mmWidth=310:mmHeight=190

      before your first trial to see if it works. Also, tell me what log messages are there. I see that you have built with qws so it should not be an issue but it would be interesting to see what the problem is. Its been a few years since since I used Qt on embedded, I may need to brush up things myself :)

  35. its an HDMI monitor(not a touchscreen) interfaced with ZC-702 board. We have tried with export QWS_DISPLAY as well giving it along with ./appname.

    those log messages were nothing but Qdebug/Print statements i inserted to see whether its reaching the function which fires the UI. With help of the log messages i confirmed that it is executing the function which fires up GUI but doesn’t display anything.

    1. I think all the steps you mentioned are ok. check whether the demo applications and demo images with the board work. They might be having some shell scripts or some config files to setup some board specific stuff. If you have tried that and its not working, I am sorry I can’t help much unless I get to work on the board.

  36. Yes, there are demo app(sobel_qt) given with the board. But even that is not working.

    I didnt understand the 2nd question you asked regarding shell scripts or config files to setup some board specific stuff.. can u elaborate?

    1. Mostly you need to check if the mouse device is enumerated. Look in /dev/input and then set the QWS_MOUSE_PROTO variable properly. Its shown how to do that in the article.

  37. Hello suchakra.Thanks for your guidence in building qt for mini 2440.I faced some problems while configuring Qt by following command
    ./configure -embedded arm -xplatform qws/linux-arm-g++ -prefix /usr/local/Qt -qt-mouse-tslib -little-endian -no-webkit -no-qt3support -no-cups -no-largefile -optimized-qmake -no-openssl -nomake tools -qt-sql-sqlite -no-3dnow -system-zlib -qt-gif -qt-libtiff -qt-libpng -qt-libmng -qt-libjpeg -no-opengl -gtkstyle -no-openvg -no-xshape -no-xsync -no-xrandr -qt-freetype -qt-gfx-linuxfb -qt-kbd-tty -qt-kbd-linuxinput -qt-mouse-tslib -qt-mouse-linuxinput

    I got the following error….

    project.o: could not read symbols: File in wrong format
    collect2: ld returned 1 exit status
    make: *** [/usr/local/qt-everywhere-opensource-src-4.6.3/bin/qmake] Error 1

    please help me

    1. Clean the project and rebuild. You may have copied the project from a previous windows build and its still having those stale object files. So clean and rebuild. It will solve the issue I suppose

  38. Thnks for your help.i rebuild the project and compile successfully.and i copy all requied folders to mini2440.now my problem is when i try to run analogclock application,following message displayed.
    ./analogclock -qws
    ./analogclock: can’t load library ‘libstdc++.so.6′

    how i install that library?please help me

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s