08-06-2012 05:58 AM
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).
08-07-2012 03:37 PM
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?
08-09-2012 06:07 AM
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:
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?
08-09-2012 10:05 AM
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/arml
lrwxrwxrwx 1 1001 1001 19 Apr 25 13:18 /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/arml
-rwxr-xr-x 1 1001 1001 4517010 Apr 25 13:18 /Developer/SDKs/bbndk-10.0.4-beta/target/qnx6/arml
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.