Compilation Issue with QWS example

  • I have Qt4.5 Installed on Desktop PC On Ubuntu OS.
    While compiling QWS Example i am getting below error -

    .obj/release-shared/calibration.o: In function Calibration::accept()': /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:141: undefined reference toQWSServer::mouseHandler()'
    .obj/release-shared/calibration.o: In function Calibration::mouseReleaseEvent(QMouseEvent*)': /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:125: undefined reference toqt_screen'
    .obj/release-shared/calibration.o: In function Calibration::exec()': /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:95: undefined reference toQWSServer::mouseHandler()'
    .obj/release-shared/calibration.o: In function Calibration': /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:67: undefined reference toqt_screen'
    /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:67: undefined reference to qt_screen' .obj/release-shared/calibration.o: In functionCalibration::paintEvent(QPaintEvent*)':
    /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:113: undefined reference to qt_screen' .obj/release-shared/main.o: In functionmain':
    /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/main.cpp:55: undefined reference to QWSServer::mouseHandler()' collect2: ld returned 1 exit status make[1]: *** [mousecalibration] Error 1 make[1]: Leaving directory/opt/qtsdk-2010.04/qt/examples/qws/mousecalibration'
    make: *** [sub-mousecalibration-make_default] Error 2*

    Please suggest what i am missing.


  • Is your Qt build as an embeddd Qt build? The QWSServer class (and some others) are only built if you configure Qt as embedded.

  • Ok..Is there any way to build same for non embedded platform ( For Desktop).

  • No. QWS is the windowing system provided by Qt for embedded where their is no other windowing system in place. The QWS stuff is only built when configuring for embedded.

    Having said that, you can of course build Qt in an embedded configuration but not cross compiled so that it runs on your desktop machine. There are a few ways this can work in practise:

    You run the app outside of X so that it draws directly to the Linux framebuffer

    You run the app within X but with the qvfb app running. This qvfb app is a virtual framebuffer. This is very useful even when developing for an embedded target system as it allow you to run your app locally.

    You run the app but force the display out over vnc. You then of course need a vnc viewer to actually see anything.

    It is actually possible to run the app on a framebuffer and vnc at the same time.

    Please come back if any of these strikes you as useful for what you are doing.

  • Thanks ZapB..While configuring/building the Qt as embedded i did below step-

    ./configure -embedded i32 -xplatform linux-g++ -I /usr/lib/glib-2.0/include/*

    But i am getting below error while build -

    .obj/release-shared-emb-i32/qthread_unix.o: In function QThreadPrivate::createEventDispatcher(QThreadData*)': qthread_unix.cpp:(.text+0x680): undefined reference toQEventDispatcherGlib::QEventDispatcherGlib(QObject*)'
    qthread_unix.cpp:(.text+0x721): undefined reference to QEventDispatcherGlib::versionSupported()' .obj/release-shared-emb-i32/qcoreapplication.o: In functionQCoreApplicationPrivate::createEventDispatcher()':
    qcoreapplication.cpp:(.text+0x1727): undefined reference to QEventDispatcherGlib::QEventDispatcherGlib(QObject*)' qcoreapplication.cpp:(.text+0x1761): undefined reference toQEventDispatcherGlib::versionSupported()'
    .obj/release-shared-emb-i32/qtextcodec.o: In function setup()': qtextcodec.cpp:(.text+0x2014): undefined reference toQIconvCodec::QIconvCodec()'
    collect2: ld returned 1 exit status
    make[1]: *** [../../lib/] Error 1
    make[1]: Leaving directory `/home/embeddedQt/qtsdk-2010.04/qt/src/corelib'
    make: *** [sub-corelib-make_default-ordered] Error 2

    On my Desktop glib is already installed..what could be the reason of above?

  • You also need to have glib available in your cross-compiling sysroot. Ie if you want support for a feature then you need that feature available in your cross-environment. If not then disable it via the configure line.

  • I am enabling glib through below command

    ./configure -embedded i32 -xplatform linux-g++ -qvfb -glib

    But it says-
    "Glib support cannot be enabled due to functionality tests!"

  • Yes, that is why I said to disable it if it is not available in your cross compiling sysroot. Try passing in -no-glib to your Qt configure line. When trying things like this it also often helps to pass in the -verbose argument so that you can see what tests pass/fail.

    If you still can't get it working please paste in the relevant section of the configure process.

  • Hey ZapB I Tried as per your comment and finally able to build. Thanks for your quick support. I gave below command -

    ./configure -embedded x86 -xplatform linux-g++ -no-glib -no-iconv -qvfb

    I am also able to run QWS/framebuffer example outside the X which draws 3 rectangle using qvfb.Which perfact works for me.

    But still getting compilation error on mousecalibration example-
    /opt/qtsdk-2010.04/qt/examples/qws/mousecalibration/calibration.cpp:141: undefined reference to QWSServer::mouseHandler()

  • When you are running qmake on the application .pro file, are you sure that you are running the correct version of qmake. ie the one built as part of your Qt-embedded build?

    Where is your Qt-embedded installed to? Can you post the output of:

    @which qmake@


    @qmake -r@



    Hopefully that will show us which libs the app is trying to link to and whether they are the right ones or not.

    I'm offline for periods this week so it may take me a day or more to get back to you.

    Good luck!

  • Yes..My embedded Qt is installed on home/embeddedQt/qtsdk-2010.04/qt/

    Output of which qmake
    /home/embeddedQt/qtsdk-2010.0Reading /home/embeddedQt/qtsdk-2010.04/qt/examples

    Outputof qmake -r


    Reading /home/embeddedQt/qtsdk-2010.04/qt/examples/qws/framebuffer/
    Reading /home/embeddedQt/qtsdk-2010.04/qt/examples/qws/mousecalibration/
    Reading /home/embeddedQt/qtsdk-2010.04/qt/examples/qws/simpledecoration/

    Output of make -

    g++ -Wl,-rpath-link,/home/embeddedQt/qtsdk-2010.04/qt/lib -Wl,-O1 -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.6.3-i386/lib -Wl,-rpath,/usr/local/Trolltech/QtEmbedded-4.6.3-i386/lib -o mousecalibration .obj/release-shared-emb-x86/calibration.o .obj/release-shared-emb-x86/scribblewidget.o .obj/release-shared-emb-x86/main.o -L/home/embeddedQt/qtsdk-2010.04/qt/lib -lQtGui -L/home/embeddedQt/qtsdk-2010.04/qt/lib -lQtNetwork -lQtCore -lpthread
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::accept()': calibration.cpp:(.text+0xb): undefined reference toQWSServer::mouseHandler()'
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::mouseReleaseEvent(QMouseEvent*)': calibration.cpp:(.text+0x39): undefined reference toqt_screen'
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::exec()': calibration.cpp:(.text+0xd0): undefined reference toQWSServer::mouseHandler()'
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::Calibration()': calibration.cpp:(.text+0x283): undefined reference toqt_screen'
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::Calibration()': calibration.cpp:(.text+0x403): undefined reference toqt_screen'
    .obj/release-shared-emb-x86/calibration.o: In function Calibration::paintEvent(QPaintEvent*)': calibration.cpp:(.text+0x51f): undefined reference toqt_screen'
    .obj/release-shared-emb-x86/main.o: In function main': main.cpp:(.text+0x3d): undefined reference toQWSServer::mouseHandler()'
    collect2: ld returned 1 exit status
    make: *** [mousecalibration] Error 1

  • Do you have another Qt installation in path? Try the absolutpath to your embedded qmake!

  • Initially while making setup i downloaded below Qt-4.6.3 version complete SDK and installed it on Desktop


    The Desktop Qt installed path was /opt. Then i took the copy of Desktop Qt qtsdk-2010.04 folder on /home and i configure the Qt as embedded and built it. While build i am giving the path of Qt embedded only.

  • Have you tried /pathtoyourqt-embedded/qmake *.pro && make?

  • Hi ZapB, Scylla,

    I got the solution today..the problem was with my qt embedded installation. I was using the sysroot qt sdk which i got after running the qt-sdk-linux-x86-opensource-2010.05.1.bin.It built fine with default configuration but for embedded configuration (./configure -embedded x86 -xplatform linux-g++ -no-glib -no-iconv -qvfb) it gave me build issue with QWS example.
    Then i downloaded the qt for embedded linux version 4.6.2 (qt-everywhere-opensource-src-4.6.2.tar.gz) which works fine for qws.
    ZapB thanks alot for your support for finally fixing the issue. ..

  • Hi ZapB. I m a beginner in Qt. Is there anyway I can implement and use the QWS on my Desktop Linux system? or Is there any way I can emulate the embedded Linux on the present Linux system.
    Also, is there a X Window(client/server) equivalent in Qt?

    Awaiting your reply.
    Thank you.

  • Yes you can use qws on your Desttop linux.Download qt-everywhere-opensource-src-4.6.2.tar.gz and gothrough READ.
    Configure -
    ./configure -embedded x86 -xplatform linux-g++
    make;make install and run the program using -qws as command line argument from console.
    Note- you have to go out from xserver to use qws

    Rahul Pandey

  • Thank you Rahul Pandey. I ll give it a try n get back to u.

    Vijaeendra Simha

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.