By following this article, you should be ready to develop Qt Mobility applications on Windows.
Note: This is only for Qt for Windows installation. If you want to develop Qt applications for Symbian on Windows, click here.
- Install Qt SDK 4.6 + Qt Creator 1.3 for Windows.
- Install Strawberry Perl for Windows (~ 32 MB). The reason why Perl is needed is covered in the later in this article.
- Download Qt Mobility library sources.
- Unpack Qt Mobility source distribution into a folder without spaces, e.g. C:\qtmobility
- Apply this patch to config.tests/make/make.pro. You can use patch tool, but you can edit the file manually (view the patch to see changes).
- Launch Qt Command Prompt
- Set the PATH to Strawberry Perl :
set PATH=%PATH%;C:\strawberry\perl\bin
- Go to your Qt Mobility folder and run configure:
cd \qtmobility configure
This will configure Qt Mobility build with default target directory: C:\QtMobility
- Build Qt Mobility:
mingw32-make mingw32-make install
- Add C:\qtmobility\lib folder to your PATH environment variable (more on this below).
- To add Qt Mobility documentation in Qt Creator: Go to Tools -> Options -> Help -> Add. Then browse C:\qtmobility/doc/qch/qtmobility.qch.
Setting Environment Variables
In order to use Qt Mobility some environment variables need to be extended to locate the libraries, which are placed in the lib directory of the install path.On Windows: PATH should be extended to include: C:\%TARGET_DIR%\lib
On my setup this folder is: C:\qt-mobility-src-1.0.0-tp2\lib
PATH can be extended through Start -> Settings -> Control Panel -> System -> Advanced -> Environment variables. Under System variables, select "PATH", click "Edit..." and append your Qt Mobility lib folder.
Reboot your system to apply your changes to system environment variables.
You're now ready to develop Qt Mobility applications in Windows. :-)
Problems I Encountered... So You Don' Have To
I first tried to unpack Qt Mobility into My Documents, but I can't compile it:
C:\Users\ceefour\Documents\qt-mobility-src-1.0.0-tp2>configure C:\Users\ceefour\Documents\qt-mobility-src-1.0.0-tp2 Checking available Qt 4.6.0 Checking make "Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH" "Aborting."I tried to move it to a top-level folder (C:\qtmobility) but still getting the same error.
After reading Forum Nokia thread: Qt Mobility problem, I tried to reboot my computer, but didn't help. There's also steps to install Qt Mobility for Symbian.
After further investigation leads me that configure determines its expected build system to be symbian-sbsv2 based on running qmake on config.tests\make\make.pro :
C:\qt-mobility-src-1.0.0-tp2>qmake config.tests\make\make.pro Project MESSAGE: symbian-sbsv2 Project MESSAGE: symbian-sbsv2 Project MESSAGE: symbian-sbsv2 C:\qt-mobility-src-1.0.0-tp2>make 'make' is not recognized as an internal or external command, operable program or batch file.So it's looking for make.exe, which doesn't exist on my system.
... for /f "tokens=3" %%i in ('%QT_PATH%qmake %SOURCE_PATH%\config.tests\make\make.pro 2^>^&1 1^>NUL') do set BUILDSYSTEM=%%i set BUILDSYSTEM=win32-mingw if %BUILDSYSTEM% == symbian-abld ( ...Update: Use this patch.
and now configure seem to work...
C:\qt-mobility-src-1.0.0-tp2>configure C:\qt-mobility-src-1.0.0-tp2 Checking available Qt 4.6.0 Checking make hello ... mingw32-make found. Start of compile tests Checking LBT 'Y_MAKEPROJECT_LOG' is not recognized as an internal or external command, operable program or batch file. ... Not Found 'compile' is not recognized as an internal or external command, operable program or batch file. "Generating Mobility Headers..." The system cannot find the file specified. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. 'perl' is not recognized as an internal or external command, operable program or batch file. Running qmake... Reading C:/qt-mobility-src-1.0.0-tp2/src/src.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/global/global.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/serviceframework/serviceframework.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/bearer/bearer.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/location/location.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/contacts/contacts.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/multimedia/multimedia.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/publishsubscribe/publishsubscribe.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/versit/versit.pro Reading C:/qt-mobility-src-1.0.0-tp2/src/systeminfo/systeminfo.pro Reading C:/qt-mobility-src-1.0.0-tp2/tools/tools.pro Reading C:/qt-mobility-src-1.0.0-tp2/tools/servicefw/servicefw.pro Reading C:/qt-mobility-src-1.0.0-tp2/tools/servicexmlgen/servicexmlgen.pro Reading C:/qt-mobility-src-1.0.0-tp2/tools/vsexplorer/vsexplorer.pro Reading C:/qt-mobility-src-1.0.0-tp2/tools/qcrmlgen/qcrmlgen.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/plugins.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/contacts/contacts.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/multimedia/multimedia.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/multimedia/m3u/m3u.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/multimedia/phonon/phonon.pro Reading C:/qt-mobility-src-1.0.0-tp2/plugins/multimedia/audiocapture/audiocapt ure.pro Reading C:/qt-mobility-src-1.0.0-tp2/doc/doc.pro Reading C:/qt-mobility-src-1.0.0-tp2/doc/src/snippets/snippets.pro Reading C:/qt-mobility-src-1.0.0-tp2/doc/src/snippets/qtcontactsdocsample/qtco ntactsdocsample.pro configure has finished. You may run mingw32-make to build the project now.Time to run mingw32-make and pray:
... g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS _QMAIN -I"c:\Qt\2009.05\qt\include\QtCore" -I"c:\Qt\2009.05\qt\include\QtGui" -I "c:\Qt\2009.05\qt\include" -I"c:\Qt\2009.05\qt\include\QtContacts_tp" -I"..\..\. .\..\src\global" -I"..\..\..\..\src\contacts" -I"..\..\..\..\src\contacts\reques ts" -I"..\..\..\..\src\contacts\filters" -I"..\..\..\..\src\contacts\details" -I "c:\QtMobility\include" -I"c:\Qt\2009.05\qt\include\ActiveQt" -I"..\..\..\..\bui ld\Release\qtcontactsdocsample\moc" -I"c:\Qt\2009.05\qt\mkspecs\win32-g++" -o .. \..\..\..\build\Release\qtcontactsdocsample\moc_requestexample.o ..\..\..\..\bui ld\Release\qtcontactsdocsample\moc\moc_requestexample.cpp g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows -o ..\..\..\..\bin\examples\qtcon tactsdocsample.exe ../../../../build/Release/qtcontactsdocsample/qtcontactsdocsa mple.o ../../../../build/Release/qtcontactsdocsample/moc_requestexample.o -L"c: \Qt\2009.05\qt\lib" -lmingw32 -lqtmain -LC:\qt-mobility-src-1.0.0-tp2/lib -LC:\Q tMobility/lib -lQtContacts_tp -lQtGui4 -lQtCore4 mingw32-make[4]: Leaving directory `C:/qt-mobility-src-1.0.0-tp2/doc/src/snippet s/qtcontactsdocsample' mingw32-make[3]: Leaving directory `C:/qt-mobility-src-1.0.0-tp2/doc/src/snippet s/qtcontactsdocsample' mingw32-make[2]: Leaving directory `C:/qt-mobility-src-1.0.0-tp2/doc/src/snippet s' mingw32-make[1]: Leaving directory `C:/qt-mobility-src-1.0.0-tp2/doc' C:\qt-mobility-src-1.0.0-tp2>_The build took a few minutes and it seems everything's fine.
P.S.: I could have just "given up" and install Symbian S60 SDK first. :-)
Compiling Qt Mobility with Debug enabled
If you try to develop a Qt Mobility app and using the Debug configuration (which is default), you'll get errors similar to these:
Running build steps for project locale-qt...
Starting: c:/qt/2009.05/qt/bin/qmake.exe C:/Users/ceefour/Documents/locale-qt/locale-qt.pro -spec win32-g++ -r
Exited with code 0.
Starting: C:/Qt/2009.05/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `C:/Users/ceefour/Documents/locale-qt'
C:/Qt/2009.05/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/Users/ceefour/Documents/locale-qt'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\locale-qt.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -L"c:\Qt\2009.05\qt\lib" -lmingw32 -lqtmaind -LC:\qtmobility/lib -lQtSystemInfo_tpd -lQtGuid4 -lQtNetworkd4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/Users/ceefour/Documents/locale-qt'
mingw32-make: Leaving directory `C:/Users/ceefour/Documents/locale-qt'
c:/qt/2009.05/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../../mingw32/bin/ld.exe: cannot find -lQtSystemInfo_tpd
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\locale-qt.exe] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project locale-qt
When executing build step 'Make'
You have two choices:
- Build your project using Release configuration.
- Build Qt Mobility with Debug enabled as well.
configure -debug
Then repeat the build process as usual.
Installing Perl
I noticed some errors early in the "configure" process:
"Generating Mobility Headers..." Access is denied. 'perl' is not recognized as an internal or external command, operable program or batch file. ...This is one reason why I
Get Strawberry Perl for Windows (~ 32 MB).
Strawberry Perl automatically adds itself to your PATH system variable, you can check this by running perl -v :
C:\strawberry>perl -v This is perl, v5.10.1 (*) built for MSWin32-x86-multi-thread Copyright 1987-2009, Larry Wall Perl may be copied only under the terms of either the Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit. Complete documentation for Perl, including FAQ lists, should be found on this system using "man perl" or "perldoc perl". If you have access to the Internet, point your browser at http://www.perl.org/, the Perl Home Page.Unfortunately, Qt Command Prompt sets its own PATH environment variable, overriding. Before running configure, do:
set PATH=%PATH%;C:\strawberry\perl\binNow you can configure and build Qt Mobility on Windows properly.
See also:
Hey,
ReplyDeleteFor me I got another problem:
On the line 151 on the Makefile on C:\Qt\QtMobility\plugins\multimedia\audiocapture there's also a problem there, at least for me.
It's the word "Makefile" that shouldn't be there. Hope it helps someone. :)
Best Regards,
Joel Oliveira
I get WARNING: Failure to find: myplugin.h
ReplyDeleteconfigure failed. when i configure
Thank you for this post!
ReplyDeleteIt works very well for me...
Hi,
ReplyDeleteyour post worked for me.
Thanks.
ashish
I'm still facing the same problem..Checking make
ReplyDelete"Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH"
"Aborting." please help...
Great writeup!
ReplyDeleteAlthough I can run Qt Mobility just fine on my development PC, when I attempt to deploy the application to a different Windows 7 PC that does not have Qt installed, I get an error stating that the QtMultimediaKit module cannot be found. I've tried copying all the necessary DLLs into the application's executing folder with no luck.
Question: how does one go about deploying an application that makes use of the Qt Mobility module?
C:\QtMobility\qt-mobility-opensource-src-1.1.0-tp
ReplyDeleteChecking available Qt
4.7.0
Checking make
... Unknown target environment .
Cannot find 'nmake', 'mingw32-make' or 'make' in your PATH
Aborting.
used patch, but still the same
halo, i'm a newby. i wanna ask some stupid question. In step 5 you said "Apply this patch to config.tests/make/make.pro. You can use patch tool, but you can edit the file manually (view the patch to see changes).", and i don't get it. how can i do this step exactly (patching to .pro file)? Thanks before.
ReplyDeleteThanks for taking the time to do what the Nokia QT people did not. Keep Well
ReplyDelete