Question

I am new to Qt, cross compiling and porting so please bear with me.

My goal is to use the Qwt library on Playbook OS for a Qt based application. I found a nice tutorial on Qt for Blackberry Playbook and I managed to get a simple Qt "Hello World" application running on my tablet.

My next step was to build the Qwt library and make use of it in my application. I spent some time reading about qmake and I built the library along with an application with no problems but when I run the application it crashes as soon I launch it.

Here are the steps that I took in building both the library and my app:

  1. Downloaded the source for Qwt and used the qmake that comes with the RIM's Qt port. For reference: when installing the Qt port it will create a "stage" directory and the qmake is located here: ~/stage/nto/armle-v7/usr/lib/qt4/bin/qmake. First I've got an error about the designer plugin, but after turning the designer switch off, it compiled with no errors or warnings.
  2. I have built one of the samples that come with Qwt. I only added on line in the code (based on tutorial instructions): QCoreApplication::addLibraryPath("app/native/lib");. This is needed to tell the application where at run time are the shared libraries located on the device. No problems here either. My .pro file looked as follows:

include( $${PWD}/../examples.pri )

TARGET  = curvdemo1    
DESTDIR = . 

QMAKE_LFLAGS += '-Wl,-rpath,\'./app/native/lib\''
LIBS += -lbbsupport

SOURCES = \    
    curvdemo1.cpp    

package.target = $${TARGET}.bar
package.depends = $$TARGET
package.commands = blackberry-nativepackager \
    -devMode \
    -package $${TARGET}.bar -arg -platform -arg blackberry \
    blackberry-tablet.xml $$TARGET \
    -e icon.png res/icon.png \
    -e splashscreen.png res/splashscreen.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]/libbbsupport.so.4 lib/libbbsupport.so.4 \
    -e $$[QT_INSTALL_PLUGINS]/platforms/libblackberry.so lib/platforms/libblackberry.so
    -e /home/builder/Qwt/qwt-6.0.1/lib/libqwt.so.6 lib/libqwt.so.6 \
    -e /home/builder/Qwt/qwt-6.0.1/lib/libqwtmathml.so.6 lib/libqwtmathml.so.6 

QMAKE_EXTRA_TARGETS += package

I packaged the app and deployed it, however when running the application crashes as soon as the splashscreen disappears.

The steps listed above are referring to my attempt of using the Qwt as a shared library. I did try building it as a static library by removing QwtDll as per library instructions, but the final result is the same. I can tell that the binary makes use of static libs based on its size.

With my little knowledge I can assume that the Qwt library was not properly built and cannot be loaded properly by my test app. If so how to properly port this library to Playbook OS? If not what else am I missing along these steps?

BTW I can't use Momentics to debug for the time being (for other reasons).

Thank you in advance for your contribution to my learning experience.

Was it helpful?

Solution

[SOLVED]

As I mentioned in my question I am new in both Qt and cross compiling, but I've figured what the problem was and now the graph is up and running on the Playbook.

What was causing the problem was the .pro file. I was using the examples that come with the library and the project files for them are set up to link correctly so my project was fine when built, but at runtime it couldn't find specific libs that the chart relied on.

I've removed the include( $${PWD}/../examples.pri ) line from the file and when I ran make I got a number of warning similar to this:

warning: libQtSvg.so.4, needed by /home/builder/Qwt/qwt-6.0.1/lib/libqwt.so, not found (try using -rpath or -rpath-link)

and errors similar to this:

libqwt.so: undefined reference to QSvgGenerator::~QSvgGenerator()

That lead to conclusion that my initial project file as managing this for me but confused a novice. I was missing shared libraries on the Playbook.

My final project file that fixed the problem looks as following:

QMAKE_LFLAGS += '-Wl,-rpath,\'./app/native/lib\''

LIBS += -lQtSvg -lQtXml
LIBS += -lbbsupport
LIBS += -L/home/builder/Qwt/qwt-6.0.1/lib -lqwt -lqwtmathml

INCLUDEPATH += /home/builder/Qwt/qwt-6.0.1/src    
CONFIG += qwt    
QWT_CONFIG     += QwtSvg
QWT_CONFIG     += QwtMathML

SOURCES += main.cpp  

package.target = $${TARGET}.bar
package.depends = $$TARGET
package.commands = blackberry-nativepackager \
    -devMode \
    -package $${TARGET}.bar -arg -platform -arg blackberry \
    blackberry-tablet.xml $$TARGET \
    -e icon.png res/icon.png \
    -e splashscreen.png res/splashscreen.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]/libbbsupport.so.4 lib/libbbsupport.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtSvg.so.4 lib/libQtSvg.so.4 \
    -e $$[QT_INSTALL_LIBS]/libQtXml.so.4 lib/libQtXml.so.4 \
    -e /home/builder/Qwt/qwt-6.0.1/lib/libqwt.so.6 lib/libqwt.so.6 \
    -e /home/builder/Qwt/qwt-6.0.1/lib/libqwtmathml.so.6 lib/libqwtmathml.so.6 \
    -e $$[QT_INSTALL_PLUGINS]/platforms/libblackberry.so lib/platforms/libblackberry.so

QMAKE_EXTRA_TARGETS += package
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top