Nokia N9 and MeeGo Harmattan are here. These are good times to be a Qt developer. And if you are like me, you downloaded the Qt SDK 1.1.2 from Nokia that contains the experimental Harmattan target for Qt Creator. However, not sure about you, but I never got the QEMU to work which I though would be a part of the Qt SDK 1.1.2. Whenever I launch a Qt application with the Harmattan as the selected target, I get an error saying that QEMU was not running, so I assume it's not included or Qt Creator cannot find it. Or then I just don't understand how to set it up in Qt Creator... There's even a page at developer.nokia.com that explains how to use and install the QEMU on a Linux Debian based machine, but the download link to QEMU is broken (25.6.2011). Also it seems that it's a bit open what the deal with QEMU on Windows or OS X based machine are... I haven't seen similar pages for downloading QEMU for other than Linux. So at this point I am not sure if and how the QEMU should work together with Qt Creator. I forgot about the QEMU option then.
Update: Ok, I got QEMU running in Linux. It seems there is one step missing in the default Qt SDK 1.1.2 installation. What you need to do is manually select "MeeGo 1.2 Harmattan API" as the Qt version to build with, even if you selected the Harmattan target (there is also a "Harmattan Platform API" Qt version available to use - not sure what that is...).
To use QEMU with Qt SDK 1.1.2, go to “Projects > Harmattan > Build > Edit build configuration” and click “Add”. Select “Using Qt Version MeeGo 1.2 Harmattan API (Qt SDK)”. This was in the comments of Qt Labs blog post - I hope Nokia can address this issue soon. I only tested this in Linux. But QEMU is SLOOOOOOW. If you are using Linux, I think you are better off sticking with Scratchbox.
Scratchbox as a Harmattan development environment
Scratchbox is a sandboxed cross-compiling environment that Nokia has been using for Maemo development ever since the first Maemo device, the Nokia 770. It has also been used in Harmattan development so it is no surprise that Nokia also has instructions for setting up Scratchbox for Harmattan development. But this seems like a totally different developer story from the Qt SDK one. I also don't see how Scratchbox is going to work on anything else but Linux based machines (and preferably Debian based ones). I hope someone from Nokia could clarify this a bit.
In any case, it is not a problem to get started with Scratchbox that includes all the necessary developer packages for Harmattan. Nokia has made a great small Python based utility that will install the complete Harmattan environment for you (how I wish we had this when I worked with Harmattan... ;)). The instructions are on developer.nokia.com - links below:
- Install and setup Scratchbox.
- How to use Scratchbox and launch the Harmattan UI. NOTE: The installer will add your user to the group sbox and you need to logout and login once before you can start using Scratchbox.
After step 2. you are ready to start developing your application. If you launch your application inside Scratchbox, it is just like it would be started on the target device. The environment is actually pretty good.
Developing Harmattan apps with the Scratchbox environment
Getting started with Scratchbox can take some time and it's definitely not the integrated development experience Qt SDK tries to provide. So no surprise that I don't like Scratchbox as a development environment, and it is not even meant to be one necessarily. After all it's a cross compilation environment. But you can quite easily install Qt Creator inside Scratchbox if you like and debug your application as it is running inside the Scratchbox environment (remember, Scratchbox is just a sandboxed Debian).
Instead, I would do the development outside Scratchbox in my Qt Creator and then I would test the application in Harmattan UI, cross compile the source and build ARM-packages inside Scratchbox. To do this, you need to have a folder and its content visible both inside and outside Scratchbox (and open and edit the files outside Scratchbox in your Qt Creator). This can be easily done with mount --bind.
This is how I created a folder ~/src/harmattan outside Scratchbox, that will contain my Harmattan source code, and the same folder and content will be visible as a folder ~/src inside my Scratchbox.
kypeli@Cute:~/src$ mkdir harmattan
kypeli@Cute:~/src$ mkdir /scratchbox/users/kypeli/home/kypeli/src
kypeli@Cute:~/src$ sudo mount --bind harmattan /scratchbox/users/kypeli/home/kypeli/src
kypeli@Cute:~/src/harmattan$ echo "Foobar" > foo
[sbox-HARMATTAN_X86: ~/src] > cat foo
[sbox-HARMATTAN_X86: ~/src] >
Now you can work easily on the same piece of code both inside and outside the chrooted Scratchbox environment. To have this binding in place also after reboots, put this line in your /etc/fstab (with your folders :)):
/home/kypeli/src/harmattan /scratchbox/users/kypeli/home/kypeli/src none rw,bind 0 0