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
iravelo
Posts: 61
Registered: ‎06-28-2011
My Device: 9700+PB
Accepted Solution

ubuntu + QT5 + playbook (sans momentics and from command line)

Hi all,

I've seen and tried to follow this tuto here

http://qt-project.org/wiki/Building_Qt_5_for_the_Playbook

where we are supposed to be build QT5 for arm, config and deploy some helloworld QT5 app to a playbook.

 

The problem is that the source codes are not included and I a not able to find out what to put in the main.cpp to succeed.

Probably, I also have issues outside this cpp but they are stil masked for now...

 

 Can any one who is kind and skilled enough go through the tuto and add the missing infos to perform it from A to Z ?

 

Thanks in advance !

 

---------<={##}=>---------
I.Ravelo; Renault S.A.S. Corporate BBOS Java Apps Lead Conceptor/Coder; Qt learner
Please use plain text.
Contributor
Cedrik
Posts: 13
Registered: ‎02-19-2012
My Device: None - Playbook only.

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

Any Qt code should work so...check this link : http://wiki.qt-project.org/QNX

 

There is a hello world example near the end.

Please use plain text.
Developer
iravelo
Posts: 61
Registered: ‎06-28-2011
My Device: 9700+PB

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

[ Edited ]

main.cpp:

 

#include <QtWidgets/QApplication>
#include <QtWidgets/QPushButton> int main(int argc, char *argv[]) { QApplication app(argc, argv); QPushButton button("Hello raxy Playbook World!"); QObject::connect(&button, SIGNAL(clicked()), &app, SLOT(quit())); button.show(); return app.exec(); }

 helloworld.pro:

######################################################################
# Automatically generated by qmake (2.01a) Sun Mar 18 13:25:38 2012
######################################################################
# helloworld.pro, firstest qt app by raxy

TEMPLATE = app
TARGET = helloqtquick2
DEPENDPATH += .
INCLUDEPATH += .
SOURCES += main.cpp

#QT += qml quick
#RESOURCES += helloqtquick2.qrc
#OTHER_FILES += main.qml

qnx {

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

    PACKAGE_ARGS = \
        $${PWD}/bar-descriptor.xml $$TARGET \
        -e $${PWD}/icon.png res/icon.png \
        -e $$[QT_INSTALL_LIBS]/libQtCore.so.5 lib/libQtCore.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtGui.so.5 lib/libQtGui.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtOpenGL.so.5 lib/libQtOpenGL.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtNetwork.so.5 lib/libQtNetwork.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtWidgets.so.5 lib/libQtWidgets.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtQuick.so.5 lib/libQtQuick.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtQml.so.5 lib/libQtQml.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtSql.so.5 lib/libQtSql.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtV8.so.5 lib/libQtV8.so.5 \
        -e $$[QT_INSTALL_LIBS]/libQtXmlPatterns.so.5 lib/libQtXmlPatterns.so.5 \
        -e $$[QT_INSTALL_PLUGINS]/platforms/libqnx.so plugins/platforms/libqnx.so \
        -e $$[QT_INSTALL_IMPORTS]/ imports/

    package.target = $${TARGET}.bar
    package.depends = $$TARGET
    package.commands = blackberry-nativepackager \
        -package $${TARGET}.bar \
        -devMode -debugToken $$(DEBUG_TOKEN) \
        $${PACKAGE_ARGS}

    QMAKE_EXTRA_TARGETS += package

    OTHER_FILES += bar-descriptor.xml

}

 

 

qmake and make results :

raxy@ubuntu:~/ndk-2.0.0-workspace/helloworld$ qmake helloworld.pro
raxy@ubuntu:~/ndk-2.0.0-workspace/helloworld$ make -j2
qcc -Vgcc_ntoarmv7le -lang-c++ -c -Wno-psabi -O2 -Wall -W -D_REENTRANT -fPIE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../development/qnx/qt5/mkspecs/unsupported/qnx-armv7le-qcc -I. -I../../development/qnx/qt5/include/QtCore -I../../development/qnx/qt5/include/QtGui -I../../development/qnx/qt5/include -I. -I. -I../../bbndk-2.0.0/target/qnx6/usr/include -I../../bbndk-2.0.0/target/qnx6/usr/include/freetype2 -o main.o main.cpp
qcc -Vgcc_ntoarmv7le -lang-c++ -Wl,-rpath-link,/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/lib -Wl,-rpath-link,/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/usr/lib -Wl,-rpath,'./app/native/lib' -Wl,-O1 -Wl,-rpath,/home/raxy/development/qnx/qt5/lib -o helloqtquick2 main.o -L/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/lib -L/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/usr/lib -L/home/raxy/development/qnx/qt5/lib -lQtGui -L/home/raxy/development/qnx/qt5/lib -L/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/lib -L/home/raxy/bbndk-2.0.0/target/qnx6/armle-v7/usr/lib -lQtCore -lm -lGLESv2 -lEGL
main.o: In function `main':
main.cpp:(.text+0x30): undefined reference to `QApplication::QApplication(int&, char**, int)'
main.cpp:(.text+0x5c): undefined reference to `QPushButton::QPushButton(QString const&, QWidget*)'
main.cpp:(.text+0xdc): undefined reference to `QApplication::exec()'
main.cpp:(.text+0xe8): undefined reference to `QPushButton::~QPushButton()'
main.cpp:(.text+0xf0): undefined reference to `QApplication::~QApplication()'
main.cpp:(.text+0x108): undefined reference to `QApplication::~QApplication()'
main.cpp:(.text+0x11c): undefined reference to `QPushButton::~QPushButton()'
cc: /home/raxy/bbndk-2.0.0/host/linux/x86/usr/bin/ntoarm-ld error 1
make: *** [helloqtquick2] Error 1

 

 Please someone help me understand how to fix these errors .

Tks !

 

 

---------<={##}=>---------
I.Ravelo; Renault S.A.S. Corporate BBOS Java Apps Lead Conceptor/Coder; Qt learner
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

Are you sure you are linking with good libQtCore.so?

Please use plain text.
Developer
iravelo
Posts: 61
Registered: ‎06-28-2011
My Device: 9700+PB

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

how to be sure I link with the correct libs ?

 

here is what says qmake -query.. 

raxy@ubuntu:~$ qmake -query
QT_SYSROOT:
QT_INSTALL_PREFIX:/home/raxy/development/qnx/qt5
QT_INSTALL_DATA:/home/raxy/development/qnx/qt5
QT_INSTALL_DOCS:/home/raxy/development/qnx/qt5/doc
QT_INSTALL_HEADERS:/home/raxy/development/qnx/qt5/include
QT_INSTALL_LIBS:/home/raxy/development/qnx/qt5/lib
QT_INSTALL_BINS:/home/raxy/development/qnx/qt5/bin
QT_INSTALL_TESTS:/home/raxy/development/qnx/qt5/tests
QT_INSTALL_PLUGINS:/home/raxy/development/qnx/qt5/plugins
QT_INSTALL_IMPORTS:/home/raxy/development/qnx/qt5/imports
QT_INSTALL_TRANSLATIONS:/home/raxy/development/qnx/qt5/translations
QT_INSTALL_CONFIGURATION:/etc/xdg
QT_INSTALL_EXAMPLES:/home/raxy/development/qnx/qt5/examples
QT_INSTALL_DEMOS:/home/raxy/development/qnx/qt5/examples
QT_HOST_PREFIX:/home/raxy/development/qnx/qt5
QT_HOST_DATA:/home/raxy/development/qnx/qt5
QT_HOST_BINS:/home/raxy/development/qnx/qt5/bin
QMAKE_MKSPECS:/home/raxy/development/qnx/qt5/mkspecs
QMAKE_VERSION:2.01a
QT_VERSION:5.0.0

 and 

 

raxy@ubuntu:~$ file /home/raxy/development/qnx/qt5/lib/libQtCore.so.5
/home/raxy/development/qnx/qt5/lib/libQtCore.so.5: symbolic link to `libQtCore.so.5.0.0'
raxy@ubuntu:~$ file /home/raxy/development/qnx/qt5/lib/libQtCore.so.5.0.0
/home/raxy/development/qnx/qt5/lib/libQtCore.so.5.0.0: ELF 32-bit LSB shared object, ARM, version 1 (SYSV), dynamically linked, stripped

 

 

 

---------<={##}=>---------
I.Ravelo; Renault S.A.S. Corporate BBOS Java Apps Lead Conceptor/Coder; Qt learner
Please use plain text.
New Contributor
AnthonyMMWaB
Posts: 9
Registered: ‎03-25-2012
My Device: Playbook

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

I get the exact same errors.I also followed the instructions on the page the OP linked.
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

The problem is that linker does not see QApplication class definition which should be in libQtCore.so library.
Please use plain text.
Developer
iravelo
Posts: 61
Registered: ‎06-28-2011
My Device: 9700+PB

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

[ Edited ]

there is a libQtCore.so file in there :

 

raxy@ubuntu:~$ file /home/raxy/development/qnx/qt5/lib/libQtCore.so
/home/raxy/development/qnx/qt5/lib/libQtCore.so: symbolic link to `libQtCore.so.5.0.0'

 

 but how do i know it includes QtApplication class def ??

---------<={##}=>---------
I.Ravelo; Renault S.A.S. Corporate BBOS Java Apps Lead Conceptor/Coder; Qt learner
Please use plain text.
Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

I was ready to say "use nm" but for some reason

nm -a -arch all libQtCore.so

gives me nothing! I can't explain this fact now, anybody?

Please use plain text.
New Contributor
AnthonyMMWaB
Posts: 9
Registered: ‎03-25-2012
My Device: Playbook

Re: ubuntu + QT5 + playbook (sans momentics and from command line)

Okay, some troubleshooting I have found that the problem is that the code you posted doesn't link in the QtWidgets library.

 

add the lines

 

CONFIG=qt

QT += widgets

 

to your .pro file and then it should work.

 

Still won't completely compile for the playbook because it complains about missing icon files, but that shouldn't be too hard to fix.

Please use plain text.