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
New Contributor
pmnarsapur
Posts: 6
Registered: ‎09-27-2012
My Device: -
Accepted Solution

Application crashes after compiling/linking on command line and running on Simulator

Hi All,

 

I have a project where I need to link my static libraries built seperately (but using the toolchain/compiler inside BBNDK) to a sample QML BB10 application.  I am relatively new to BB10 and its environment.

 

Although the application compiles and linkes successfully, on running the application it is segmenting under line

AbstractPane *root = qml->createRootObject<AbstractPane>();

 My other static libraries have a lot of references to Standard C++ Library such as strings, streams etc. and these are found inside libstdc++.a/.so. Also some references to Expat and sockets. So I provided these library to my compilation path as following

qcc -Vgcc_ntox86 -lang-c++ -Wl,-rpath-link,/opt/bbndk/target_10_0_9_386/qnx6/x86/lib -Wl,-rpath-link,/opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib -o o-g/MyApp o-g/.obj/main.o o-g/.obj/MyApp.o o-g/.obj/moc_MyApp.o    -L/opt/bbndk/target_10_0_9_386/qnx6/x86/lib -L/opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib -L/opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/qt4/lib -L/opt/bbndk/lib ./myStaticLib.a /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/gcc/4.6.3/libstdc++.a /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libexpat.so.2 /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libsocket.so -lm -lbps -lbb -lbbcascades -lQtDeclarative -lQtScript -lQtSvg -lQtSql -lQtXmlPatterns -lQtXml -lQtGui -lQtNetwork -lQtCore

 

With this application compiles/links successfully however as said earlier it crashes inside createRootObject.

If i don't specify my static library (myStaticLib.a), take out any references for myStaticLib.a in the code and remove the stdc++ library, application goes ahead and the screen is displayed properly.

 

NOTE: myStaticLib.a is not related to the QT code in anyway. I am calling method inside myStaticLib after I have successfully initialized QT and after showing the first screen in the code.

 

I was able to pull out the core file from the simulator and also use it with gdb present on my build machine. Here is the output from the gdb.

 

root@server:/opt/bbndk#host_10_0_9_52/linux/x86/usr/bin/ntox86-gdb /home/puneet_narsapur/webrtc/ip/psl_p2pwebrtc_r2835_x86_bb10/trunk/third_party/libjingle/source/talk/examples/BBTalk/x86/o-g/PeerConnection /home/puneet_narsapur/webrtc/ip/psl_p2pwebrtc_r2835_x86_bb10/trunk/PeerConnection.core
GNU gdb (GDB) 7.4 qnx (rev. 691)
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=i486-pc-nto-qnx6.5.0".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/puneet_narsapur/webrtc/ip/psl_p2pwebrtc_r2835_x86_bb10/trunk/third_party/libjingle/source/talk/examples/BBTalk/x86/o-g/PeerConnection...done.
[New pid 8880242 tid 1]
[New pid 8880242 tid 2]
[New pid 8880242 tid 3]
[New pid 8880242 tid 4]
[New pid 8880242 tid 5]
[New pid 8880242 tid 6]
[New pid 8880242 tid 7]
[New pid 8880242 tid 8]
[New pid 8880242 tid 9]
[New pid 8880242 tid 10]
[New pid 8880242 tid 11]
[New pid 8880242 tid 12]
[New pid 8880242 tid 13]

warning: Corrupted shared library list: 0x0 != 0x86f8000

warning: Could not load shared library symbols for 15 libraries, e.g. libQtDeclarative.so.4.
Use the "info sharedlibrary" command to see the complete listing.
Do you need "set solib-search-path" or "set sysroot"?
Program terminated with signal 11, Segmentation fault.
#0  0xb086709e in __free () from /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libc.so.3
Traceback (most recent call last):
  File "/opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libstdc++.so.6.0.16-gdb.py", line 59, in <module>
    from libstdcxx.v6.printers import register_libstdcxx_printers
ImportError: No module named libstdcxx.v6.printers
(gdb) bt
#0  0xb086709e in __free () from /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libc.so.3
#1  0xb0866c6b in free () from /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libc.so.3
#2  0x08325e80 in operator delete(void*) ()
#3  0x08325ecc in operator delete[](void*) ()
#4  0x0832a69e in std::ios_base::~ios_base() ()
#5  0xb962fa8f in ?? () from /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
#6  0xb963074c in ?? () from /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
#7  0xb952d3c8 in bb::cascades::AbstractTextControl::setText(QString const&) () from /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
#8  0xb94df30c in bb::cascades::AbstractTextControl::qt_metacall(QMetaObject::Call, int, void**) () from /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
#9  0xb94e7762 in bb::cascades::Label::qt_metacall(QMetaObject::Call, int, void**) () from /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
#10 0xb9e9686d in ?? ()
#11 0x089b6598 in ?? ()
#12 0x00000002 in ?? ()
#13 0x0000002f in ?? ()
#14 0x07b9a14c in ?? ()
Cannot access memory at address 0x89e24cc
(gdb) info sharedlibrary
warning: Corrupted shared library list: 0x0 != 0x86f8000
From        To          Syms Read   Shared Object Library
0xb8638000  0xb86500ac  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libexpat.so.2
0xb82dd000  0xb8314824  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libsocket.so.3
0xb8203000  0xb823b8d4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libm.so.2
0xb825f000  0xb82bf56c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbps.so.3
0xb8450000  0xb848c780  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbb.so.1
0xb9400000  0xb9c5a200  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbcascades.so.1
                        No          libQtDeclarative.so.4
                        No          libQtScript.so.4
                        No          libQtSvg.so.4
                        No          libQtSql.so.4
                        No          libQtXmlPatterns.so.4
                        No          libQtXml.so.4
                        No          libQtGui.so.4
                        No          libQtNetwork.so.4
                        No          libQtCore.so.4
0xb8665000  0xb86d7a88  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libcpp.so.4
0xb0837000  0xb08d7cc0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libc.so.3
0xb8247000  0xb825c118  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libscreen.so.1
0xb823c000  0xb824210c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libpps.so.1
0xb82c9000  0xb82cd0c4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libslog2.so.1
0xb8b44000  0xb8be11e4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbsystem.so.1
0xb82c2000  0xb82c7160  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbbsystemlocale.so.1
0xb82cf000  0xb82dabac  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libEGL.so.1
0xb831d000  0xb832707c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libGLESv2.so.1
0xb8419000  0xb8425248  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libgestures.so.1
0xb8436000  0xb844a1a0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libimg.so.1
0xb8aef000  0xb8b2447c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libstrpattern.so.1
0xbacf9000  0xbae94cd0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libwebview.so.2
0xb8427000  0xb842f48c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/liblgmon.so.1
0xb8493000  0xb84aa124  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libz.so.2
0xb8ab4000  0xb8adf400  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libpng14.so.0
0xb904c000  0xb912a0c0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libiconv.so.1
0xb8316000  0xb831b504  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libclipboard.so.1
0xb84ab000  0xb84b2190  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcontext.so.1
0xb93a9000  0xb93d9774  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libnfc.so.1
0xb8243000  0xb82460d0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libnfc_bps.so.1
0xbab17000  0xbacdcb74  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libicui18n.so.49
0xbb800000  0xbd5c1258  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libwebkit.so.0
0xbb01f000  0xbb498150  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libwebkitplatform.so.0
0xbaeb5000  0xbb015644  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libicuuc.so.49
0xbb56f000  0xbb6e57c0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libgrskia.so.1
0xb8629000  0xb8634280  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libimfclient.so.1
0xb935c000  0xb939c26c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libgoogleurl.so.0
0xb8657000  0xb8663254  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libintl.so.1
0xb9c6a000  0xb9cd99c8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libcpp-ne.so.4
0xb8430000  0xb8435128  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libcounters.so.1
0xbe800000  0xbf952988  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libicudata.so.49
0xbaa99000  0xbaaf5bec  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcurl.so.2
0xbb526000  0xbb557960  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libfontconfig.so.1
0xbb4e6000  0xbb51c2b4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libjpeg.so.4
0xbb6fc000  0xbb78e4fc  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libsqlite3.so.1
0xbda11000  0xbdb342dc  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libxml2.so.1
0xbb4a1000  0xbb4db768  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libxslt.so.2
0xbd6ae000  0xbd7273c8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libfreetype.so.1
0xbb79b000  0xbb7d14f8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libharfbuzz.so.0
0xb8a99000  0xb8aa8168  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libskia-qnx.so.0
0xb8aab000  0xb8ab1120  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libppscache.so.1
0xb8ae7000  0xb8aed150  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libmmrndclient.so.1
0xb8ae0000  0xb8ae61bc  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libmd.so.1
0xb848d000  0xb8492120  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libaoi.so.1
0xbb7d5000  0xbb7fb7f4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libinput_client.so.1
0xbd628000  0xbd668138  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libhuapi.so.5
0xb8b25000  0xb8b43838  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcamapi.so.1
0xbd5cf000  0xbd617450  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libiType.so.1
0xbd8b1000  0xbd9179dc  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libWTLE.so.1
0xbd81e000  0xbd883b50  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libinput_utilities.so.1
0xb8be8000  0xb8bfa260  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcares.so.1
0xbd783000  0xbd7df6f8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libssl.so.2
0xbd670000  0xbd6aa5d8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libgssapi.so.1
0xb8328000  0xb832c084  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libstrm.so.1
0xbd954000  0xbda060a4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libsbgse56.so.0
0xb93de000  0xb93eb1f4  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libmmedia.so.1
0xb93ec000  0xb93fcaec  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libmmfilter.so.1
0xb9c5b000  0xb9c68d00  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libbz2.so.1
0xb939e000  0xb93a626c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libhiddi.so.1
0xbdd07000  0xbdeb7764  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcrypto.so.2
0xb9ce8000  0xb9cf13ec  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libnbutil.so.1
0xbdc23000  0xbdc98498  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libkrb5.so.1
0xb9cde000  0xb9ce6310  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libheimntlm.so.1
0xbdb37000  0xbdbca0e8  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libasn1.so.1
0xb8200000  0xb8202110  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libcom_err.so.1
0xbd736000  0xbd77c91c  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libhx509.so.1
0xbaa7f000  0xbaa8f5f0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libroken.so.1
0xbd7ec000  0xbd8140fc  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libwind.so.1
0xb8414000  0xb84185c0  Yes (*)     /opt/bbndk/target_10_0_9_386/qnx6/x86/usr/lib/libheimbase.so.1
                        No          libHwEGL.so
                        No          libegl_gallium.so
                        No          libHwglapi.so
                        No          libpipe_vmwgfx_drv.so
0xbdf18000  0xbe00a9b8  Yes         /opt/bbndk/target_10_0_9_386/qnx6/x86/lib/libstdc++.so.6
                        No          libllvmpipe_drv.so
                        No          libHwGLESv2.so
(*): Shared library is missing debugging information.
(gdb) q
root@server:/opt/bbndk#

 

It seems to be crashing inside libc.so while trying to free something. There isn't any change in the QML code at all.

Even though everything seems to be compiling/linking properly, i am not able to find the reason for this crash.

I don't change the QML code at all but if I include my library and stdc++ it crashes. If i don't include my library and stdc++ it doesn't crash and everything is fine.

 

Can somebody please help me how to debug this issue? Am stuck in this for more than two days :smileysad:

 

Developer
BGmot
Posts: 1,068
Registered: ‎11-24-2011
My Device: PlayBook

Re: Application crashes after compiling/linking on command line and running on Simulator

>I don't change the QML code at all but if I include my library and stdc++ it crashes.

Do you change *any* code in your project? like calling a function from your lib or anything else?

New Contributor
pmnarsapur
Posts: 6
Registered: ‎09-27-2012
My Device: -

Re: Application crashes after compiling/linking on command line and running on Simulator

Found the issue. For the other library that I was building with the BB10 NDK toolchain, I wasn't using "qcc -Vgcc_ntox86 -lang-c++". I was instead using the ntox86-g++ under the host directory. And it was missing the required compiler flags that were internally used by qcc.

 

After changing the compiler, application got compiled, I did not have to provide libstdc++.a for it as well, and the application ran successfully.

New Contributor
pmnarsapur
Posts: 6
Registered: ‎09-27-2012
My Device: -

Re: Application crashes after compiling/linking on command line and running on Simulator

Hi,

No i did not change any code. It was a problem in the way i was using the toolchain to compile my library.

Thanks.