[BlackBerry-Python] PySide for BB10
Martin Kolman
martin.kolman at gmail.com
Mon Jan 28 11:13:45 EST 2013
16.1.2013 03:06, Peter Hansen:
> On 2013-01-15 20:12, Martin Kolman wrote:
>> relevant part of the debug log for "from PySide.QtGui import
>> QApplication":
>>
>> dlopen("PySide/QtGui.so", 2);
>> ldd:FATAL: Unresolved symbol "_Z17init_QPrinterInfoP7_object" called
>> from QtGui.so
>
> This reminds me a lot of when Ritesh and I were trying to get the
> basic PySide build working for the PlayBook, and had to strip out
> certain things that didn't look likely to be compatible. I don't
> recall the specifics but you'd see signs of them in our patch files at
> http://hg.microcode.ca/blackberry-py/src/500d90ca1dbee18fbc58ed1921d464c39377892b/patches/02-pyside-qnx.patch?at=pyside
>
> I just peeked there, and QSound was one of them. I wouldn't think
> QPrinterInfo would have the pieces needed to support it, so stripping
> it out in similar fashion seems like a reasonable step.
>
> -Peter
> _______________________________________________
> BlackBerry-Python mailing list
> BlackBerry-Python at engcorp.com
> http://www.engcorp.com/mailman/listinfo/blackberry-python
As you might have already noticed, I got PySide working and already
submitted a working application (Mieru) for review to (App)World. So,
how did I do that ? :)
First, I would like to thank to Peter, Micke & all others who helped me
here & on #bbx-python. Without you I would not have succeeded! :)
Barebones PySide at BB10 howto
When adapting the work PySide port for Playbook I have encountered two
main issues - weird segfaults in QtGui & missing symbols.
I've solved the first issue thanks to Micke by manually loading the Qt
Libraries before the corressponding PySide module is loaded, like this:
from ctypes import *
qtcore = CDLL('libQtCore.so.4')
qtdecl = CDLL('libQtDeclarative.so.4')
qtgui = CDLL('libQtGui.so.4')
Just run this before importing modules from PySide & you are safe.
After solving this issue, importing the PySide modules still resulted in
segfault due to missing symbols, such as QPrinterInfo, QDeviceInfo and
others. Those Classes indeed are not available in the BB10 Qt libraries.
After Peters suggestion, I've solved it by progressively removing all
the offending classes. The resulting modified PySide source code is here:
https://github.com/M4rtinK/pyside-bb10/tree/bb10
I've also pushed Shiboken source just with the Playbook patches (any new
ones were not necessary) here:
https://github.com/M4rtinK/shiboken-bb10/tree/bb10
Just grab the sources & follow the PySide for Playbook guide[1] and you
should get a working PySide build for BB10. :)
Using on device Qt Libraries
BB10 contains a fully usable Qt 4.8.4 build, you you can skip the custom
Qt build and just compile against the Qt libraries in the NDK. The
resulting base package size is about 3.7 MB as only the PySide libraries
need to be bundled in.
Qt Components
If your application requires Qt Components, you can use the Qt
Components I've modified to work on the high-DPI BB10 device screen. My
work is based on the Ineans Qt components clone and is available here:
https://qt.gitorious.org/~martink/qt-components/martinks-ineans-qt-components/commits/bb10
See the README for information how to build & use them. :)
The components should be compatible with the usual com.nokia.meego 1.0
namespace and the application indeed looks basically the same as on
Harmattan at Nokia N9. :)
Screenshots:
http://t.co/JTj6KWvj
or
http://modrana.org/images/bb10/mieru/release_screenshots/
Slow QtQuick
By default, QtQuick application don't use the OpenGL viewport, which
results in bad performance (only the software viewport/rasterizer is
used). To enabled OpenGL, add this to you bar-descriptor.xml:
<env var="QBB_USE_OPENGL" value="1"/>
Note that QtQuick with OpenGL is reportedly still a bit experimental and
weird issues might show up. But by enabling it, you get at least the
same performance as on Harmattan at N9 (which is nice, considering the much
larger resolution).
Mieru - a case study
I managed to cram the final signed Mieru bar package to 6.9 MB
The package includes:
* stripped PySide libraries
* Mieru Python (including byte-compiled files) & QML source
* stripped unrar binary
* stripped libmagic.so & 2MB (when uncompressed) magic.mgc file type
recognition library library
* the above mentioned Qt Component (including Extras) with stripped
plugin *.so
* cut-down Qt Components theme
* portrait splashscreen
BTW, the basic package is 6.7, the signing adds about 200 kB overhead in
this case.
[1] http://hg.microcode.ca/blackberry-py/wiki/Building%20PySide
So that's it! :)
Best wishes
Martin Kolman
PS.: I plan to compile all this to a comprehensive online guide eventually.
More information about the BlackBerry-Python
mailing list