user2031207
user2031207

Reputation: 13

Android native use Qt library

I am using a static library which is developed by using QT(necessitas). Some issues block my work, so I am writing to ask for some advice from you. The strange issue I met is the static library and libQtCore.so is linked successfully with my Android native shared library (which compiled by using ndk-r8b), but crashes at libQtCore.so. The trace indicates that libQtCore.so crashes in some STL operation.

I have noticed that necessitas have its own ndk, so should I compile all of my android native library by using the ndk of necessitas? The libc++/libstdc++ of necessitas and android libc++/libstdc++ are ABI compatible ?

Here is the crash trace. Thank you very much.

signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0000`enter code here`0000

/data/app-lib/com.balabala-1/libQtCore.so (std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)+468)
/data/app-lib/com.balabala-1/libQtCore.so (std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int)+28)
02-18 10:53:50.779: I/DEBUG(159): stack:
02-18 10:53:50.779: I/DEBUG(159):          780664d0  7806656c  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          780664d4  78066510  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          780664d8  78066510  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          780664dc  7806656c  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          780664e0  72e37488  
02-18 10:53:50.779: I/DEBUG(159):          780664e4  761fcbcb  /data/app-lib/com.balabala-1/libmsess.so
02-18 10:53:50.779: I/DEBUG(159):          780664e8  c0000000  
02-18 10:53:50.779: I/DEBUG(159):          780664ec  0000004c  
02-18 10:53:50.779: I/DEBUG(159):          780664f0  0000004c  
02-18 10:53:50.779: I/DEBUG(159):          780664f4  00000000  
02-18 10:53:50.779: I/DEBUG(159):          780664f8  72e37480  
02-18 10:53:50.779: I/DEBUG(159):          780664fc  4021a3c3  /system/lib/libc.so (dlmalloc+5170)
02-18 10:53:50.779: I/DEBUG(159):          78066500  76317d28  
02-18 10:53:50.779: I/DEBUG(159):          78066504  762d2b0c  /data/app-lib/com.balabala-1/libmsess.so
02-18 10:53:50.779: I/DEBUG(159):          78066508  df0027ad  
02-18 10:53:50.779: I/DEBUG(159):          7806650c  00000000  
02-18 10:53:50.779: I/DEBUG(159):     #00  78066510  00000001  
02-18 10:53:50.779: I/DEBUG(159):          ........  ........
02-18 10:53:50.779: I/DEBUG(159):     #01  78066510  00000001  
02-18 10:53:50.779: I/DEBUG(159):          78066514  76317d28  
02-18 10:53:50.779: I/DEBUG(159):          78066518  78066594  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          7806651c  76317d28  
02-18 10:53:50.779: I/DEBUG(159):          78066520  762d2b0c  /data/app-lib/com.balabala-1/libmsess.so
02-18 10:53:50.779: I/DEBUG(159):          78066524  725e2fc8  
02-18 10:53:50.779: I/DEBUG(159):          78066528  78066594  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          7806652c  72e37488  
02-18 10:53:50.779: I/DEBUG(159):          78066530  00100000  
02-18 10:53:50.779: I/DEBUG(159):          78066534  72e37488  
02-18 10:53:50.779: I/DEBUG(159):          78066538  00000000  
02-18 10:53:50.779: I/DEBUG(159):          7806653c  75c7c4e0  /data/app-lib/com.balabala-1/libQtCore.so (std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)+40)
02-18 10:53:50.779: I/DEBUG(159):          78066540  00000001  
02-18 10:53:50.779: I/DEBUG(159):          78066544  78066594  [stack:24549]
02-18 10:53:50.779: I/DEBUG(159):          78066548  725e2fc8  
02-18 10:53:50.779: I/DEBUG(159):          7806654c  762026d5  /data/app-lib/com.balabala-1/libmsess.so

Upvotes: 1

Views: 1322

Answers (1)

Saqlain
Saqlain

Reputation: 17928

By default, the headers and libraries for the minimal C++ runtime system library (/system/lib/libstdc++.so) are used when building C++ sources.

You can however select a different implementation by setting the variable APP_STL to something else in your Application.mk, for example:

APP_STL := stlport_static

To select the static STLport implementation provided with this NDK. Value APP_STL values are the following:

system -> Use the default minimal C++ runtime library. stlport_static -> Use STLport built as a static library. stlport_shared -> Use STLport built as a shared library. gnustl_static -> Use GNU libstdc++ as a static library.

Which NDK are you using? Have you tried compiling one of the sample applications that utilize the STL such as test-libstdc++?

Upvotes: 1

Related Questions