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
Contributor
Posts: 17
Registered: ‎08-01-2012
My Device: Blackberry 10 Alpha Device
My Carrier: None

Blackberry 10 NDK 10.0.6.384 problem with C++ library causing app crash

There is critical inconsistency in linkage to C++ libraries in new NDK 10.0.6.384. Since updating to this NDK version newly compiled binaries are causing crash on early start, earlier than main() entry point is called (e.g. during initialization of static variables and etc.).

 

In my build environment I am using CMake tool to compile native libraries and app core and Native SDK is used to compile interface which is then loading compiled libraries dynamically during application execution. Earlier I used PlayBook NDK 2.0 and 2.1 Beta to compile and run application on Blackberry 10 Alpha Device (10.0.4.188) and all was fine.

 

After updating to latest Blackberry 10 NDK 10.0.6.384 and correcting CMake to new path compiled application is crashing. The crash happens during loading of libcpp.so.

 

I made experiment and compiled with static versions of: STDC++, CPP and SUPC++:


-Wl,-Bstatic -lsupc++ -lstdc++ -lcpp -Wl,-Bdynamic -lsocket -lm -lgcc -lc

 

After this application can run without a crash on Blackberry 10 NDK 10.0.6.384 and Blackberry 10 NDK 10.0.4.118. E.g. it is fully compatible with older and latest firmware while it is not compatible (crashing on initialization) with any version of firmware if STDC++, CPP and SUPC++ are linked dynamically:


-lsupc++ -lstdc++ -lcpp -lsocket -lm -lgcc -lc

 

What can be the problem and is it a bug of Blackberry 10 NDK 10.0.6.384 or there are specific steps during compilation process? Also if PlayBook NDK 2.0 or 2.1 Beta are used to compile binaries application will crash on latest Alpha Device firmware (10.0.6.384) while worked on older firmware (10.0.4.188).

Retired
Posts: 499
Registered: ‎05-07-2012
My Device: developer
My Carrier: developer

Re: Blackberry 10 NDK 10.0.6.384 problem with C++ library causing app crash

Sounds like you are compiling against a different version of the libraries than are on the device.  What version are you compiling against?  Are you specifying libraries in the bar file?

 

Stuart

Contributor
Posts: 17
Registered: ‎08-01-2012
My Device: Blackberry 10 Alpha Device
My Carrier: None

Re: Blackberry 10 NDK 10.0.6.384 problem with C++ library causing app crash

Hi Stuart!

 

Yes it seems so but I tried to make sure project is linking against correct libraries and nothing helped. I also tried to remove all NDKs, except 10.0.6.384 but nothing helps. In CMake configuration I removed any paths to libraries to let compiler/linker use predefined path but it does not help either. I also checked whether there are different versions of .SO C++ libraries but found only those in paths:

1) X:\bbndk\target_10_0_6_384\qnx6\armle-v7\lib

2) X:\bbndk\target_10_0_6_384\qnx6\armle-v7\lib\gcc\4.6.3

 

Please note that such problem started only on 10.0.6.384 NDK and Alpha Device. By the way, before 10.0.6.384 Alpha Device was accepting applications compiled with PlayBook NDK 2.0.1 and 2.1 Beta but now such application simply crash if C++ libraries not statically linked.

 

May be there are specific conditions which have to be met since 10.0.6.384 NDK?

 

Best regards,

Dmitry.

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

Re: Blackberry 10 NDK 10.0.6.384 problem with C++ library causing app crash

Compare what libraries you have in your SDKs and on the device. For example for NDK-10.0.4 I have:

ls -l /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/armle-v7/lib/libstdc++*

lrwxrwxrwx 1 1001 1001 19 Apr 25 13:18 /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/armle-v7/lib/libstdc++.so.6 -> libstdc++.so.6.0.16
-rwxr-xr-x 1 1001 1001 4517010 Apr 25 13:18 /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/armle-v7/lib/libstdc++.so.6.0.16

 

I don't have alpha device so can't tell wnything about it but you can easily find them by ssh'ing to your device.