06-03-2012 06:40 AM
I have a really trivial example that I've been unable to get running no matter what I try. I'm using ndk2.0.1. The setup to recreate the problem is simple; the project needs to link to qt(4.8.2) and to stdlibc++ (not libcpp, libstdc++).
(main.cpp)
#include <iostream>
#include <sstream>
int main(int argc, char *argv[])
{
std::cout << "This doesn't work\n";
return 0;
}
That's it. You can use whatever toolchain you want (ntoxg++ or qcc), it doesn't seem to matter. If you use the qcc tool chain, you have to explicitly include the libstdc++ paths and link to it, since it uses libcpp by default. Build the project: it should compile fine. The bar-descriptor I used is here (http://pastie.org/4018541).
Create the bar file and deploy it. Once I start the program at this point, it'll show me the splashscreen for a few seconds and quit (crash) ... You'll notice:
* no log output (we expect something from the cout call)
* a nice core file waiting from the crash
Running the core file through ntox-gdb gives you:
#0 0xb8b5e329 in __gnu_cxx::__exchange_and_add (__mem=0x0, __val=-1)
at atomicity.cc:36
36 atomicity.cc: No such file or directory.
in atomicity.cc
(gdb) backtrace
#0 0xb8b5e329 in __gnu_cxx::__exchange_and_add (__mem=0x0, __val=-1)
at atomicity.cc:36
#1 0xb8b03471 in __exchange_and_add_dispatch (__val=<optimized out>,
__mem=<optimized out>)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-n tox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/includ e/ext/atomicity.h:79
#2 _M_remove_reference (this=<optimized out>)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-n tox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/includ e/bits/locale_classes.h:505
#3 std::locale::~locale (this=0xb837d5fc, __in_chrg=<optimized out>)
at ../../../../../libstdc++-v3/src/locale.cc:89
#4 0xb8b0faa9 in ~basic_streambuf (this=<optimized out>,
__in_chrg=<optimized out>)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-n tox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/includ e/streambuf:193
#5 std::basic_filebuf<char, std::char_traits<char> >::~basic_filebuf (
this=0xb837d5e0, __in_chrg=<optimized out>)
at /home/builder/hudson/650-gcc-4.4/svn/linux-x86-o-n tox86/i486-pc-nto-qnx6.5.0/pic/libstdc++-v3/includ e/fstream:215
#6 0xb0bbd205 in __cxa_finalize ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.s o.3
#7 0xb832de67 in _btext ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libcpp .so.4
#8 0xb836a265 in _fini ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libcpp .so.4
#9 0xb0bd46d3 in ?? ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.s o.3
#10 0xb0bd5d38 in ?? ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.s o.3
#11 0xb0bbd052 in _cleanup ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.s o.3
#12 0xb0bbd337 in exit ()
from /home/preet/bbndk-2.0.1/target/qnx6/x86/lib/libc.s o.3
#13 0x080487b0 in _start ()I have no idea what to do with this stack trace and I haven't been able to debug the problem further.
This issue is especially messed up because I didn't even add any Qt code to the application yet; just linked to the libs. Not linking to the Qt libs will make this bit of code run fine. Linking to the Qt code with libcpp instead of libstdc++ will also make the code run as expected.
This problem's been driving me insane for the last coueple of days and I'd really really appreciate any help or advice.
Solved! Go to Solution.
06-04-2012 12:50 PM
How are you compiling? qcc or QCC? What options?
http://www.qnx.com/developers/docs/6.3.2/neutrino/
I'm wondering if there is a version conflict, where you are linking against one version but have a different version installed on the device. You may have more luck using QtCreator for PlayBook:
https://github.com/blackberry/Qt/downloads
Stuart
06-04-2012 01:14 PM
Can you provide your makefile?
For Qt apps you should be using qmake and then make - are you using qcc/QCC directly?
Stuart
06-04-2012 10:58 PM
Thanks for the replies.
> How are you compiling?
I tried qmake intially (which calls qcc) and then tried gcc/g++ manually as well. Both give the same results. See the makefile for the options used for qcc (autogenerated with Qt):
Just to be complete, here are all the files:
source file: http://pastie.org/4025238
pro file: http://pastie.org/4025259
bar file: http://pastie.org/4025254
auto-generated makefile: http://pastie.org/4029179
log and core dump (from device): http://pastie.org/4025285
> I'm wondering if there is a version conflict
not too sure what you mean here
Someone else on the #BlackBerryDev channel noted coming across a similar issue.
06-18-2012 01:00 PM
Have you straightened out your build?
You had a related question in http://supportforums.blackberry.com/t5/Native-Deve
Did the subsequent threads on the native forum discussing setting up the environment for Qt answer your questions, or is this a separate issue?
Stuart
06-18-2012 09:47 PM
The KDAB guys have told me its a bug and that they're looking into it.
03-22-2013 04:55 PM
Is it fixed. I found the Cascasde application still crash if using stdlibc++. I have to use libcpp. Please confirm.