Sunday, February 10, 2013

Geek'ish application development for Blackberry 10

Hi there again,


As indicated in my previous post, I am now about to summarize my developer experience for the platform Blackberry 10. As written before, the regular way of developing applications for this platform is to use the Momentics IDE or QtCreator.

Those environment usually generate the necessary qmake build system files, bar files for you to a certain extent I guess. Admittedly, I have never used them for this purpose, so this is just a gut feeling. Anyway, this is not so important for the scope of this post.


Goal



When I had started to develop my first application, I made some research if it had ben possible to develop applications the way I like: command line and cmake. For those of you, who are not familiar with cmake, it is a nice cross-platform Makefile generator thoroughly used in many projects. One open source reference is KDE for this.

Interestingly enough, I got some messages in private after my cmake based projects that people found those files and used in a similar fashion one by one. This is nice, but some explanation is necessary for newcomers. So, let us dig into more details about this.


CMake Toolchain file



In order to make cross-platform development with cmake, usually one has to produce a correct toolchain file. I looked around on the internet, and there was some examples available for QNX. I took one of those essentially to start off with. That is also one reason why it is a bit bloated, and a much simpler would be enough for achieving what we wish to.

If you are not interested in the underlying operation, you can skip the explanation below, and you can just use my toolchain file right away.

The important changes I made were the followings:


  • Use the proper toolchain binary

Use the 'qcc' build wrapper. It is essentially a wrapper around the compiler, linker, and so forth. You can find more complete documentation about it here.

This is a very important change because I started with the "ntoarmv7-g++" which is a link to the "arm-unknown-nto-qnx8.0.0eabi-g++-4.6.3" toolchain file. I also tried the latter directly, but I encountered crash for my applications even for a very simple test case without cmake. The program crashed even before entering the main function. It took me two nights at least to track the problem down.


  • Use the proper toolchain binary flags

Once I figured out I would have to use 'qcc', there were still some problems that I encountered, albeit slightly different. I had to realize the usage of certain flags is necessary. Once I made it work with the proper flags without any build system, I had to figure out the proper way of setting that for the toolchain file. Now, we have all the information necessary so here it goes the statement:

    -> SET(CMAKE_CXX_COMPILER_ARG1 "-Vgcc_ntoarmv7le -lang-c++)
  • Instruct cmake to use the toolchain file created

     -> -DCMAKE_TOOLCHAIN_FILE=/path/to/the/toolchain/file.cmake


  • The location of the toolchain file
 This is only my personal opinion, but I found it simpler to put the toolchain file into the project because then I did not have to carry that on to other machines I worked on. It is also simpler to ask other non-cmake developers to test my application if I pass a command to them. It is not a huge file, so it probably does not take up much space in the repository either. It does not clutter the project that much either in my opinion.


So this is the entire command I use from the build folder:

    ->  cmake -DCMAKE_TOOLCHAIN_FILE="../frontends/blackberry/cmake/Toolchain-QNX-8.0.0.cmake" .. && make VERBOSE =1


Find modules for Cascades libraries


This is also a very important step to find the Cascades libraries for your application. This was not a big deal, albeit I have not had time to solve this issue nicely either. So, there are rooms for improvements. :)


I have created separate cmake find modules for each library for the time being, but perhaps it should be handled more like Qt4 with a joint find module, and one can request anything out of that. So, there would be a macro with a few parameters. It would not be then necessary to copy and paste the code. If you are not up to that contribution, you probably better go with the files I created. You can find them below.






Deploying the application to the device



I wrote a primitive python script for this after gathering all the information what flags to use. Here you can the result. This one is more or less just a hint as it cannot be used that directly. I chose python because then I can also use this on Windows and elsewhere as python is a nice cross-platform scripting language.

Essentially, there are several tools that have to be used for installing and then launching the application on the device from your host system:

  • Set up the Blackberry NDK environment

I personally made an alias for this, but here you can find the comment:

        -> source /opt/bbndk/bbndk-env.sh

  • blackberry-connect
I have not tried to develop over Wi-Fi because I use mobile internet, so that was not an option. I also prefer the usb link as it is faster and more reliable. I made aliases for these, too. You have to supply a proper public ssh file. I think the default length is not proper, but a new one can be generated easily. Here you can find the command for setting this all up:

        -> ifconfig usb0 169.254.0.2

        -> blackberry-connect 169.254.0.1 -password devicepassword -sshPublicKey ~/.ssh/id_rsa_rim.pub

  • blackberry-nativepackager 

Here you can find an example how to use it: 

        -> blackberry-nativepackager -package -target bar test.bar /path/to/the/bar/descriptor/xml/file.xml -devMode

  • blackberry-deploy
Here you can find an example how to use it:

        -> blackberry-deploy -installApp -device 169.254.0.1 -launchApp -password devicepassword -package test.bar



Debugging from command line



A simple ssh connection can be used for logging into the device once the development mode is switched on in the settings. It has to be done after each boot as of now on my devalpha, at least. Make sure the connection is established properly and the blackberry-connect process is still up. Here you can find the command for that:

    -> ssh -i ~/.ssh/id_rsa_rim devuser@169.254.0.1

Once this is done, there are some tricks to get information about QML syntax issues, C++ crashes, reading your intended log file, and so forth:

    -> slog2info -w 

    or/and


    -> cd /accounts/1000/appdata/${id_from_the_bar_descriptor_file}/logs && cat log

You can also get the screenshots created on the device by pressing the two volume buttons simultaneously:


    -> scp -i ~/.ssh/id_rsa_rim devuser@169.254.0.1:/accounts/1000/shared/camera/IMG_*.png /path/to/the/directory/to/store/the/screenhots



 

Application signing for AppWorld


Here you can find the command I used:


    -> blackberry-nativepackager -package -target bar test.bar /path/to/the/bar/descriptor/file.xml -sign -cskpass devicepassword -buildId 1


Note: Do not forget that you have to increase the -buildId value for each new signing.

 

 

Testing someone else's application


This is also a common request that someone would like to get feedback about the application before even getting approved in the AppWorld. In such cases, you may request your friends and acquaintances to test it. This could also happen vice versa so that you are asked for testing an application and provide feedback. Hence, it is useful to know how you can do that. Here is the command I used.


        -> blackberry-deploy -installApp -device 169.254.0.1 -launchApp -password devicepassword -package test.bar



Conclusion


Like many things in the life, this is also possible. I do not find any issues with this workflow for application development, but I am a bit strange developer. I am glad to have found the way I like spending my time. Many thanks go to Bill Hoffman from Kitware for patiently helping me with cmake issues on the cmake mailing list.


Hope, it helps some people out there.


Happy Blackberry 10 hacking! :-)

New applications for Blackberry 10

Hi everyone,


Introduction

I have been planning this post for a while, but I had some real life troubles and also other duties. Finally, I have some time to write this down briefly!

In short, I have created two new applications for Blackberry 10. I tested them on my DevAlpha device. The first one became the candidate for getting a Limited Edition device in the end.


Wiki Reader

As I have been a wikipedia fan for a while, I thought this would be a good idea to help myself and others to have an application for reading wikipedia pages easily. There was an application on Harmattan (N9) called "Cutewiki" available in Ovi Store. I had been using that a lot because I think it is a great application. As the author did not plan to port that to Blackberry 10, I wrote one for myself.

The source code is available under the KDE umbrella. The application was approved in AppWorld, but here you can find some screenshots embedded as well:




Searching for articles

Reading articles


Mrdanga Player

I had been playing bass guitar for many years during my student years, and I have been a fan of mrdanga recently. There was an application for Harmattan (N9) called "Finger Drums". I felt in love with that application after the first checkout. It is an awesome piece of software with lots of fun!

This drove me to write an application for Blackberry 10 to enable people to get to know what mrdanga is and how it sounds. It is a lot simpler emulation than a whole drum kit. I think it is still nice for those who like this instrument, and potential newcomers that can get to know it this way. There is also a nice video on youtube if you would like to check out what the masters can do with this instrument. :)

The source code is available under the KDE umbrella. The migration is now ongoing to Playground/Mobile where the wiki-reader also resides.

The application was submitted to AppWorld, and it is in review stage. For those who would like to try out the latest version, I uploaded the package to my dropbox. I would also like to share some screenshots here.

Splash screen


Mrdanga heads with darker background

Mrdanga heads with brighter background



Kudos

Many thanks go to RIM for providing DevAlpha and Limited Edition devices to the community!

For sure, many thanks go to the KDE Project as well for providing the source code repository, bugtracker, and the whole KDE infrastructure for this!

There will be a follow up post soon about developing Blackberry 10 applications from command line with cmake. Stay tuned!




Sunday, January 20, 2013

Qt5 packages for Archlinux

Hi all,

I had built modularized Qt5 packages (except qtdocs and qtwebkit) for Archlinux x86_64 a few days ago, but unfortunately I did not have time to write even a short blog post for the time. Here you can find the packages:

https://www.dropbox.com/sh/gfn3bm9jno9c9ev/L8rCozTWtF

There are python3 issues with WebKit for now, so it is not included. I had submitted a patch, but I have not yet had time to continue the investigation. As it turns out the issue is more complex than previously thought.

Nevertheless, It should be fixable by using python2 if someone is interested in that.

I will try to keep it up to date once 5.0.1 is out. Hope, it helps.

Saturday, October 6, 2012

Randa: KDE Edu installer for Windows

Some of you may question why I was working on the Rekonq Windows installer at the KDE Edu sprint in Randa. This is a very good question because it seems at first glance that got I distracted from my reason for travelling there. Although, I do not unfortunately have screenshots in this post, let me explain the situation. It is a bit dry for a reason, but please bear with me. :-)

The KDE Edu sprint began with the KDE Edu on Windows session, at least for me. We had a very productive discussion during the session and among many topics one topic was particularly close to my heart; just like at the KDE Windows BoF in Tallinn at aKademy:

How can we proceed with promoting KDE Edu on Windows? How can we get an installer as soon as possible?

Having had the session I briefly decided in my mind I was going to work on an installer as an experiment when we have spare time among the sessions.

The KDE Windows team did a great job for aiding the situation, so many thanks to them. One thing which was immediately obvious in this area: we have to have an installer for a full KDE Edu stack, so not just a single application. We have had examples out there for having a Windows Installer for Amarok and so forth, but they are all standalone applications.

Although I have made Windows NSIS installers previously for Gluon, Mula and so forth by using CPack, as a total newbie about making Windows installers this way, I have decided to make an in-between step. What in-between step exactly? That said, having thought through, it was clear to me I should grab the "qewitter" package and get something similar done for a KDE application. As I previously had the urgent need for a Rekonq installer  at my company, I stuck with the idea of creating a standalone installer for Rekonq and then learning the basics along the way, and once that is done I can introduce the new factor of having an installer for a full stack, and not just a standalone.

As you may have read my previous blog post about the initial success of the Rekonq installer, I began the work on the KDE Edu installer. Actually I got that working during Randa with a few quirks. The most important issue was that I did not get a shortcut in the Start menu for each application. Meanwhile the KDE Edu suite installed fine with a simple "next workflow", one had to go the executable files and run them manually. Therefore, theoretically it was installable, but not too user friendly. ;-)

As for accomplishing that goal, I had to make a custom NSIS script which did not have time in Randa, but actually I got that done and committed at the Milan Bergamo airport and also onboard the plane. Vis major situation is vis major... Unfortunately when I was generating the latest version of the installer, my Windows 7 froze on the airplane, and did not respond, no matter what I did. When I tried to force a hard reboot, the operating system did not boot anymore. The last days I have tried to repair the ntfs filesystem on my Linux operating system with "ntfsfix", I have also tried to get the boot manager repaired. I have also tried to use the Windows 7 DVD I got from my colleague, but after two unsuccessful tries (3 hours repair / try), I just gave up.

If anybody has a good idea how I could get my Windws 7 working again, let me know. Otherwise I will just back-up the kderoot folder, and execute a reinstall when I have a little free time. In the meantime, if anybody is interested in the "raw installer", no shortcuts in the Start menu as it is not the latest generation, I can upload to the winkde.org server. :-)

Alternatively, if someone has a KDE Windows emerge environment, "emerge --package kdeedu-package" should also work theoretically. That even worked for me practically. :)

Last, but not least: I left out the "Step" and "Rocs" project out of the KDE Edu installer for now as they have had some build issues. I began to address the Rocs build issues at the sprint, but I was unable to solve that completely. "Step" is currently a bit of unmaintained piece, and the compilation errors were not too easy to fix up, so we did not spend too much time with that.

Tuesday, September 25, 2012

Reminder from Randa: Free Playbook for KDE contributors!

While I was in Randa at the Edu mobile session, I realized that we still have the KDE Playbook Contributor Device Program open. There are only a few days left, so do not be shy. Hurry up if you would like to apply for a device and help the KDE Project to rock on further. ;-)

http://community.kde.org/index.php?title=KDE_Mobile/Blackberry/Contributor_Device_Program

Also, please spread the word. Thank you in advance!

Blackberry Playbook

Monday, September 24, 2012

Randa: Rekonq installer for Windows

As a Rekonq fan, I always have been interested in helping with Rekonq development, even if I had very limited time to do so. Although my daily job has been recently migrating to Windows XP, I am still preserving my Linux roots. I have always wanted to switch to Rekonq on my Windows box instead of the alternative solutions.

There was an excellent KDE Windows BoF at Akademy this year in Tallinn. There was some interest from the participants' side, including me, to make Rekonq run on Windows. I was compiling the software during the session, and I actually got it running for my generic purposes right there, as in gtalk, ssl, and so forth. While I was able to make it compile, it is not a process that the average user will find easy.




Therefore, I decided to go to the #rekonq channel on irc back then and talk to "adjam", the maintainer. We were both excited to get this up and running.  However, unfortunately, as usual, I personally got distracted with other tasks. That was more than two months ago, but now I have found the time here in Randa again to work on bringing this vision to practice.


Install Path selection



Thanks to the very helpful KDE Windows team (in this case Patrick and Patrick ;), I was able to pull it all together. Here you can find the link for the installer:
http://winkde.org/pub/kde/ports/win32/repository/other/rekonq-x86-setup-1.1.exe




Installing...


Last, but not least: this is not the end of the story. There is still lots of improvement needed for the installer to get really fine tuned. Currently, the installer and installed sizes are bigger than they should be. Even with those issues and some runtime inconveniences, this is a great milestone for Rekonq in my opinion. Hope this makes someone's day more bright in the future. If not, it is also okay; I had a lot of fun while doing this. :-)


In action