Tuesday 21 May 2013

Adding Additional Qt Packages to Sailfish SDK and Emulator

Note: 06 Nov 20 13: This post refers to Qt4 packages, thought the techniques are still relevant for the Qt5 Alpha:  Please also see the newer post:

http://flyingsheeponsailfish.blogspot.com/2013/11/deploying-additional-packages-to.html

Having posted the code of AbstractUI  to GitHub yesterday, I plan to post the code to Landed and LandedSettings: my two core apps that use AbstractUI.

However before we do that we need to address one of the first problems that you may encounter when migrating from Harmattan to Sailfish.

Your app may start up on the Sailfish Emulator, but parts of it don't do anything:

The cause?

"Missing" Qt packages on the Sailfish Alpha: Some of the packages installed as standard on Harmattan and that your app relies on, are not installed as standard on the Sailfish Alpha.

Luckily in many cases we can fix that: We simply install the packages to Sailfish.

Many things come in two halves. One example is the new Jolla smart phone just announced: Another is installing packages to Sailfish. We need to install on both the SDK and the Emulator.

In the case of Landed and its sidekick LandedSettings I had to install the packages.

  • qt-components-devel: this gives me access to the com.nokia.meego component Harmattan component set which I will use temporarily to get my apps runnable on Sailfish.
  • qt-mobility-devel: gives me access to the Qt Mobility API for things like Camera and GPS functionality.
  • sqlite-devel: for database access.

Your first step has to be to ascertain which packages are missing, and what they are called. A little bit of googling may help here (or alternatively, searching using zypper on the Emulator).

Installing to the SDK

Then our next port-of-call is the Sailfish SDK Control Center. If you have not yet stumbled over this, it is accessed by the Sailfish Icon between the Projects and Analyze icons on the icon bar on the lefthand edge of QtCreator.

On the Targets tab, click the "Manage" button. This should give you a long list of packages to install or deinstall. The rest is easy: find your desired package and click install.

Installing to the Emulator

This is initially marginally less easy, as we have to do this on the command line via SSH. We will be using the package management tool zypper:

zypper is pretty cool, as it sorts out dependencies, and will install other packages that your target package depends on.

http://en.opensuse.org/File:Zypper-cheat-sheet-1.pdf

http://en.opensuse.org/File:Zypper-cheat-sheet-2.pdf

Connect to the Emulator as described in this post.

As an example, to install the package  sqlite-devel, including other packages this depends on:

[root@SailfishEmul ~]# zypper in sqlite-devel

Loading repository data...
Reading installed packages...
Resolving package dependencies...

The following NEW packages are going to be installed:
pkgconfig sqlite-devel

2 new packages to install.
Overall download size: 322.5 KiB. After the operation, additional 936.9 KiB will be used.
Continue? [y/n/?] (y): y
Retrieving package pkgconfig-0.27.1-1.4.i486 (1/2), 220.3 KiB (574.5 KiB unpacked)
Retrieving: pkgconfig-0.27.1-1.4.i486.rpm ........................................................[done (33.1 KiB/s)]
Retrieving package sqlite-devel-3.7.15.2-1.3.i486 (2/2), 102.2 KiB (362.4 KiB unpacked)
Retrieving: sqlite-devel-3.7.15.2-1.3.i486.rpm ....................................................[done (5.6 KiB/s)]
Installing: pkgconfig-0.27.1-1.4 ..............................................................................[done]
Installing: sqlite-devel-3.7.15.2-1.3 .........................................................................[done]

zypper also supports search, which is great if you don' t know the exact name of a package: You can find packages using the se command. e.g. to find packages with "mobility" in the name:

[root@SailfishEmul ~]# zypper se 'mobility'
Loading repository data...
Reading installed packages...

S | Name                                      | Summary                                                     | Type
--+-------------------------------------------+-------------------------------------------------------------+-----------
  | qt-mobility-debuginfo                     | Debug information for package qt-mobility                   | package
  | qt-mobility-debugsource                   | Debug sources for package qt-mobility                       | package
  | qt-mobility-devel                         | APIs for mobile device functionality - development files    | package
  | qt-mobility-examples                      | Qt Mobility examples                                        | package
  | qt-mobility-haptics-ffmemless             | Plugin which provides haptic feedback via ffmemless ioctl   | srcpackage
i | qt-mobility-haptics-ffmemless             | Plugin which provides haptic feedback via ffmemless ioctl   | package
  | qt-mobility-haptics-ffmemless-debuginfo   | Debug information for package qt-mobility-haptics-ffmemless | package
  | qt-mobility-haptics-ffmemless-debugsource | Debug sources for package qt-mobility-haptics-ffmemless     | package
i | qt-mobility-l10n                          | APIs for mobile device functionality - localization files   | package
  | qt5-qtdeclarative-import-mobility-sensors | QtQml mobility sensors import                               | package

 


No comments:

Post a Comment