Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

How to port your Qt-Projects to Playbook!

[ Edited ]

After so many Questions, I'll try to write an Howto and hope you can help me to complete it.

 

Here's my way of doing it:

 

I installed the development environment to a VirtualBox (http://www.virtualbox.org) using Windows XP SP3 with a 60GB dynamic partition.

 

Installing the NDK's

 

That's all for installation :Clap:

 

Installing newer Qt 4.8.2 libraries

 

Please have a look at the Post 2 from Jon.

 

Prepare your Project

 

Now you can copy your project to the VirtuelBox to partition C: and open it with QtCreator.

 

Change the .pro-file to add target for qnx. Here is an example. Don't forget to change it to your needs.

 

There is another solution for the libs from jon in Post 2!

 

 

qnx {
message( "PLAYBOOK" )

# native development for GPS
BB_NDK = /bbndk-2.0.0
INCLUDEPATH += $$BB_NDK/target/qnx6/usr/include
LIBS        += -lbps

# crashes on playbook
QT -= webkit

package.target = $${TARGET}.bar
package.depends = $${TARGET}

package.commands = blackberry-nativepackager \
    -devMode -debugToken platform/playbook/debugtoken.bar \
    -package $${TARGET}.bar -arg -platform -arg blackberry \
    platform/playbook/bar-descriptor.xml $$TARGET \
    -e res/bikeator.png res/bikeator.png \
    -e res/logo.png res/logo.png \
    -e $$[QT_INSTALL_LIBS]/libQtCore.so.4    lib/libQtCore.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtGui.so.4     lib/libQtGui.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtOpenGL.so.4  lib/libQtOpenGL.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtNetwork.so.4 lib/libQtNetwork.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtScript.so.4  lib/libQtScript.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtSql.so.4     lib/libQtSql.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtXml.so.4     lib/libQtXml.so.4 \
    -e $$[QT_INSTALL_PLUGINS]/platforms/libblackberry.so lib/platforms/libblackberry.so \
    -e $$[QT_INSTALL_PLUGINS]/platforms/libblackberry.so lib/libblackberry.so \
    -e $$[QT_INSTALL_PLUGINS]/sqldrivers/libqsqlite.so   lib/sqldrivers/libqsqlite.so \
    -e $$[QT_INSTALL_PLUGINS]/imageformats/libqjpeg.so   lib/imageformats/libqjpeg.so
    #-e $$[QT_INSTALL_LIBS]/libQtCore.so.4 lib/libQtCore.so.4 \
    #-e $$[QT_INSTALL_LIBS]/libQtGui.so.4 lib/libQtGui.so.4 \
    #-e $$[QT_INSTALL_LIBS]/libQtOpenGL.so.4 lib/libQtOpenGL.so.4 \
    #-e $$[QT_INSTALL_LIBS]/libQtNetwork.so.4 lib/libQtNetwork.so.4 \
    #-e $$[QT_INSTALL_LIBS]/libbbsupport.so.4 lib/libbbsupport.so.4 \
    #-e $$[QT_INSTALL_PLUGINS]/platforms/libblackberry.so lib/platforms/libblackberry.so

contains(QT,webkit) {
    package.commands  += -e $$[QT_INSTALL_LIBS]/libQtWebKit.so.4  lib/libQtWebKit.so.4

QMAKE_EXTRA_TARGETS += package

}

 

Create a bar-descriptor.xml: Again an example. Don't forget to change it to your needs.

 

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
    <id>com.bikeator.bikeator_free</id>
    <filename>BikeAtor_Free</filename>
    <name>BikeAtor Free</name>
    <versionNumber>0.2.0</versionNumber>
    <description>GPS and Maps</description>
    <copyright>2012 Andreas Wiener</copyright>

    <initialWindow>
        <systemChrome>none</systemChrome>
        <transparent>false</transparent>
        <autoOrients>true</autoOrients>
        <aspectRatio>landscape</aspectRatio>
    </initialWindow>

    <publisher>Andreas Wiener</publisher>
    <permission system="true">run_native</permission>
    <category>core.travel</category>
    <icon><image>res/bikeator.png</image></icon>
    <splashscreen>res/logo.png</splashscreen>
    <action>read_geolocation</action>
    <action>access_shared</action>
    <!-- use_camera access_internet,access_shared,use_camera,set_audio _volume,play_audio,record_audio,use_microphone, post_notification, read_geolocation,read_device_identifying_informati on,allow_android_player-->

    <env var="LD_LIBRARY_PATH" value="app/native/lib" />
    <env var="QT_QPA_PLATFORM_PLUGIN_PATH" value="app/native/lib/platforms" />
</qnx>

 

 

Now your project should compile correctly.

 

I had to change some little things like abs(X) to abs((int)X) or isnan() to std::isnan()

 

Run on Playbook

 

To run the App at your Playbook there is more work todo.

 

I prepared my Wifi network (DHCP) to give the Playbook always the same IP. So I can do all deployment/debugging over Wifi without connecting the Playbook via USB. USB will always make trouble connection to VirtualBox.

 

  • Get a debug-token from RIM: https://www.blackberry.com/SignedKeys/
  • Start the BB NDK
  • Go to Window -> Preferences -> Blackberry Tablet OS -> Signing
  • Click on Register and follow the steps and remember the password
  • Find the debugtoken.bar somewhere in your home-directory and copy it to your project-folder

Now start QtCreator again, open your project and do the following steps:

  • On the left side choose "projects" and select "run configurations".
  • Configure your device (maybe you have to order a debugtoken). 
  • At "create package" select your bar-descriptor.xml. Maybe this step isn't needed if specified correctly in the .pro-file).

If that doesn't work you can create a own rule to create the bar-file:

 

  • At "run configurations" use "add deploy step"
  • "Executeable": make
  • "Working Directory": path to your .pro-file
  • "Arguments": <your projectname>.bar
  • Disable normal "create package"
  • Move your "custom deployment step" before the "deploy package" step

 FAQ

 

Error: Application descriptor file not specified, please check deployment settings

Check the qnx-rule in your project-file (see example above). Is the path to your descriptor in "package.commands" correct? Did you specify it in the run-configurations?

 


Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: How to port your Qt-Projects to Playbook!

Hi BikeAtor,

Nice job.

I put together a quick tutorial awhile back for this, its here: http://supportforums.blackberry.com/t5/Native-Development/How-to-buid-sign-and-deploy-from-the-QtSDK...

I have discovered a better way since then though, put the sign and deploy steps under a custom run configuration instead of under the build configuration.

This will not get you debug output though, you will need to install Qt creator 2.5 and figure it out from there or:

Are you aware that RIM released a Qt Creator playbook SDK, its here https://github.com/blackberry/Qt/downloads

With that you have debug output from device and all the custom steps needed to build and deploy to the playbook are already done.

The Qt4.8.1 libs in the pb SDK are long outdated though, get the latest branch of Qt4.8.2 from here: http://qt.gitorious.org/qt/qt  And configure them like this:

$ ./configure -opensource -confirm-license -qpa -iconv -shared -release -xplatform unsupported/blackberry-armv7le-qcc \ -little-endian -arch arm -largefile -nomake examples -xmlpatterns -no-webkit -no-neon -no-rpath -opengl es2 -prefix-install -prefix ~/QtPlaybook
$ make 
$ make install

 Then just copy the fresh Qt libs over the existing ones in the SDK.

With the pb SDK you dont need to modify the PRO but rather they do the exporting/packaging all via the descriptor.xml. The problem is it deploys the entire Qt libs folder which is around 90mb's. A solution is to copy the libs that you need to a deploy folder that you put in your projects root directory then modify the bar descriptor to use them instead. Here is an example of one of my  bar descriptors for a qml app using the bb SDK where I have my required libs in a deploy folder, for this qml app I used these libs: Qtapp/deploy/lib/

libQtCore.so.4         libQtNetwork.so.4  libQtSql.so.4          libQtXml.so.4
libQtDeclarative.so.4  libQtOpenGL.so.4   libQtSvg.so.4
libQtGui.so.4          libQtScript.so.4   libQtXmlPatterns.so.4

Note that for the pb you must always include the openGl lib or your app wont start on device. Here is the descriptor.xml:

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<qnx xmlns="http://www.qnx.com/schemas/application/1.0">
<id>com.snappyappz.ec_pb</id>
<filename>E-Calc</filename>
<name>E_Calc</name>
<versionNumber>1.0.1</versionNumber>
<buildId>86</buildId>
<description>Common electrical calculations in a snap!</description>
<copyright>2012</copyright>
<initialWindow>
<systemChrome>none</systemChrome>
<transparent>false</transparent>
<autoOrients>true</autoOrients>
<aspectRatio>portrait</aspectRatio>
</initialWindow>
<publisher>SnappyAppz.com</publisher>
<!--<permission system="true">run_native</permission> -->
<category>core.games</category>
<icon><image>icon.png</image></icon>
<splashscreen>ssLandscape.png:ssPortrait.png</splashscreen>

 <!--<env var="QT_DEBUG_PLUGINS" value="1"/> -->
 <env var="LD_LIBRARY_PATH" value="app/native/lib"/>
 <env var="QT_QPA_FONTDIR" value="/usr/fonts/font_repository/liberation"/>
 <env var="QML_IMPORT_PATH" value="app/native/imports"/>
 <env var="QT_PLUGIN_PATH" value="app/native/plugins"/>

    <arg>-platform</arg>
    <arg>blackberry</arg>
    <action system="true">run_native</action>
    <asset entry="true" path="E-Calc" type="Qnx/Elf">E-Calc</asset>
    <asset path="qml">qml</asset>
    <asset path="imports">imports</asset>
    <asset path="ssPortrait.png">ssPortrait.png</asset>
    <asset path="ssLandscape.png">ssLandscape.png</asset>
    <asset path="icon.png">icon.png</asset>
    <asset path="deploy/lib">lib</asset>
    <asset path="/home/jon/qtQNX/plugins">plugins</asset>
    <asset path="/home/jon/qtQNX/imports">imports</asset>
</qnx>

 And I now no longer have all the packaging commands in my pro file:

# Add more folders to ship with the application, here
folder_01.source = qml/ECalc
folder_01.target = qml
DEPLOYMENTFOLDERS = folder_01

TARGET = E-Calc

# The .cpp file which was generated for your project. Feel free to hack it.
SOURCES += main.cpp
HEADERS += settings.h
# Please do not modify the following two lines. Required for deployment.
include(qmlapplicationviewer/qmlapplicationviewer.pri)
qtcAddDeployment()

OTHER_FILES += \
    blackberry-tablet.xml

Now developing with Qt creator for the playbook is a joy, complete with debug output via wifi!

 

I hope that helps!

Cheers,

Jon

 

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: How to port your Qt-Projects to Playbook!

I forgot to mention that the pbQtSDK also will generate a bar descriptor for you automatically for projects that you are porting. Go to:  file->newFile->blackberry->application_descriptor And bam you will have a generic bar descriptor added to your project.

I also didn't mention the  steps required to connect the SDK to your playbook.

Goto,  tools->options->Linux Devices->Device configurations->playbook from there you can enter your pb's IP, password and point it to your debugtoken and ssh key (needed for debug output).

Then click the "projects" button on the left and select the "run" configuration from the floating QNX toolbar and point it to your descriptor and bar package.

 

 

Cheers,

Jon

 

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to port your Qt-Projects to Playbook!

Hi jon,

 

thanks for your answer.

My mentioned download-page also links to github, but I changed the link. So I used the same Qt installation.

 

I prefer my solution for libraries, cause I don't want a copy of the libs for every project. Also I can compile different versions of the same App with different used libs without copying or removing libs from a directory. I doesn't like to many places to look for configurations. But I mention your post now.

 

Can you give a public download link or send me the new libs to put them at my website? It would be nice to have the libs ready for download, so we use the same libs with the same problems which will make it easier to rebuild problems of other users.

 

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: How to port your Qt-Projects to Playbook!

The Qt4.8 branch gets almost daily updates for the bb port lately, just yesterday there was some good commits for bps, http://qt.gitorious.org/qt/qt/commits/4.8 so it should be compiled every other day or every week maybe? 

I currently am very short on time and would not be able to support that...

If you would like I can compile the latest 4.8.2 for the pb and send you the package? Do you have an FTP or something I can upload them too?

Cheers,

Jon

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to port your Qt-Projects to Playbook!

If it changes so often, I will setup a VB with linux and will compile it by myself from time to time. With linux I can easily automate the build and upload. But it may take a few days to do it.

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: How to port your Qt-Projects to Playbook!

I just compiled the latest Qt4.8.2 for the playbook and zipped up its 20mb. Do you want me to upload it somewhere?

Cheers,

Jon

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to port your Qt-Projects to Playbook!

Hi Jon,

 

I hadn't much time, but I managed to install the linux VB (linux mint doesn't work, so I also used fedora) and compile Qt by myself. But networking doesn't work any longer with my App.

 

So I will have todo more tests before posting anything.

 

Installation instructions for Fedora will follow soon.

Please use plain text.
Developer
jheron
Posts: 188
Registered: ‎01-27-2012
My Device: playbook

Re: How to port your Qt-Projects to Playbook!

Hi BikeAtor,

I pm'd you the latest Qt repository from friday (it appears that no bb specific updates have been committed since then anyways), I compiled it against the latest 2.0.1 NDK also. I think I sent you the latest link on Saturday, not sure if you saw it or not?

I did some testing with it last night and had no issues, however I did not do any network testing, just some app debugging... I should have some time later tonight to do some more testing, let me know if you want me to check something specific.

Cheers,

Jon

 

Please use plain text.
Developer
BikeAtor
Posts: 62
Registered: ‎03-31-2012
My Device: Playbook

Re: How to port your Qt-Projects to Playbook!

I wanted to edit my first post, but I can't do it anymore :-( So I can't update the solution :-(

 

 

 

 

@RIM is there a way to edit old posts? I hate reading a complete thread to find the solution. It would be nice to change the first post to get the actual informations.

Please use plain text.