Monday 5 August 2013

Alpha 2: Installing an Import Library on the Emulator

In a previous post I covered the code migration of my import library AbstractUI from Qt4 to Qt5.

However the greatest problem proved to be not in the code, but rather where to install my newly migrated library. Read on to find out the solution.



Having completed the migration of my import library AbstractUI to Qt5, I was keen to continue with the migration of LandedSettings, which uses this library. This would also test if the migration of the library was successful.

For the first Alpha, the install location for libraries on the Emulator was:

/usr/lib/qt4/imports/o

So it seemed logical to me that with Qt5 the new install location would be:

/usr/lib/qt5/imports/

I have a helper script using rsync to deploy my abstractui files, as described here, so I quickly modified this to deploy my library to the directory above.

Next I opened my LandedSettings project, and hit the build and run button, and was bitterly disappointed because it could not find AbstractUI.

file:///opt/sdk/landedsettingsQt5_21/usr/share/landedsettingsQt5_21/main.qml:2:1: module "org.flyingsheep.abstractui" is not installed


Had I somehow copied the files to the wrong place? A quick SSH confirmed that my files were on the Emulator exactly where I was expecting. So what was wrong?

Then it occurred to me to look where Sailfish install their files. Taking SilicaFlickable as an example, I did the following on the Emulator

[root@SailfishEmul ~]# find / -name SilicaFlickable.qml

which gave:

/usr/lib/qt5/qml/Sailfish/Silica/SilicaFlickable.qml

Bingo! The subdirectory is qml, NOT imports!


The correct location to install import libraries on the Emulator is/usr/lib/qt5/qml/


I adapted my rsync script, and this time QtCreator found AbstractUI, and I could focus on completing the migration of LandedSettings. More on that soon.

Interestingly the MERSDK is no so picky. QtCreator will find libraries installed in both the directories below:

/Users/<your user>/SailfishOSAlpha5/mersdk/targets/SailfishOS-i486-x86/usr/lib/qt5/imports

/Users/<your user>/SailfishOSAlpha5/mersdk/targets/SailfishOS-i486-x86/usr/lib/qt5/qml

No comments:

Post a Comment