PDA

View Full Version : QtCreator + MADDE + Linux


Intergalactic Christ
03-21-2010, 09:31 AM
Hi all,

I completely new to maemo development (just started reading up on it last night) but it seems the best way to go is using MADDE and QtCreator.

Looking at the MADDE wiki there are guides for integrating MADDE with QtCreator on Windows and Mac OS, but not for linux.

Currently I'm running Ubuntu karmic x64 and so I'm looking for a set-up in this environment. I do have Windows 7 lying around but would rather not set up a windows VM/ dual boot for this.

So is it possible to use MADDE with QtCreator in Linux?

Apologies is this is a daft question., but I've had a look around and from what I've read most MADDE questions/answers/guides seem to deal with windows.

Thanks

TNiga
03-21-2010, 10:25 AM
I don't know if it's possible but you could try it in the same manner as for Mac and Windows. Probably only the USB networking part is done differently on Linux (I don't know how, and you don't need that if you use WLAN) than on Mac/Windows.

cjard
03-21-2010, 10:47 AM
I had it in mind that MADDE is essentially a small linux FOR WINDOWS (a bit like the concept of cygwin) so that people with windows could build ARMEL (the chip in the n900) etc binaries

I thought if youre running Linux you can just install qt creator and use it along with all the necessary qt stuff to make the binaries

== if you run linux, you don't need MADDE, because MADDE is like a "windows to linux" conversion for people who run windows

I know that when I open MADDE terminal in windows I get a busybox style shell prompt and can qmake and make aps from it that target the ARM processor in the n900.. but I'm using the linux versions of qmake and make inside the emulator (MADDE) and you don't need the emulator..

Intergalactic Christ
03-21-2010, 11:00 AM
Ok,

Perhaps I've misunderstood MADDE's role as a dev tool (again I'm still in the process of learning about linux/maemo devlopment) but I had thought it was a cross compiler for compiling ARM code? Like scratchbox without the hassle of setting it up (from what I've read).

Also I'd wonder why would linux support be provided at all if it is to be used as a windows tool? Just a thought.

Thanks for the reply and giving me more to think about. I'm currently downloading Qt/QtCreator so will play about with that when it's installed.

acano
03-21-2010, 02:38 PM
you can use madde on linux using the line command instructions.

what is not yet allowed is the integration woth Qt. butg if you are a linux developper you only have to move to the corresponding folder where the qtcreator proyect is and exevute the mad command with the correct parameters.

Actually I am at the same point than you.

Intergalactic Christ
03-21-2010, 02:58 PM
So if I'm understanding this correctly it can be used as a command line tool for compiling and packaging for code done in QtCreator which then has to be manually copied to the device and installed each time, and it isn't possible to set up a 'one click solution' as it were in QtCreator in linux that MADDE would provide?

If so would it therefore be easier to go the scratchbox route? Or am I missing something and there is a more elegant way for testing on device?

Thanks again

luthepa1
03-21-2010, 05:43 PM
Yeah, looks like under linux you have to use command line tools to send and test on real device whereas on Win or OSX they have a "Maemo Device Config" option under Qt4 under tools -> options.

I dont have a problem with using the command line tools but it would have been nice to have the config option in QtCreator like the Win or OSX IDEs to make a one-click solution. I dont see why it would have been that hard to do. Unless anyone knows and mod/hack to accomplish this?

rmerren
03-21-2010, 05:43 PM
Madde is very helpful on linux. I found this formula to be good:

use qmake and make to develop and test on the linux box
use mad qmake and mad make to compile for n900, then scp to the n900 and run it on the n900


Just do a make clean between the x86 build and the arm build. You can script the make and scp to make it faster. Also, you can ssh to the n900 and start your app over ssh...it will magically appear on the device when you start it from the ssh connection.

cjard
03-22-2010, 05:09 AM
Ok,

Perhaps I've misunderstood MADDE's role as a dev tool (again I'm still in the process of learning about linux/maemo devlopment) but I had thought it was a cross compiler for compiling ARM code? Like scratchbox without the hassle of setting it up (from what I've read).

Also I'd wonder why would linux support be provided at all if it is to be used as a windows tool? Just a thought.

Thanks for the reply and giving me more to think about. I'm currently downloading Qt/QtCreator so will play about with that when it's installed.

Okay, having reviewd my QtC/MADDE install (on windows), I guess I'd say that windows MADDE is a suite of apps, some of which form a linux-shell-on-windows and others that are windows binaries that output programs in ARM binary format.. I.e. my QtC targets madde's qmake.exe (but if you downloaded the linux version of madde it would target an i386 linux qmake)
The qmake creates makefiles for the relevant make (in my system i396 make.exe, on your linux i386 make) that output ARM based binaries

My QtC also outputs windows binaries, using the qmake.exe/make.exe pair that shipped with QtCreator. I'd gotten caught up in the notion that as youre running linux and the n900 is also, that your QtC would just use its shipped q,ake/make to build apps for the n900, forgetting completely that youre using i386 linux and thats what kind of images your QtC/make will make. You'll need MADDE, because the make in MADDE runs on your i386 linux and creates ARM binaries

Sorry for the confusion

cjard
03-22-2010, 05:11 AM
Madde is very helpful on linux. I found this formula to be good:

use qmake and make to develop and test on the linux box
use mad qmake and mad make to compile for n900, then scp to the n900 and run it on the n900


Just do a make clean between the x86 build and the arm build. You can script the make and scp to make it faster. Also, you can ssh to the n900 and start your app over ssh...it will magically appear on the device when you start it from the ssh connection.

Indeed, on windows the make.exe that shipped with my QtC makes windows binaies. I select windows as my target, clean, qmake and build and run and up pops my Qt app on my windows box.
I switch the terget to the n900, clean, qmake, build, and run and the app appears on my n900

I'd hope the procedure for setting up QtC to work this way is the same on linux and windows, so if anyone has any questions as to how I set mine up.. just ask (though it was more or less following the wiki)

Patola
03-22-2010, 07:22 AM
This is a giant step backwards. Up to now we had the major environment for Maemo being Linux. Now we will be suggested to use Windows or Mac OS X because they're the "supported" environments? MADDE should PRIMARILY support Linux and secondarily support the other platforms, not the other way around.

kdrozd
03-22-2010, 07:57 AM
MADDE is now a TECHNOLOGY PREVIEW. It is not official supported way to develop for Maemo, only Scratchbox is.

And YES MADDE supports Linux (32/64 bit versions), take a look on first list on http://wiki.maemo.org/MADDE .

Integration of QT Creator and MADDE is still not official - you need to use Qt Creator version >=1.3.80 witch is not stable release. 1.3.81 ~~ 2.0.0 alpha :P This only way to give something to developers working on Win and Mac, they don't have native support for Scratchbox. I think MADDE+Qt Creator will be better way to develop apps for Qt mobile platforms on all supported host platforms, after PR1.2 :P

You can try to install latest QtCreator (from QT ftp) and MADDE and make them work together. It will have the same support, same stability as on Win and Mac.

Patola
03-22-2010, 08:20 AM
But how about the QT Integration for Linux? There is no integration? Why there are no instruction there?

I expressed myself in a wrong way - the problem is not the lack of support for linux, or not working. Is it being "half-baked", that is, one level beyond Windows and Mac OS X in terms of support.

danielwilms
03-22-2010, 08:27 AM
Hi,

But how about the QT Integration for Linux? There is no integration? Why there are no instruction there?

I expressed myself in a wrong way - the problem is not the lack of support for linux, or not working. Is it being "half-baked", that is, one level beyond Windows and Mac OS X in terms of support.

we published the descriptions week by week. First Windows, then OS X, and Linux will follow. Unfortunately we are a bit delayed with the Linux instructions. Working on it, and you will get it latest tomorrow.

Daniel

bousch
03-22-2010, 08:56 AM
Madde with Qt Creator works just fine on Linux. Just follow the instructions for Mac.

You can easily run and deploy straight from Qt Creator to the N900

pbouda
03-22-2010, 09:48 AM
Yes, integration works, I used this snapshot of Qt Creator:

ftp://ftp.qt.nokia.com/qtcreator/snapshots/2010-03-08/qtcreator-linux-x86-opensource-1.3.81-201003082229-setup.bin

And followed the Mac instructions. I have a german tutorial here:

http://www.mobileqt.de/wiki/wie_man_unter_linux_madde_mit_dem_qt_creator_integ riert

Intergalactic Christ
03-22-2010, 03:32 PM
I never managed the integration as the devices option wasn't there. I'm assuming due to having the wrong version of creator.

using mad qmake/make/remote all work good enough for me though.

Thanks

luthepa1
03-22-2010, 04:36 PM
Dont I feel like an idiot now! I wish I thought of it sooner!

I read these posts last night and could not wait to see this morning. I installed the TechPreview this morning (v1.3.81 aka 2.0 alpha) and low and behold under Qt4 is the Maeomo device config option. ARgghhhh! I could slap myself.

Now I am happy. Thanks everyone.

choubbi
03-23-2010, 09:10 AM
Linux Qt development :

0/ learn how to use MADDE without Qt, just simple CLI programs.

1/ Install Qt Creator on your linux machine (package qtcreator on ubuntu), and run it

2/ in terminal, run the command : mad pscreate -t qt_simple program
You just have created a copy of the Qt example provided with MADDE.
"program" is now the name of your project. The folder "program" has been created and you can find the required files in it.

3/ in the folder "program", double click the file "qtprog.pro". Qt Creator should open.

4/ On the vertical menu on the left, click "edit". Left click on "qtprog" > Add New... > Qt Designer Form Class (bottom of the list), click Ok > in the list, select "Main Window", click Next > click Next > click Finish.

5/ Open program/src/qtmain.cpp, and :
remove the lines :
-QPushButton hello("Hello world!");
-hello.show();

add the lines :
+#include "mainwindow.h"
before "int main ..."
+MainWindow w;
+w.show();
before "return ..."

6/ in Qt Creator, double click on "mainwindow.ui", and in the up-right corner, remove all the items listed under "central widget" (normally, "menubar" and "statusbar", if there is also "maintoolbar", remove it too). Click on "MainWindow".
Now, in the down-right corner, look for "geometry", change the values to "Width" : 800 and "Height" : 400 (yes, 400, not 480). Look for "windowTitle", and change the text to what you want to see in the top bar on your N900.


7/ optional : if you want to have a personalised icon, and stuff, follow this guide :
http://wiki.maemo.org/MADDE/Packaging

8/ now you can learn how to use Qt Creator with platform-independant tutorials/guides (Qt Creator integrated tutorials and help/documentation was good enough for me).

9/ compilation and packaging is the same as CLI apps. In the "program" folder, run "madde qmake", "madde make", and the following. I didn't use Qt Creator buttons for build and run, I don't know if you can.

I hope this helps some people to get started.

I tried several times to start programming for my N900, but always lost hope. I finally made my first (simple) app 2 or 3 weeks ago, in one day.

cool links that helped me :
Qt:
http://wiki.maemo.org/MADDE/Qt_extended_example
http://wiki.maemo.org/MADDE/Qt_extended_example/Part1
MADDE:
http://wiki.maemo.org/MADDE/Device_runtime

I can give the sources of my application if anyone wants. It's just an app that has 2 combo boxes, and looks up in a table and displays the corresponding value.

davidmaxwaterman
03-23-2010, 02:39 PM
I'm trying MADDE with an existing application I'm working on.

When I try to build, it says :

QGeoPositionInfo: No such file or directory

and so on.

In scratchbox, I had to install the libqtm packages.

How can I do this with Madde?

EDIT:
I see that I need to copy the include files and libs into the project. OK, I hacked it to bits and it's working now - Qt4.6.2 and Mobility, nice :)

davidmaxwaterman
03-24-2010, 04:10 AM
EDIT:
I see that I need to copy the include files and libs into the project. OK, I hacked it to bits and it's working now - Qt4.6.2 and Mobility, nice :)

Actually, although it compiled and linked fine, and it even mostly runs fine, I don't think my hack worked. After a while, my code 'dies'. I've not looked into it deeply yet, but I suspect that it's due to an ABI difference or something to do with moc.

These are the hacks I made :


1. copied the mobility headers that the compiler complained about into a local 'include' directory and added 'INCLUDEPATH += include' in my .pro
2. copied the mobility libs that the linker complains about into a local 'lib' directory and added 'LIBS += lib'[1] to my .pro
3. copied /opt/qt4-maemo5/lib into a local qt4-maemo5/lib directory and added 'QMAKE_LIBDIR_QT = qt4-maemo5/lib' to my .pro.


If someone has some indication of what might be wrong with this that would cause a run-time crash (my app just stops, without any 'crash dialog', so I'm not convinced it's dumping core), I'd love to hear suggestions.

Thanks!

Max.

PS. Why doesn't this 'list' icon on this forum work? It's supposed to put numbers on them, but I have to put them in manually...annoying :(

[1] Actually, I noticed I added 'LIBS += lib/libQtLocation.so' rather than something like 'LIBS += -Llib', but it still seems to pick up the other libraries in their so I guess it's clever like that.

danielwilms
03-24-2010, 07:49 AM
[1] Actually, I noticed I added 'LIBS += lib/libQtLocation.so' rather than something like 'LIBS += -Llib', but it still seems to pick up the other libraries in their so I guess it's clever like that.

MADDE is not really meant to work with external libraries. But have you got the code compiled, right? Do you have the library installed on your device? If this is a compiler issue, try to set the full path to your library in the pro file. This might work.

Daniel

danielwilms
03-24-2010, 07:56 AM
Hi all,

instructions on how to combine QtCreator with MADDE using Linux are now available:

http://wiki.maemo.org/MADDE/QtCreator_integration_for_linux

Please let me know if something does not work as expected.

Daniel

Patola
03-24-2010, 08:14 AM
And followed the Mac instructions. I have a german tutorial here:

http://www.mobileqt.de/wiki/wie_man_unter_linux_madde_mit_dem_qt_creator_integ riert

I tried to follow the Mac instruction and I also used google translate to follow the german tutorial in english, but I always have this error when I try to 'rebuild' the debugging helper: "The QT version has no toolchain". But I installed QT Creator 1.3.82 revision 81c1f6e712 and MADDE 0.6.14 with all options and I was able to create a qthello using MADDE.

Is there some path I need to set, some variable, something? Couldn't find in the guide. That's why I think there should be a specific integration page for GNU/Linux.

This is the screenshot of my problem:

http://img146.imageshack.us/img146/5264/capturadetelaj.png

davidmaxwaterman
03-24-2010, 09:56 AM
MADDE is not really meant to work with external libraries.


What external libraries? The only libraries I'm using are Qt ones - they're just newer than the ones in Madde (and there are additional ones).

But have you got the code compiled, right?

Right, but I'm not convinced my method is valid. IINM, I'm compiling the source using Qt 4.5.2 qmake, moc and includes (as well as the QtMobility includes), and linking with the Qt 4.6.2 libs and QtMobility libraries.


Do you have the library installed on your device?


Only the Qt 4.6.2 and Mobility libs.


If this is a compiler issue, try to set the full path to your library in the pro file. This might work.l

Well, I will check more deeply when I get home, but I think this is basically the same as if I change a library in a way that breaks the ABI, and so binaries linking with it will run, but crash when they call a methods that's been changed.

Anyway, I'll see when I get home. Thanks.

Max.

danielwilms
03-24-2010, 10:38 AM
What external libraries? The only libraries I'm using are Qt ones - they're just newer than the ones in Madde (and there are additional ones).


With external libraries, I meant libraries, which are not part of the official rootstrap, no matter which ones.

Right, but I'm not convinced my method is valid. IINM, I'm compiling the source using Qt 4.5.2 qmake, moc and includes (as well as the QtMobility includes), and linking with the Qt 4.6.2 libs and QtMobility libraries.



Only the Qt 4.6.2 and Mobility libs.



Well, I will check more deeply when I get home, but I think this is basically the same as if I change a library in a way that breaks the ABI, and so binaries linking with it will run, but crash when they call a methods that's been changed.

Anyway, I'll see when I get home. Thanks.

Max.

Have you seen this post (http://labs.trolltech.com/blogs/2010/02/15/qt-462-for-maemo-5-released/)? There is as well MADDE mentioned, whith instructions on how to integrate 4.6 there.

Daniel

davidmaxwaterman
03-24-2010, 02:50 PM
With external libraries, I meant libraries, which are not part of the official rootstrap, no matter which ones.


OK, though that's quite a big restriction. I wonder when QtMobility will be part of the SDK at all...


Have you seen this post (http://labs.trolltech.com/blogs/2010/02/15/qt-462-for-maemo-5-released/)? There is as well MADDE mentioned, whith instructions on how to integrate 4.6 there.

Yes, those are the packages I'm using. They may have finished it, but it's still not in /usr or part of madde rootstrap, as far as I can see.

I'm not sure how I can get around this issue, so I'm moving back to scratchbox, perhaps only using mad for packaging. At least my directory structure is mad-ready :)

Thanks!

Max.

davidmaxwaterman
03-25-2010, 03:29 AM
I did have a quick play with downloading the maemo5 version of Qt 4.6.2 and seeing if that would compile inside Madde....but it borks really quickly.
Shouldn't that work? I'd guess it shouldn't need anything apart from the compiler toolchain in order to build.

jaem
06-01-2010, 12:35 AM
MADDE is not really meant to work with external libraries.
Do you mean this as in "it's not officially supported", "it's not our primary/initial concern" or "it won't work"?
I understand the purpose of Qt Mobility and Qt in general, in terms of portability, but Qt+extensions can't cover everything. Specifically, the work I'm doing at my university involves a couple of libraries developed independently by members of our team (this (http://vnsupport.sourceforge.net/), for one), and I'd be a bit concerned if the new SDK is designed in such a way that using those will be painful.

danielwilms
06-01-2010, 03:30 AM
Do you mean this as in "it's not officially supported", "it's not our primary/initial concern" or "it won't work"?
I understand the purpose of Qt Mobility and Qt in general, in terms of portability, but Qt+extensions can't cover everything. Specifically, the work I'm doing at my university involves a couple of libraries developed independently by members of our team (this (http://vnsupport.sourceforge.net/), for one), and I'd be a bit concerned if the new SDK is designed in such a way that using those will be painful.


It means it is possible but not officially supported. What you could do is cross-compile those libraries and then point in the *.pro file with the whole path to that libraries. This should work. Other possibilities are under discussion, mostly in public (http://talk.maemo.org/showthread.php?t=48536), and I hope we can give updates on this soon.

Daniel

andrewzro
07-27-2010, 11:47 AM
Hy guys. I need help answering a question.

First of all let me say what I want to do: I have a rootfs, a toolchain and a device (not a Nokia device). I want to configure MADDE to help me crosscompile for ARM and create QT apps that I can run on my device. So far so good, but what if my toolchain / rootfs is x86 based? Can I setup MADDE to help me create x86 based QT apps, that I will then run on my x86 device? As far as I could find there is no way specifying that the target you create with mad-admin has a certain arch. I've tried to do that and used a x86 rootfs and a x86 cross toolchain. The target got created ok. When I try "mad gcc --version" I get the correct one, but when I try "mad gcc -Wall test.c" for eg, I get complains cause some ARM options get passed to gcc. I guess it expects to find an ARM compiler and does not bother to check it out. Am I right?

Thanks

attila77
07-27-2010, 01:45 PM
Not sure I follow... If you have a X86 target, you don't need MADDE at all, just use the Qt SDK as you would on any other X86 device.

andrewzro
07-28-2010, 05:02 AM
Well, I kind of do. Let me try to explain.

The x86 rootfs I'm trying to compile for is not a standard one. Is a rootfs created for embedded devices with a certain Qt version and I want to create Qt apps that will run on a device powered by this rootfs. So, if I build it on my x86 machine I have no guarantee that it will work on the x86 target.

Does it make sense?
Thanks

attila77
07-28-2010, 05:14 AM
Still... Why not just add the Qt on that rootfs to the Qt versions in Qt Creator ? That way it would call the relevant qmake and include the corresponding headers...

andrewzro
07-28-2010, 07:26 AM
Yes I can do that but what about compiling the app. It should get compiled with the toolchain in the rootfs, not the one on my machine. I want to be able to cross-compile the app so I can use it on that rootfs.
Does it make sense?

Venemo
07-28-2010, 07:43 AM
Yes I can do that but what about compiling the app. It should get compiled with the toolchain in the rootfs, not the one on my machine. I want to be able to cross-compile the app so I can use it on that rootfs.
Does it make sense?

Yes, it does, and this is exactly what Attila was talking about in his last post.

attila77
07-28-2010, 01:15 PM
Yes I can do that but what about compiling the app. It should get compiled with the toolchain in the rootfs, not the one on my machine. I want to be able to cross-compile the app so I can use it on that rootfs.
Does it make sense?

I think you’re stretching the term cross-compile here. You’re still on a X86 linux platform, you can specify alternative compilers, libs or whatever you need in the .pro files or even QtCreator itself.

rontti
08-11-2010, 06:43 AM
Hy guys. I need help answering a question.

First of all let me say what I want to do: I have a rootfs, a toolchain and a device (not a Nokia device). I want to configure MADDE to help me crosscompile for ARM and create QT apps that I can run on my device. So far so good, but what if my toolchain / rootfs is x86 based? Can I setup MADDE to help me create x86 based QT apps, that I will then run on my x86 device? As far as I could find there is no way specifying that the target you create with mad-admin has a certain arch. I've tried to do that and used a x86 rootfs and a x86 cross toolchain. The target got created ok. When I try "mad gcc --version" I get the correct one, but when I try "mad gcc -Wall test.c" for eg, I get complains cause some ARM options get passed to gcc. I guess it expects to find an ARM compiler and does not bother to check it out. Am I right?

Thanks

Short answer is yes you can.
The real world is a little bit more complicated. I'll try to explain those details, but before that I answer your last question. MADDE should not expect ARM compiler. Did you replaced some of the ready made targets with your own?

There are two proper ways to to create a new target with MADDE.
You can create description of your target in madde.conf or you can create a target manually.

Manual way:


mad-admin create my_target -tc my_toolchain -sr my sysroot -qt my_qt

where
'my_target' is the name of your new target. Note that 'my_' prefix is needed, because the target is not configured via madde.conf
'my_toolchain' is the name of your gcc toolchain. It is expected that toolchain is zipped tarball and can be found from the cache/ directory under MADDE installation.
'my_sysroot' is the name of your sysroot. It is expected that sysroot is zipped tarball and can be found from the cache/ directory under MADDE installation.
'my_qt' is the name of your qt tools (qmake, uic, moc, etc..). It is expected that qt tools is zipped tarball and can be found from the cache/ directory under MADDE installation. Note that these tools need to be compatible with Qt version installed in sysroot.
Note that older qt-tools versions (< 4.5) were patched by me to work with MADDE in Windows and Mac. Actually qmake was patched to produce unix style Makefiles in Windows and Mac.

If the target is configured via madde.conf you should see your target by 'mad list' command. Then you just create your target by givining command, expecting that target name is 'newtarget'

mad-admin create newtarget


Please check madde.conf from the cache/ directory under MADDE installation. It shouldn't be very complicated.

Note that all pieces of the target should be found from cache/ directory.