maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   Qt5 development on Harmattan (https://talk.maemo.org/showthread.php?t=85028)

ajalkane 2012-06-21 22:06

Qt5 development on Harmattan
 
EDIT: Forget all about this below. Better solution is to use community repos which is under work

I'm starting this topic now, like I threatened.

Personally I'd like to keep my current workflow, using QtCreator, instead of scratchbox. Here's a great resource for setting up qt5 development for QtCreator:

http://trac.webkit.org/wiki/SettingU...vironmentForN9

Big thanks from me to the WebKit folks for this work - figuring out all that stuff by myself would have not been possible with the time I have.

Here's my notes using this guide, hopefully it will save some time from others tackling this (for reference I'm developing on Ubuntu 10.04, some details might differ depending on your OS of choice):

In my notes I'm going to use the following variables as shortcuts:
$QTSDK = Path to QtSDK installation directory
$QT5SETUP = Path to the directory where you set-up Qt5 (in the web-page it's ~/sfworks)

1.1) Prepare your environment - I could without problem use another directory than the ~/swork directory mentioned in the guide. The scripts included seem to be pretty smart in that regard.

1.4) Set up custom MADDE target. This didn't initially work for me, even as by documentation QtSDK installation is supposed to set it up. But if you set QTSDK environment variable to point to your QtSDK installation directory, then there is no problems. Example
Code:

export QTSDK=/home/users/ajalkane/QtSDK
1.8) Build sources. Two problems:
- In the web-page there is a comment "Qt5 r26 and later versions messing up some include path". This is still a valid, you need to do the symbolic link. If you use some other path than the default ~/sfworks you need to adjust the link accordingly. Analyzing the include paths in the build errors will quite easily give you idea what kind of symbolic link to create.
- I got weird errors about missing headers. It seems that downloading some of the sources can fail, and it does not give any errors so it's easy to miss among all the output. If that happens run again 1.6) to get again the sources :
Code:

browser-scripts/clone-sources.sh --no-ssh
And then re-build.

Now you should have Qt5 target usable in QtCreator. To add it to your project, go to:
Settings -> Build & Run -> Qt Versions. Add new qmake location
Add there $QT5SETUP/qt5/qtbase/bin/qmake (of course replacing $QT5SETUP with the directory you downloaded the scripts into).

With these instructions I was able to compile a simple hello world application. Does not tell much of course... But since I've not received my device yet, I'm trying to resist the urge to mess-up with my day-to-day device. I might fail during the weekend, though the abortion of the next billion somewhat helps restricting my geek urges.

Some final notes:
I think the scripts are the minimal that's needed for webkit. Some qt5 modules are not compiled. If you need some other modules for qt5, go to $QT5SETUP/qt5 and use the "init-repository" script to add more modules. No practical examples from me yet, as I'm in the hello world stage.

I hope other people post here their own experiences, especially stuff that got them stuck for a while. No matter how trivial it might seem when looking back, it can substantially reduce the time each of us use on getting things rolling.

Personally I'd like to see some experiences and practical instructions how to create qmake scripts that can automatically use Qt5 on device if it was installed. And also how to automatically transform the qml's to use QtQuick 2 - Qt Components QtQuick2 branch does something like that, but I haven't had time to dig into how similar technique could easiest be applied on QtCreator based project.

mikecomputing 2012-06-21 22:23

Re: Qt5 development on Harmattan
 
how bout add this to the wiki instead ? :)

ajalkane 2012-06-21 22:34

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by mikecomputing (Post 1225482)
how bout add this to the wiki instead ? :)

Maybe after I have the full stack working, from QtCreator to the device ;). But, this wiki is for webkit. So some stuff must reside elsewhere, such as setting up more qt5 modules than are needed by webkit.

timoph 2012-06-22 04:51

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by ajalkane (Post 1225487)
Maybe after I have the full stack working, from QtCreator to the device ;). But, this wiki is for webkit. So some stuff must reside elsewhere, such as setting up more qt5 modules than are needed by webkit.

How about simply improving http://qt-project.org/wiki/Qt-5-on-Nokia-N9 with the info you've collected.

qgil 2012-06-22 05:09

Re: Qt5 development on Harmattan
 
Another source that might be useful is http://qt-project.org/wiki/Create (setting app SDK for QtonPI)

The path needs to be tamed by actual app developers, yes. Any help improving the documentation is welcomed. Thanks for the notes!

ajalkane 2012-06-22 06:53

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by timoph (Post 1225539)
How about simply improving http://qt-project.org/wiki/Qt-5-on-Nokia-N9 with the info you've collected.

That one seems to most fitting page to put stuff into, once best way to do this has been figured out.

The QtonPi page seems like a good one for some ideas too.

ajalkane 2012-06-24 14:42

Re: Qt5 development on Harmattan
 
I have put up a simple Qt project to github/harmattan that is probably the easiest way to show the changes needed to a project to get it compiling both on qt4 and qt5:

https://github.com/harmattan/helloqt5

It's based on the QtQuick project template created by QtCreator. The only thing missing is that *.qml files imports have to be modified manually when you switch between versions.

I'm running out of time so I'll be progressing more slowly from now on. Probably I'll start doing stuff on this again when device arrives.

ajalkane 2012-07-04 05:23

Re: Qt5 development on Harmattan
 
I had time to do some more on this.

For putting the Qt5 libraries on device I didn't want to use the instructions on the URL in the first post, as the script does all kinds of stuff to the device I don't want. But all went well using this:

http://qt-project.org/wiki/Qt-5-on-Nokia-N9

Basically I did:
Code:

mkdir /home/developer/qt5build && cd /home/developer/qt5build
wget http://snowshoe.qtlabs.org.br/apt/snowshoe-repositories.deb
devel-su
dpkg -i /home/developer/qt5build/snowshoe-repositories.deb
apt-get update
apt-get install "qt5-*"

Now the bad news is that I could not get QtCreator to create debian packages using the new target. The basic problem is that the Qt5 target is recognized as Desktop target. You can compile your Harmattan executables using it, but you won't have the normal Debian building targets with it.

I tried to remedy it with all kinds of nasty stuff, like modifying QtCreator/share/qtcreator/Nokia/qtversion.xml. That didn't work as then QtCreator complained it was wrong Qt version. Apparently it requires Qt4. I also tried some beta version of QtCreator 2.5.0, but didn't have any luck with that one either.

I will personally wait now a bit if the next QtSDK/QtCreator would have Qt5 support for Maemo targets. If that doesn't happen soonish, I will look into using scratchbox (something I've tried to avoid, but apparently can't :)). But if anyone gets QtSDK to build Qt5 harmattan debs, please share.

stuartmarsden 2012-07-30 18:21

Re: Qt5 development on Harmattan
 
I have been trying to get my Qt5 environment up for my N9 following the instructions above from ajalkane and the link. Thanks ajalkane as I would not have got far without these.

I have not got there yet but thought I would document some of the problems I had.

When making the custom MADDE environment using

Code:

browser-scripts/setup-madde-toolchain.sh
It had seemed to complete successfully but Qt5 went on to not compile (stopped when it got to SQL plugins). It turns out that the setup script had been trying to use curl to download and install dependencies. I did not have curl installed so it failed but the script did not stop and it is only when I ran it again and looked closely at the output that I spotted it.

A quick
Code:

apt-get install curl
later and the script was obviously trying to now download but was failing. The reason was my QtSDK is installed in /opt/QtSDK not my home directory. I therefore had to run the script as root to let it install into the right place.

Having fixed this I have succeeded in building Qt5. I have tried then using this from within QtCreator by trying the helloqt5 example from ajalkane.

The first issue was it did not like
Code:

QT += declaritive
which was in the .pri file. I changed this to
Code:

QT += quick1
and it stopped complaining.

I have not got much further as when I try to compile I get this error
Code:

make: arm-linux-gnueabi-g++: Command not found
It is trying to cross compile in a different way from a normal MADDE target and not working. This could be because it shows up as a desktop target when you add the version.

Anyone know how to get passed this?

stuartmarsden 2012-07-30 18:45

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by stuartmarsden (Post 1245049)
Anyone know how to get passed this?

I figured this bit out. I needed to ensure that the location of arm-linux-gnueabi-g++ was added to my PATH in the build environment.

In my case

Code:

/opt/QtSDK/Madde/targets/harmattan_10.2011.34-1_rt1.2_qt5/bin/
It seems to have now compiled the next step is to get it onto my N9 and see if it runs.

stuartmarsden 2012-07-30 19:18

Re: Qt5 development on Harmattan
 
Was able to transfer the qml directory and executable to my device. Just copied them there as have not figured howto package yet.

The initial attempt at running failed. It could not find the qt5 libraries. These have not been added to the ld cache when the qt5 packages were installed.

I got around this with

Code:

export LD_LIBRARY_PATH=/opt/qt5/lib/
The program then ran but just a blank screen and status bar. It cannot find the meego components for QML.

Code:

file:///opt/helloqt5/qml/helloqt5/main.qml:2:1: module "com.nokia.meego" is not installed
    import com.nokia.meego 1.1
    ^

This is probably the same issue with the libraries and I will have to point it at the qt5 QML MODULES.

Do not know how yet but I am sure google will help.

ajalkane 2012-07-30 19:41

Re: Qt5 development on Harmattan
 
Thanks for the input and posts about progress. What's related to the helloqt5 project I'll try to fix when I have time to get into this again (in few weeks, I think). The best approach, I think, is to create a wrapper shell script for Qt5 builds that sets the LD_LIBRARY_PATH. Please let us know if you figure out what needs to be changed to get QML imports working.

And I'm not anymore as pessimistic about getting QtCreator to work with this - it won't be as easy as with Qt4, but I hope building debs at least can be made straightforward. I'll report on this when I get around to it again.

stuartmarsden 2012-07-30 20:09

Re: Qt5 development on Harmattan
 
I have tried pointing the imports to the right place:

Code:

export  QML_IMPORT_PATH=/opt/qt5/imports
This still does not work but at least I get a different error.

Code:

file:///opt/helloqt5/qml/helloqt5/main.qml:2:1: plugin cannot be loaded for module "com.nokia.meego": Unknown error
    import com.nokia.meego 1.1

So seems to find it but not like it. I wonder if they have a different version number for the qt5 components? How do I find out?

I may try also QtQuick 2 see if that changes anything.

ajalkane 2012-07-30 22:27

Re: Qt5 development on Harmattan
 
Stuart:

there are a couple of things at play here. Now don't take this as the absolute truth, as I might remember wrongly where I left off, but only as some hopefully helpful pointers...

Basically helloqt5 project should compile when compiled against Qt5. But the QML files are not okay for running under Qt5. Right now they import QtQuick 1.1 (on Qt5 should be 2.0) and com.nokia.meego 1.0 (on Qt5 should be 2.0). The plan is to do similarly as in qt-components project, so that when building against Qt5 the resulting imports are replaced. But it's not done yet, so it must be done manually. This is written in the projects' README but is easy to miss.

Also notice that I've made some mistakes in the commits to helloqt5, the version numbers in imports in main.qml are wrong and should be as in MainPage.qml.

So, when you've transferred the QML files to device, replace the versions in the QML imports to 2.0 and you might get a bit farther.

ajalkane 2012-08-12 04:34

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by stuartmarsden (Post 1245066)
Code:

file:///opt/helloqt5/qml/helloqt5/main.qml:2:1: module "com.nokia.meego" is not installed
    import com.nokia.meego 1.1
    ^

This is probably the same issue with the libraries and I will have to point it at the qt5 QML MODULES.

Do not know how yet but I am sure google will help.

You can point to the import directories like this:

Code:

QML_IMPORT_PATH=/opt/qt5/imports
And remember to replace the versions to:

Code:

import QtQuick 2.0
import com.nokia.meego 2.0


Arie 2012-08-12 05:28

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by ajalkane (Post 1250720)
You can point to the import directories like this:

Code:

QML_IMPORT_PATH=/opt/qt5/imports
And remember to replace the versions to:

Code:

import QtQuick 2.0
import com.nokia.meego 2.0


That's why it wasnt working.... thank you

ajalkane 2012-08-13 12:39

Re: Qt5 development on Harmattan
 
After some changes and updates, I'm trying to run the helloqt5 on device. But I get this:

Code:

QMetaProperty::read: Unable to handle unregistered datatype 'QDeclarativeComponent*' for property 'MDeclarativeInputContext::customSoftwareInputPanelComponent'
Segmentation fault

Anyone else get it and any idea how to fix it?

On somewhat related note, I could not get LD_LIBRARY_PATH to work when running as user. I had to run in devel-su so that it would work. This seems strange.

ajalkane 2012-08-22 23:04

Re: Qt5 development on Harmattan
 
I went the scratchbox route. I'm too tired to write any details.

But it seems qt-components (even the QtQuick 2 branch) needs modifying before it can work on Qt5. The plugin loading has been changed, so relating to harmattan development at least the meego subdirectories plugins have to be modified like this:

http://qt.gitorious.org/qt/qtbase/co...25ac404e303c5d

Writing this here if someone wants to take the ball and run with it ;).

ajalkane 2012-08-31 12:45

Re: Qt5 development on Harmattan
 
I advice everyone to not use the currently packaged qt5 libraries (from webkit or snowshoe). Each of them has their own problems, and they're old snapshots.

Laszlo Papp is currently packaging the newest beta for Harmattan into the community repository. This will give us much better and easier way to go forward with Qt5 development on Harmattan.

See here his blog for details:

http://lpapp.blogspot.ie/2012/08/qt5...harmattan.html

EDIT: Things like Laszlo is doing here is helping everyone using, and developing for, Harmattan. If you have the skills to do some debian packaging work, please consider contributing to the community repository.

ajalkane 2012-09-03 14:59

Re: Qt5 development on Harmattan
 
Good news, now the rest of the qt5 modules are available!

Next stop is fixing qt-components.

Code:


[sbox-HARMATTAN_ARMEL: ~] > apt-cache search qt5
qt5-3d - Qt 3D module
qt5-base - Qt Base modules.
qt5-declarative - Qt Declarative module
qt5-jsbackend - Qt V8 Javascript Backend module
qt5-location - Qt Location module
qt5-multimedia - Qt Multimedia module
qt5-script - Qt Script module
qt5-sensors - Qt Sensors module
qt5-xmlpatterns - Qt XML Patterns module

Thanks Laszlo!

ajalkane 2012-09-05 07:54

Re: Qt5 development on Harmattan
 
Rejoice, qt-components have been now ported also. I haven't had time yet to test them, but will soon.

More details in Laszlo's blog here:

http://lpapp.blogspot.ie/2012/09/qtq...harmattan.html

ajalkane 2012-09-05 19:53

Re: Qt5 development on Harmattan
 
I have now tested and it works with my helloqt5 project!

I will try soon to clean-up and update my helloqt5 project with the changes necessary, but now qt5 development in harmattan is MUCH easier than before. Post here if you have questions.

ajalkane 2012-09-10 22:15

Re: Qt5 development on Harmattan
 
I have now made the minimal changes to get helloqt5 to work with qt5 on harmattan. You can use this project to get started on converting your project for qt5:

https://github.com/harmattan/helloqt5

See README.md for detailed instructions.

The short version is:

- Install scratchbox
- Install community repositories to scratchbox
- apt-get update and Install qt5-* libraries to scratchbox
- qmake && dpkg-buildpackage in helloqt5 directory
- copy the debian installation file to device
- Install community repositories to device
- apt-get update and Install qt5-* libraries to device
- dpkg -i helloqt5*.deb to device
- Run like this: QML_IMPORT_PATH=/opt/qt5/imports LD_LIBRARY_PATH=/opt/qt5/lib /opt/helloqt5/bin/helloqt5

bibek 2012-12-23 13:53

Re: Qt5 development on Harmattan
 
Is it possible to share the .deb file of ur helloqt5 project? Wud have liked to run on device and get some inspiration before setting up all the tricky dev environments :)

Thanks for ur effort and infos.

amr.fayz 2012-12-23 15:36

Re: Qt5 development on Harmattan
 
Thank you for your efforts

Is there hope to work on Fremantle ??
I hope to be yes :)

coderus 2013-02-20 20:03

Re: Qt5 development on Harmattan
 
any new prebuilt qt5 libraries? openbossa dated 25 Jul. Isn't it too old?

bibek 2013-02-22 15:48

Quote:

Originally Posted by coderus (Post 1324149)
any new prebuilt qt5 libraries? openbossa dated 25 Jul. Isn't it too old?

I got BETA1. Is that same?

getvasanth 2013-04-23 15:56

Re: Qt5 development on Harmattan
 
Is anyone working on QtCreator to deploy Qt5 app on the Device (N9).
instead of having the scratch box.

Edit: I need some pointers, From where I have to start. Hope Interested people can join or, I can join them.

ajalkane 2013-04-23 16:34

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by bibek (Post 1307064)
Is it possible to share the .deb file of ur helloqt5 project? Wud have liked to run on device and get some inspiration before setting up all the tricky dev environments :)

Thanks for ur effort and infos.

I'm sorry, I've for some reason totally missed the posts on this topic.

In short, the work I did was based on various alpha/beta releases of Qt5. Now that the real release has been done, only basing on that makes sense.

So whatever's posted on here may be wildly outdated. It might be of some help in bringing the final release of Qt5 to N9, or it might just be distraction.

Kozzi 2013-04-27 08:39

Re: Qt5 development on Harmattan
 
bump!

Also would like to know answer to getvasanth question.

getvasanth 2013-05-13 18:36

Re: Qt5 development on Harmattan
 
Thanks for the reply "ajalkane". would like to provide some more help in this to take this forward.

ajalkane 2013-05-14 17:17

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by getvasanth (Post 1338229)
Is anyone working on QtCreator to deploy Qt5 app on the Device (N9).
instead of having the scratch box.

Edit: I need some pointers, From where I have to start. Hope Interested people can join or, I can join them.

I think I have commented on this in this thread already.

But a little recap: to get deploying working inside QtCreator that ships with Harmattan's SDK, you would need to create a custom plugin for QtCreator that can handle Qt5. Later QtCreator versions might have some more robust options to make this happen without creating a custom plugin, but I have not looked into it.

sviox 2013-05-24 06:29

Re: Qt5 development on Harmattan
 
Haven't actually tried Qt5 yet but wanted to ask a couple of things out of interest.
1. After installing Qt5 on scratchbox SDK environment, how do you select which version (4/5) to compile against? Using inline exports for each command aimed for Qt5? Care to give a couple of command line examples on building same app on Qt4 and Qt5.
2. Can Qt5 apps be tested locally on x86 build using Xephyr?
3. Can you use libmeegotouch with Qt5? I suppose it's built against Qt4.

ajalkane 2013-05-24 07:21

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by sviox (Post 1346444)
Haven't actually tried Qt5 yet but wanted to ask a couple of things out of interest.
1. After installing Qt5 on scratchbox SDK environment, how do you select which version (4/5) to compile against? Using inline exports for each command aimed for Qt5? Care to give a couple of command line examples on building same app on Qt4 and Qt5.

To compile with Qt5 you just make sure Qt5's qmake is used, for example put it to PATH as first:

export PATH=/opt/qt5/bin:$PATH

Then compile as usual.

I have some instructions in README in:
https://github.com/harmattan/helloqt5

Though on first look some of it may be a bit off (I can't test now), but should help getting started. The biggest issue is of course that I wouldn't recommend using the community repos as the Qt5 version there is out-of-date (some beta version of Qt5).

Quote:

2. Can Qt5 apps be tested locally on x86 build using Xephyr?
3. Can you use libmeegotouch with Qt5? I suppose it's built against Qt4.
I haven't tried these. I'd imagine Xephyr works with the usual caveat of running the application so that it's instructed to use Qt5. I'd expect problems with libmeegotouch as Qt5 is not binary compatible with Qt4.

sviox 2013-05-27 10:19

Re: Qt5 development on Harmattan
 
Quote:

Originally Posted by ajalkane (Post 1346453)
I haven't tried these. I'd imagine Xephyr works with the usual caveat of running the application so that it's instructed to use Qt5. I'd expect problems with libmeegotouch as Qt5 is not binary compatible with Qt4.

So basically, this means that you need to create your own look and feel for the app using Qt5 basic controls via QML.

Is it possible to statically link the Qt modules (QtWebkit included) to the app so that it can be delivered in Nokia Store?

Also, does the Mobility APIs work in Qt5?


All times are GMT. The time now is 10:21.

vBulletin® Version 3.8.8