PDA

View Full Version : Create N900 app in Qt under Windows 7



rickrvo
17th January 2011, 15:26
Hi,

I'm trying to create a version of my windows app for the N900 on Qt creator 2.0.1 under 4.7.0 version for windows.


It runs on Qt Simulator, but when I compile the project targeting Maemo it fails right at the begging... I don't know if it is .pro configuration missing or what it is...

Here is the output of a build of one of the plugins for the app:

Running build steps for project VNCHooks...
Starting: "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" clean -w
make: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
c:\nokiaqtsdk\simulator\qt\mingw\bin\qmake.exe -spec c:\NokiaQtSDK\Simulator\Qt\mingw\mkspecs\win32-g++ -o Makefile VNCHooks.pro
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
e:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\VNCHooks\VNCHooks.pro:30: Parse Error ('../uni_net-student-mobile-maemo/maemo')

Error processing project file: VNCHooks.pro

make: *** [Makefile] Error 3
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited with code %2.
Starting: "c:/nokiaqtsdk/maemo/4.6.2/targets/fremantle-pr13/bin/qmake.exe" E:/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/VNCHooks.pro -r -spec default -unix CONFIG+=debug -unix
-unix is deprecated.

-unix is deprecated.

e:/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/VNCHooks.pro:30: Parse Error ('../uni_net-student-mobile-maemo/maemo')

Error processing project file: E:/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/VNCHooks.pro

The process "c:/nokiaqtsdk/maemo/4.6.2/targets/fremantle-pr13/bin/qmake.exe" exited with code %2.
Error while building project VNCHooks (target: Maemo)
When executing build step 'qmake'

wysota
17th January 2011, 20:06
What's in line 30 of the offending file?

rickrvo
18th January 2011, 09:50
What's in line 30 of the offending file?

oops sorry! I pasted the wrong error... I fixed that one. It was a miss-typing error in .pro

this is the correct error:

Running build steps for project VNCHooks...
Starting: "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" clean -w
make: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
/bin/make -f Makefile.Debug clean
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
rm -f debug/SharedData.o debug/VNCHooks.o
rm -f *~ core *.core
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
/bin/make -f Makefile.Release clean
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
rm -f release/SharedData.o release/VNCHooks.o
rm -f *~ core *.core
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited normally.
Configuration unchanged, skipping qmake step.
Starting: "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" -w
make: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
/bin/make -f Makefile.Debug
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
g++ -c -pipe -mwindows -g -Wall -W -D_REENTRANT -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -Ic:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/share/qt4/mkspecs/default -I. -Ic:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/include -Idebug -o debug/SharedData.o ../nsserver/win32/src/VNCHooks/SharedData.cpp
cc1plus.exe: error: unrecognized command line option "-mwindows"

make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks'
make[1]: *** [debug/SharedData.o] Error 1
make: *** [debug] Error 2
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited with code %2.
Error while building project VNCHooks (target: Maemo)
When executing build step 'Make'

wysota
18th January 2011, 11:57
cc1plus.exe: error: unrecognized command line option "-mwindows"
Where did this come from? I mean the -mwindows option. It's not put there by Qt.

rickrvo
18th January 2011, 14:53
Where did this come from? I mean the -mwindows option. It's not put there by Qt.

I don't know... I know that If I compile it without the check in shadow build and specifying the folder E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\VNCHooks\maemo it returns that error.

If I check shadow build on that folder the error is:

Running build steps for project VNCHooks...
Starting: "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" clean -w
make: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
/bin/make -f Makefile.Debug clean
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
rm -f debug/SharedData.o debug/VNCHooks.o
rm -f *~ core *.core
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
/bin/make -f Makefile.Release clean
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
rm -f release/SharedData.o release/VNCHooks.o
rm -f *~ core *.core
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited normally.
Configuration unchanged, skipping qmake step.
Starting: "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" -w
make: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
/bin/make -f Makefile.Debug
make[1]: Entering directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/VNCHooks/maemo'
make[1]: *** No rule to make target `../nsserver/win32/src/VNCHooks/SharedData.cpp', needed by `debug/SharedData.o'. Stop.
make: *** [debug] Error 2
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited with code %2.
Error while building project VNCHooks (target: Maemo)
When executing build step 'Make'

wysota
18th January 2011, 15:05
You must be using a wrong toolchain. -mwindows may be put in the Makefile when the compilation takes place for Cygwin or for Windows and not for armel. You can see that in your second try a file within "win32" folder is referenced which also shouldn't be happening. Make sure all paths are set correctly. In doubt perform the compilation from the command line.

rickrvo
18th January 2011, 15:26
I found the -mwindows where it is comming from...

this is my .pro file:

QT -= core \
gui
CONFIG += debug_and_release
TRANSLATIONS += vnchooks.ts
TARGET = VNCHooks
DEFINES -= UNICODE
TEMPLATE = lib
SOURCES += ../nsserver/win32/src/VNCHooks/SharedData.cpp \
../nsserver/win32/src/VNCHooks/VNCHooks.cpp
HEADERS += ../nsserver/win32/src/VNCHooks/SharedData.h \
../nsserver/win32/src/VNCHooks/VNCHooks.h
QMAKE_CFLAGS += -mwindows
QMAKE_CXXFLAGS += -mwindows
LIBS += -lgdi32 \
-Wl,-subsystem,windows
Release:DLLDESTDIR = ../nsserver/release \
../uni_net-classroom/release \
../uni_net-student/release \
../uni_net-student-mobile-maemo/release \
../uni_net-student-mobile-maemo/simulator/release \
../uni_net-student-mobile-maemo/maemo
Debug:DLLDESTDIR = ../nsserver/debug \
../uni_net-classroom/debug \
../uni_net-student/debug \
../uni_net-student-mobile-maemo/debug \
../uni_net-student-mobile-maemo/simulator/debug \
../uni_net-student-mobile-maemo/maemo

should I take out the .../win32 path?

Just to clear you out nsserver is another plugin..

wysota
18th January 2011, 15:31
You should take out everything. The whole file doesn't make any sense. Including assignments to DLLDESTDIR. You can see the compilation of the VNCHooks subproject takes place and there are obvious references to Windows stuff there.

rickrvo
18th January 2011, 15:54
but the project was running on Qt simulator... I don't get it. where can I get examples of .pro files for the n900? (I never programmed for the n900) this is my first time and already I have to port the windows app to the mobile... :\

wysota
18th January 2011, 17:18
but the project was running on Qt simulator... I don't get it.
The simulator uses your desktop platform and not the mobile platfom.


where can I get examples of .pro files for the n900? (I never programmed for the n900) this is my first time and already I have to port the windows app to the mobile... :\
N900 doesn't use Windows GDI so I'd start by getting rid of that.

rickrvo
19th January 2011, 12:05
I disposed of that plugin as it wasn't very important for the version for the n900.

Now I'm having another problem which is the same on every other plugin that I'm trying to compile

which is:


...
Package Name : libjpeg
Version : 0.0.1
License : gpl
Using dpatch : no
Type of Package : Single
Hit <enter> to confirm:
Done. Please edit the files in the debian/ subdirectory now. libjpeg
uses a configure script, so you probably don't have to edit the Makefiles.
Package Creation: Running command 'dh_installdirs'.
Packaging Error: Could not copy 'E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\libjpeg\libjpeg' to 'E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\libjpeg\debian\libjpeg\\usr\local\bin\libj peg'.
Error while building project libjpeg (target: Maemo)
When executing build step ''

This is the output on the libjpeg plugin... on the attendees plugin the output is:



...
ar cqs libattendees.a debug/call_data.o
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/plugins/attendees'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/plugins/attendees'
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited normally.
Creating package file ...
Package Creation: Running command 'dh_installdirs'.
Packaging Error: Could not copy 'E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\plugins\attendees\attendees' to 'E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\plugins\attendees\debian\attendees\\usr\lo cal\bin\attendees'.
Error while building project attendees (target: Maemo)
When executing build step ''

I don't know why it keeps trying to copy 'E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\libjpeg\libjpeg and E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\plugins\attendees\attendees when the folder is only 1 libjpeg and not libjpeg\libjpeg... also targeting E:\Projecto\uni_net-1.4.1-Mobile\uni_net-project\plugins\attendees\debian\attendees\\usr\lo cal\bin\attendees with 2 \\ instead of 1.

it's happening on every plugin... the .pro of these 2 are:

attendees

TARGET = attendees
TEMPLATE = lib
CONFIG += staticlib \
debug_and_release
TRANSLATIONS += attendees.ts
SOURCES += src/call_data.cpp
HEADERS += include/call_data.h
INCLUDEPATH += include


libjpeg

QT -= core \
gui
CONFIG += qt debug_and_release
DEFINES -= UNICODE
TARGET = libjpeg
TEMPLATE = lib
DEFINES -= UNICODE
SOURCES += jutils.c \
jquant2.c \
jquant1.c \
jmemnobs.c \
jmemmgr.c \
jidctred.c \
jidctint.c \
jidctfst.c \
jidctflt.c \
jfdctint.c \
jfdctfst.c \
jfdctflt.c \
jerror.c \
jdtrans.c \
jdsample.c \
jdpostct.c \
jdphuff.c \
jdmerge.c \
jdmaster.c \
jdmarker.c \
jdmainct.c \
jdinput.c \
jdhuff.c \
jddctmgr.c \
jdcolor.c \
jdcoefct.c \
jdatasrc.c \
jdatadst.c \
jdapistd.c \
jdapimin.c \
jctrans.c \
jcsample.c \
jcprepct.c \
jcphuff.c \
jcparam.c \
jcomapi.c \
jcmaster.c \
jcmarker.c \
jcmainct.c \
jcinit.c \
jchuff.c \
jcdctmgr.c \
jccolor.c \
jccoefct.c \
jcapistd.c \
jcapimin.c
HEADERS += jversion.h \
jpeglib.h \
jpegint.h \
jmorecfg.h \
jmemsys.h \
jinclude.h \
jerror.h \
jdhuff.h \
jdct.h \
jconfig.h \
jchuff.h
win32:{QMAKE_CFLAGS += -mwindows
QMAKE_CXXFLAGS += -mwindows
LIBS += -Wl,-subsystem,windows
}
Release:DLLDESTDIR = ../nsserver/release ../uni_net-classroom/release ../uni_net-student/release ../uni_net-student-mobile-maemo/debug ../uni_net-student-mobile-maemo/simulator/debug
Debug:DLLDESTDIR = ../nsserver/debug ../uni_net-classroom/debug ../uni_net-student/debug ../uni_net-student-mobile-maemo/release ../uni_net-student-mobile-maemo/simulator/release

both are without shadow builds.

wysota
19th January 2011, 12:39
I told you that your DLLDESTDIR values don't make sense. Do you even know what this variable is for?

rickrvo
19th January 2011, 14:10
I know that it is to create dll and linux uses .so files... but that's not the problem that is originating the error. I erased those lines and the "could not copy" error persists.

wysota
19th January 2011, 15:09
If you have to use some framework it is a good idea to understand what it does before you start using it. What is failing is a build step for creating a package for maemo which will fail on Windows regardless of what settings you have in your .pro file. First because you are using Windows so you can't run Debian packaging scripts and second because the .pro file has nothing to do with creating the package. It is done by Creator. Disable the packaging step in Creator and you'll probably be fine.

And DLLDESTDIR is not used to create dll files. It points to a directory where the library should be created if the goal of the project is to create a library. If you point it to several directories, where should the library be created? In each of them?

rickrvo
19th January 2011, 15:27
yes, on the windows version some plugins must have the .dlls on their folder to compile and work properly. I don't know if it is going to be necessary on maemo. On linux the .so files must be on the project's folder and not inside its debug and release folders.

I know that I won't be able to run debian scripts on windows, I was wondering if I could compile it on windows and then copy it to my n900. I compiled a helloworld app and it created a package sucessfully under windows and I installed it on the n900 and it worked.

I've disabled the packaging step and no errors were found and the .so files were created! thanks

now, generally, I just have to place the .so files on the main project folder and it should work right?

wysota
19th January 2011, 15:37
yes, on the windows version some plugins must have the .dlls on their folder to compile and work properly.
No, that's false.


I don't know if it is going to be necessary on maemo. On linux the .so files must be on the project's folder and not inside its debug and release folders.
No, that's false.


I know that I won't be able to run debian scripts on windows, I was wondering if I could compile it on windows and then copy it to my n900.
But it's not compilation that fails.


now, generally, I just have to place the .so files on the main project folder and it should work right?
I have no idea, it's your project.

rickrvo
19th January 2011, 17:04
1st No, that's false.

I'm telling you that on my project I must have the staticlib plugin .dll on zlib folder in order for zlib plugin to compile without erros because it uses some dependencies from the staticlib plugin. And all of the .dll's must be on the debug or release accordingly on the main app in order for them to work. that's why I have the DLLDESTDIR set to all those folders.


2nd No, that's false.

I compile the same project under linux and it doesn't create the .so on the other project's folders and it works as well...


I'll run more tests if anything comes up I'll post here.

Thank a lot wysota!

wysota
19th January 2011, 17:29
I'm telling you that on my project I must have the staticlib plugin .dll on zlib folder in order for zlib plugin to compile without erros because it uses some dependencies from the staticlib plugin.
1) Static library and dll are two completely different things (dll means "dynamically loaded library").
2) Static libraries are not plugins.
3) It doesn't have to be in the folder you say. You can tell your compiler where to look for libraries.
4) DLLDESTDIR says where a dynamic library you build will be placed. It says nothing about (and doesn't affect) static libraries.

What is false about your second statement is that you assume something has to be somewhere and not that it affects or doesn't affect anything. If you need to link against some library then tell the component that needs it where to find it instead of copying it around, having multiple instances and never knowing which is which. The whole point of a library is that you have one copy of it. Otherwise you can just include its source files directly in each component that needs the functionality.

rickrvo
19th January 2011, 18:02
for instance I'm trying to compile zlib project and it keeps giving me this error:



...
gcc -c -pipe -g -D_REENTRANT -Wall -W -fPIC -DQT_GL_NO_SCISSOR_TEST -DQT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH=1024 -Ic:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/share/qt4/mkspecs/default -I. -Ic:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/include -Idebug -o debug/adler32.o adler32.c
rm -f liblibz.so.1.0.0 liblibz.so liblibz.so.1 liblibz.so.1.0
g++ -Wl,-rpath-link,/usr/lib -shared -Wl,-soname,liblibz.so.1 -o liblibz.so.1.0.0 debug/zutil.o debug/uncompr.o debug/trees.o debug/minigzip.o debug/maketree.o debug/infutil.o debug/inftrees.o debug/inflate.o debug/inffast.o debug/infcodes.o debug/infblock.o debug/gzio.o debug/deflate.o debug/crc32.o debug/compress.o debug/adler32.o -LC:/NokiaQtSDK/Maemo/4.6.2/sysroots/fremantle-arm-sysroot-20.2010.36-2-slim/usr/lib -L../staticlib/ -L../plugins/attendees -lz -ljpeg -lssl -lcrypto -lnsl -luni_net -lattendees -lpthread
make[1]: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/zlib'
make: Leaving directory `/e/Projecto/uni_net-1.4.1-Mobile/uni_net-project/zlib'
../staticlib//libuni_net.so: file not recognized: File format not recognized

collect2: ld returned 1 exit status

make[1]: *** [liblibz.so.1.0.0] Error 1
make: *** [debug] Error 2
The process "C:/nokiaqtsdk/maemo/4.6.2/bin/make.exe" exited with code %2.
Error while building project libz (target: Maemo)
When executing build step 'Make'

it is trying to access the staticlib's .so on its project folder. I still haven't figured out why this error occurs and what I'm doing wrong here... :\ but as well as windows zlib needs the staticlib's .dll to compile.

wysota
19th January 2011, 18:47
See that?

../staticlib//libuni_net.so: file not recognized: File format not recognized
It tries the library from this directory because it's told to look for it there by the -L flag. The library is probably meant for a different platform or is not a shared object file at all.

rickrvo
31st January 2011, 17:55
Hi,

I've managed to get the program to compile! I don't know why it wasn't working on a x86 ubuntu desktop but I've installed a ubuntu x86_64 version on a virtual machine and the same code runs without any errors...

Now the thing is that I'm trying to debug with Qt simulator for the N900.

when I step over this line: pluginsDir = QDir (qApp->applicationDirPath());

on the debugger the value for pluginsDir is <unavailable synchonous data> and exits the condition because it doesn't find any plugins...

Do you know why this happens?

wysota
31st January 2011, 18:14
Let's make one thing clear - there is no "Qt simulator for X" where "X" stands for anything you want. Qt simulator is a platform in its own rights that uses the same executable as your desktop but it writes to a virtual framebuffer and can be fed bogus data from sensors and stuff like that. If you are missing plugins then your simulator platform is missing plugins and not your N900 environment.

rickrvo
1st February 2011, 10:35
Let me clear my situation for you. First I tried to test my app under windows 7 on qt simulator. Here the debug works fine but as you told me it uses the desktop executables, so I wouldn't be testing it correctly under windows since when I compile for the Maemo the code is a bit different as my app has codes like this:

#if defined(Q_OS_WIN32)
fileName += ".dll";
#endif
#if defined(Q_OS_LINUX)
fileName = "lib" + fileName + ".so";
#endif
#if defined(Q_OS_MAC)
fileName += ".dylib";

So I tried to use qt simulator under linux to make sure that when compiled for Maemo all the testing would be more accurate. But under windows qt simulator returns the pluginsDir = QDir (qApp->applicationDirPath()); to the correct windows folder... but under linux returns <unavailable synchronous data>...

I think I'm out of ideas how to test my app... Under linux x86 the code wouldn't compile correctly... under linux x86_64 the same code compiles fine but qt simulator doesn't work. I tried installing MADDE n900 sdk and it said that it's not compatible with x86_64...

What can I do? try to install MADDE for windows and test it there?

I'm afraid that after spending lots of time trying to get this to work I won't be able to debug properly under windows 7 with MADDE with all the luck I'm having...

please help me again lol

wysota
2nd February 2011, 22:41
The simulator reacts to Q_WS_SIMULATOR. N900 reacts to Q_WS_MAEMO_5. If you want to test it for N900 then use Q_WS_MAEMO_5 and test it under an emulator.

rickrvo
3rd February 2011, 09:55
The simulator reacts to Q_WS_SIMULATOR. N900 reacts to Q_WS_MAEMO_5. If you want to test it for N900 then use Q_WS_MAEMO_5 and test it under an emulator.

which emulator do you recommend? for ubuntu x86_64 under a virtual machine. or windows 7? and where can I find a reliable installation guide to that emulator?

thanks

rickrvo
17th February 2011, 12:11
I've learned alot since the last post I've made here. I wanna tank you for all your help. I got everything to work. even created a deb file with plugins and works on the n900!!!

now the only issue I have is this one (http://www.qtcentre.org/threads/38717-Window-appears-as-a-popup-window-and-not-as-main-window..?p=178410#post178410) on this forum.

If you could help me just one more time... :D