E/art ( 8857): dlopen("/data/app/com.app/lib/arm/libcryptopp-and.so", RTLD_LAZY) failed: dlopen failed: library "libstlport_shared.so" not found
So I add:
ANDROID_EXTRA_LIBS += /Users/jhihn/Downloads/android-ndk-r10e/sources/cxx-stl/stlport/libs/armeabi-v7a/libstlport_shared.so
That satisfied the linker, but that produces the std:string 0xdeadcab1 crash, as previously posted. This seems to be a result of a linking problem. The wiki says:
The second optional argument is a STL library. The default is STLport as a shared library due to GNU licensing requirements. STL libraries can be one of:
The std:string crash does not happen on OSX/iOS. It also doesn't happen on android until I use Crypto++ with std::strings.
Meanwhile, on all platforms, QString/QByteArray does not seem to "play nice" with Crypto++. QString when using constData() function just returns the .constData() toUtf8() byte array. Very weird things happen, like nulls being missed (QByteArray places a null at the end in most cases). I've used Qt's classes extensively and never had this issue. Does anyone know what is going on?
And that beings me to the third topic (not an issue):
Would anyone be interested in a Crypto Qt classes/overloads?
The second optional argument is a STL library. The default is STLport as a shared library due to GNU licensing requirements. STL libraries can be one of:
- stlport (shared)
- stlport-static
- stlport-shared
- gnu (shared)
- gnu-static
- gnu-shared
But I don't know why one would be better than the other. The Crypto++ docs seem to prefer stlport-shared. But why?
void* cryptlib = NULL; cryptlib = dlopen("libcryptopp.so", RTLD_GLOBAL); if(!cryptlib) cryptlib = dlopen("libcryptopp.so", RTLD_GLOBAL | RTLD_LAZY); if(!cryptlib) cryptlib = dlopen("libcrypto++.so", RTLD_GLOBAL); if(!cryptlib) cryptlib = dlopen("libcrypto++.so", RTLD_GLOBAL | RTLD_LAZY); if(!cryptlib) throw runtime_error("Failed to load crypto++ shared object"); ... dlclose(cryptlib);
Also note that getting the dlopen flags correct can be challenging. I use the following code (when needed) code because something that works on one platform does not work on another (from http://cryptopp.com/wiki/Linux#Note_for_Shared_Object_Callers):void* cryptlib = NULL; cryptlib = dlopen("libcryptopp.so", RTLD_GLOBAL); if(!cryptlib) cryptlib = dlopen("libcryptopp.so", RTLD_GLOBAL | RTLD_LAZY); if(!cryptlib) cryptlib = dlopen("libcrypto++.so", RTLD_GLOBAL); if(!cryptlib) cryptlib = dlopen("libcrypto++.so", RTLD_GLOBAL | RTLD_LAZY); if(!cryptlib) throw runtime_error("Failed to load crypto++ shared object"); ... dlclose(cryptlib);I think you figured it out for me, I need RTLD_GLOBAL in the dlopen() qt-generated android activity to load the library so that crypto++ can access it. Be default it is only specifying RTLD_LAZY