I'm trying to compile an application using C++11 and OpenGL ES for Android using NativeActivity. I'm using
APP_STL := gnustl_shared
and everything compiles just fine. But when running my app I get:
dlopen(libjngl-test.so): Cannot load library: soinfo_relocate(linker.cpp:976): cannot locate symbol "_ZSt11_Hash_bytesPKvjj" referenced by "libjngl-test.so"...
jngl-test ist my activity. This is how my loading code looks like:
#include <android/native_activity.h>
#include <android/log.h>
#include <dlfcn.h>
#include <errno.h>
#include <stdexcept>
void* load_lib(const std::string& l) {
auto handle = dlopen(std::string("/data/data/com.bixense.jngl_test/lib/" + l).c_str(),
RTLD_NOW | RTLD_GLOBAL);
if (!handle) {
throw std::runtime_error(std::string("dlopen(") + l + "): " + dlerror());
}
__android_log_print(ANDROID_LOG_INFO, "bootstrap", "Loaded %s", l.c_str());
return handle;
}
void ANativeActivity_onCreate(ANativeActivity* app, void* ud, size_t udsize) {
try {
load_lib("libogg.so");
load_lib("libvorbis.so");
auto main = reinterpret_cast<void (*)(ANativeActivity*, void*, size_t)>(
dlsym(load_lib("libjngl-test.so"), "ANativeActivity_onCreate")
);
if (!main) {
throw std::runtime_error("undefined symbol ANativeActivity_onCreate");
}
main(app, ud, udsize);
} catch(std::exception& e) {
__android_log_print(ANDROID_LOG_ERROR, "bootstrap", "%s", e.what());
ANativeActivity_finish(app);
}
}
Does anybody have an idea what I'm doing wrong? Where could _ZSt11_Hash_bytesPKvjj come from?