Tuesday, 28 June 2011

Compiling Qt mobility for Simulator on Windows

These days I am working on a Symbian application using Qt 4.7.3 and Qt mobility 1.2.0.

Since the last version of Qt SDK doesn't ship Qt mobility 1.2.0 for the simulator, I had to recompile it myself. Since it took me some time, I write a step by step how to to help people who are trying to do the same thing.

The only real problem is that the SDK for windows doesn't include all the headers files needed to compile the sources. So I copied them from my linux installation of the SDK.
  1. Make sure you have the latest version of Qt SDK. As I write it it is the version 1.1.2, including Qt 4.7.3 and Qt mobility 1.1.3. In my case the SDK is installed into c:\QtSDK.
  2. Get the sources of qt mobility for the simulator from its git repository. Note that it is not the same repository as for Symbian or desktop version.
  3. Two directories are missing in the the simulator source on windows:
    • c:\QtSDK\Simulator\Qt\mingw\include\private
    • c:\QtSDK\Simulator\Qt\mingw\include\QtGui\private
    So what I did is copied those directory from my linux partition where Qt SDK was installed (from the directory ./QtSDK/Simulator/Qt/gcc/include).
  4. In a windows console, set up the PATH to include all the needed tools. You need qmake from the Simulator SDK, perl, and makew32-make:

    set PATH=c:\QtSDK\Simulator\Qt\mingw\bin;%PATH%
    set PATH=c:\QtSDK\mingw\bin;%PATH%
    set PATH=c:\QtSDK\Symbian\tools\perl\bin\;%PATH%

  5. Run configure. In my case I didn't need the messaging module and since it requires dependencies I removed it from the list of modules using the -modules argument of the command:

    configure -modules "bearer contacts gallery location publishsubscribe multimedia systeminfo serviceframework sensors versit organizer feedback connectivity"

  6. Run the make command:


  7. Finally install everything:

    mingw32-make install
After this I was able to compile and run applications using qt mobility 1.2.0 on the simulator.


nanz said...

Hey, I wanted to know something bro. Is qt mobility pack only for symbian^3 devices or also for symbian^1 devices. Actually, I am in a mess, need to calculate battery current and voltage and thats available only in qt mobility 1.2 class and I have to do this on a nokia 5800. I was unable to find any symbian APIs for battery current and voltage and somehow my Qtmobility 1.2 gives me errors during the mingw32-make step. I followed your instructions but still stuck. Please help me ASAP. Doing an internship project. Thanks in advance.

nanz said...

I m referring to Qt mobility 1.2 in the first post.

esarijal said...

I have QtSDK 1.1.2 from Nokia and i now need for use QtMobility 1.2

I download the source from here http://labs.qt.nokia.com/2011/05/12/qt-mobility-1-2-0-released/

and when i run configure -prefix d:\QtMobility it goes well

but when i try to mingw32-make it goes wrong and end like this

qsysteminfo_win.cpp:2518: error: 'BATTERY_SYSTEM_BATTERY' was not declared in th
is scope
qsysteminfo_win.cpp:2519: error: 'BATTERY_IS_SHORT_TERM' was not declared in thi
s scope
qsysteminfo_win.cpp:2523: error: 'BATTERY_WAIT_STATUS' was not declared in this
qsysteminfo_win.cpp:2523: error: expected ';' before 'batteryWaitStatus'
qsysteminfo_win.cpp:2524: error: 'batteryWaitStatus' was not declared in this sc
qsysteminfo_win.cpp:2526: error: 'BATTERY_STATUS' was not declared in this scope

qsysteminfo_win.cpp:2526: error: expected ';' before 'batteryStatus'
qsysteminfo_win.cpp:2527: error: 'IOCTL_BATTERY_QUERY_STATUS' was not declared i
n this scope
qsysteminfo_win.cpp:2527: error: ISO C++ forbids taking the address of an unqual
ified or parenthesized non-static member function to form a pointer to member fu
nction. Say '&QtMobility::QSystemBatteryInfoPrivate::batteryStatus'
qsysteminfo_win.cpp:2527: error: ISO C++ forbids applying 'sizeof' to an express
ion of function type
qsysteminfo_win.cpp:2528: error: '((QtMobility::QSystemBatteryInfoPrivate*)this)
->QtMobility::QSystemBatteryInfoPrivate::batteryStatus' does not have class type

qsysteminfo_win.cpp:2528: error: 'BATTERY_POWER_ON_LINE' was not declared in thi
s scope
qsysteminfo_win.cpp:2531: error: '((QtMobility::QSystemBatteryInfoPrivate*)this)
->QtMobility::QSystemBatteryInfoPrivate::batteryStatus' does not have class type

mingw32-make[3]: *** [../../build/Debug/QtSystemInfo/qsysteminfo_win.o] Error 1
mingw32-make[3]: Leaving directory `D:/QtMobility/qt-mobility-opensource-src-1.2
mingw32-make[2]: *** [debug-all] Error 2
mingw32-make[2]: Leaving directory `D:/QtMobility/qt-mobility-opensource-src-1.2
mingw32-make[1]: *** [sub-systeminfo-make_default] Error 2
mingw32-make[1]: Leaving directory `D:/QtMobility/qt-mobility-opensource-src-1.2
mingw32-make: *** [sub-src-make_default-ordered] Error 2

any suggestion??

Thanks in Advance

Guillaume said...

esarijal: The instruction I gave are only for compiling the simulator version of Qt mobility. I take the source for the simulator-mobility git repository. I think the sources you get are not the same.

If you try to compile Qt mobility for symbian, I think there are some resources online about how to do that, though I guess it is not easy since otherwise nokia would have released the compiled version already.

Good luck!

karmel said...

I've just compiled QtMobility but I can't run my app using it (though it compiles properly). Right after I start it says "Could not connect to mobility server" and quits.
Did You somehow configured simulator to use with mobility 1.2?

Cristian Adam said...

Great stuff. Thanks for sharing.

It helped me to build Qt Mobility head (1.2.1).

I needed location and systeminfo and I only had to patch this: http://pastebin.com/MqNkpfSi


7n1 said...

Hi ,

I am a student working on my final year project developing a desktop navigation system. I have a huge problem in installing and configuring Qt Mobility as my project requires the use of location setting in qt.

I am currently using
Qt Creator 2.4.0
Based on Qt 4.7.4 (32 bit)

I believed that qt mobility have been installed for me with the sdk.
Did i missed out something?
Really appreciate your help and thankyou very much for your time.

Mobility Battery said...

Thanks for sharing this.

jeniferraaj254 said...

Thanks for such innovative and amazing information..Good here is really nice information.
Web Designer luton
Web design wakefield